Skip to content

Commit

Permalink
[SPV_KHR_untyped_pointers] Fix verification of vload/vstore OpenCL.st…
Browse files Browse the repository at this point in the history
…d instructions

Allow `p` to be untyped pointer.

```
operand must be a pointer(p1, ...).If it is a typed pointer, it must point to data types.

```

https://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/KHR/SPV_KHR_untyped_pointers.html#_modifications_to_the_opencl_std_extended_instruction_set
  • Loading branch information
vmaksimo committed Sep 6, 2024
1 parent b31baff commit a22a1f7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions source/val/validate_extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2701,8 +2701,9 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
"Generic, CrossWorkgroup, Workgroup or Function";
}

if (!_.IsFloatScalarType(p_data_type) ||
_.GetBitWidth(p_data_type) != 16) {
if ((!_.IsFloatScalarType(p_data_type) ||
_.GetBitWidth(p_data_type) != 16) &&
!_.ContainsUntypedPointer(p_type)) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< ext_inst_name() << ": "
<< "expected operand P data type to be 16-bit float scalar";
Expand Down Expand Up @@ -2763,8 +2764,9 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
"Generic, CrossWorkgroup, Workgroup or Function";
}

if (!_.IsFloatScalarType(p_data_type) ||
_.GetBitWidth(p_data_type) != 16) {
if ((!_.IsFloatScalarType(p_data_type) ||
_.GetBitWidth(p_data_type) != 16) &&
!_.ContainsUntypedPointer(p_type)) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< ext_inst_name() << ": "
<< "expected operand P data type to be 16-bit float scalar";
Expand Down Expand Up @@ -2855,8 +2857,9 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
"CrossWorkgroup, Workgroup or Function";
}

if (!_.IsFloatScalarType(p_data_type) ||
_.GetBitWidth(p_data_type) != 16) {
if ((!_.IsFloatScalarType(p_data_type) ||
_.GetBitWidth(p_data_type) != 16) &&
!_.ContainsUntypedPointer(p_type)) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< ext_inst_name() << ": "
<< "expected operand P data type to be 16-bit float scalar";
Expand Down

0 comments on commit a22a1f7

Please sign in to comment.