From 384d527ebb7578b5a8d69fb05f41c5aa9a363115 Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Mon, 11 Nov 2024 17:18:45 +0100 Subject: [PATCH] spirv-val: Report VUID 08973 only in Vulkan environments (#5873) The storage class restriction for `OpCooperativeMatrixLoadKHR` and `OpCooperativeMatrixStoreKHR` comes from the Vulkan specification; as such VUID 08973 should not be reported outside of Vulkan target environments. Signed-off-by: Sven van Haastregt --- source/val/validate_memory.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source/val/validate_memory.cpp b/source/val/validate_memory.cpp index ef05d6e6cf..32f642712c 100644 --- a/source/val/validate_memory.cpp +++ b/source/val/validate_memory.cpp @@ -2115,14 +2115,16 @@ spv_result_t ValidateCooperativeMatrixLoadStoreKHR(ValidationState_t& _, const auto storage_class = pointer_type->GetOperandAs(storage_class_index); - if (storage_class != spv::StorageClass::Workgroup && - storage_class != spv::StorageClass::StorageBuffer && - storage_class != spv::StorageClass::PhysicalStorageBuffer) { - return _.diag(SPV_ERROR_INVALID_ID, inst) - << _.VkErrorID(8973) << opname - << " storage class for pointer type " - << _.getIdName(pointer_type_id) - << " is not Workgroup, StorageBuffer, or PhysicalStorageBuffer."; + if (spvIsVulkanEnv(_.context()->target_env)) { + if (storage_class != spv::StorageClass::Workgroup && + storage_class != spv::StorageClass::StorageBuffer && + storage_class != spv::StorageClass::PhysicalStorageBuffer) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(8973) << opname + << " storage class for pointer type " + << _.getIdName(pointer_type_id) + << " is not Workgroup, StorageBuffer, or PhysicalStorageBuffer."; + } } if (!untyped) {