Skip to content

Commit 6d6d62e

Browse files
layers: Add TensorARM to descriptor heaps
- add check for VU 11457 - add type to existing unit tests
1 parent 971893e commit 6d6d62e

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

layers/stateless/sl_descriptor.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,12 @@ bool Device::manual_PreCallValidateWriteResourceDescriptorsEXT(VkDevice device,
16871687
}
16881688
}
16891689
}
1690+
} else if (IsDescriptorHeapTensor(resource.type)) {
1691+
if (!resource.data.pTensorARM && !enabled_features.nullDescriptor) {
1692+
skip |= LogError("VUID-VkResourceDescriptorInfoEXT-None-11457", device, data_loc.dot(Field::pTensorARM),
1693+
"is NULL, but nullDescriptor feature is not enabled. (type is %s)",
1694+
string_VkDescriptorType(resource.type));
1695+
}
16901696
} else {
16911697
skip |= LogError("VUID-VkResourceDescriptorInfoEXT-type-11210", device, resource_loc.dot(Field::type),
16921698
"(%s) is not a supported type when using descriptor heaps.", string_VkDescriptorType(resource.type));

layers/utils/vk_api_utils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,7 @@ static constexpr bool IsDescriptorHeapImage(const VkDescriptorType type) {
220220
(type == VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM) || (type == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) ||
221221
(type == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT);
222222
}
223+
224+
static constexpr bool IsDescriptorHeapTensor(const VkDescriptorType type) {
225+
return (type == VK_DESCRIPTOR_TYPE_TENSOR_ARM);
226+
}

tests/icd/test_icd.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,6 +2011,7 @@ static VKAPI_ATTR VkDeviceSize VKAPI_CALL GetPhysicalDeviceDescriptorSizeEXT(VkP
20112011
case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR:
20122012
case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV:
20132013
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
2014+
case VK_DESCRIPTOR_TYPE_TENSOR_ARM:
20142015
return 256;
20152016
default:
20162017
break;

tests/unit/descriptor_heap.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,8 @@ TEST_F(NegativeDescriptorHeap, ResourceParameterSize) {
465465

466466
TEST_F(NegativeDescriptorHeap, ResourceParameterDataNull) {
467467
TEST_DESCRIPTION("Validate vkWriteResourceDescriptorsEXT null pointer");
468+
AddRequiredExtensions(VK_ARM_TENSORS_EXTENSION_NAME);
469+
AddRequiredFeature(vkt::Feature::tensors);
468470
RETURN_IF_SKIP(InitBasicDescriptorHeap());
469471

470472
const struct {
@@ -483,7 +485,10 @@ TEST_F(NegativeDescriptorHeap, ResourceParameterDataNull) {
483485
{"VUID-VkResourceDescriptorInfoEXT-None-11213",
484486
std::vector<VkDescriptorType>{// checked in separate test VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR,
485487
// VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV,
486-
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER}}};
488+
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER}},
489+
{"VUID-VkResourceDescriptorInfoEXT-None-11457",
490+
std::vector<VkDescriptorType>{VK_DESCRIPTOR_TYPE_TENSOR_ARM}},
491+
};
487492
for (const auto& s : subtests) {
488493
for (auto type : s.types) {
489494
const VkDeviceSize size = vk::GetPhysicalDeviceDescriptorSizeEXT(Gpu(), type);

tests/unit/descriptor_heap_positive.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,15 @@ TEST_F(PositiveDescriptorHeap, GraphicsPushData) {
341341
TEST_F(PositiveDescriptorHeap, ResourceParameterDataNull) {
342342
TEST_DESCRIPTION("Validate vkWriteResourceDescriptorsEXT null pointer when nullDescriptor enabled");
343343
AddRequiredExtensions(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME);
344+
AddRequiredExtensions(VK_ARM_TENSORS_EXTENSION_NAME);
344345
AddRequiredFeature(vkt::Feature::nullDescriptor);
346+
AddRequiredFeature(vkt::Feature::tensors);
345347
RETURN_IF_SKIP(InitBasicDescriptorHeap());
346348

347349
std::vector<VkDescriptorType> types{VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
348350
VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER,
349-
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER};
351+
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
352+
VK_DESCRIPTOR_TYPE_TENSOR_ARM};
350353
for (auto type : types) {
351354
const VkDeviceSize size = vk::GetPhysicalDeviceDescriptorSizeEXT(Gpu(), type);
352355
auto data = std::make_unique<uint8_t[]>(static_cast<size_t>(size));
@@ -355,7 +358,7 @@ TEST_F(PositiveDescriptorHeap, ResourceParameterDataNull) {
355358
resource_desc_info.type = type;
356359
VkHostAddressRangeEXT descriptors = {data.get(), static_cast<size_t>(size)};
357360

358-
// We do not expect error messages due to nullDescriptor enables pTexelBuffer, pAddressRange, pImage to be null
361+
// We do not expect error messages due to nullDescriptor enables pTexelBuffer, pAddressRange, pImage, pTensorARM to be null
359362
vk::WriteResourceDescriptorsEXT(device(), 1u, &resource_desc_info, &descriptors);
360363
}
361364
}

0 commit comments

Comments
 (0)