Skip to content

Commit

Permalink
spirv-val: Report VUID 08973 only in Vulkan environments (#5873)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
svenvh authored Nov 11, 2024
1 parent 9117e04 commit 384d527
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions source/val/validate_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2115,14 +2115,16 @@ spv_result_t ValidateCooperativeMatrixLoadStoreKHR(ValidationState_t& _,
const auto storage_class =
pointer_type->GetOperandAs<spv::StorageClass>(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 <id> "
<< _.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 <id> "
<< _.getIdName(pointer_type_id)
<< " is not Workgroup, StorageBuffer, or PhysicalStorageBuffer.";
}
}

if (!untyped) {
Expand Down

0 comments on commit 384d527

Please sign in to comment.