Conversation
| return SPV_SUCCESS; | ||
| } | ||
|
|
||
| spv_result_t ValidateSizeOf(ValidationState_t& _, const Instruction* inst) { |
There was a problem hiding this comment.
For completeness, could you add check for the pointer operand? It must point to a concrete. I don't think untyped pointers are allowed here.
There was a problem hiding this comment.
so I tried to add a IsConcreteType helper, from what I can read from SPV_KHR_untyped_pointers, there is no reason I can see why an untyped pointer would not be allowed, as long as it is Physical
There was a problem hiding this comment.
An untyped pointer could be returned I suppose, but I meant pointer that OpSizeOf has an operand which is a pointer and it returns the size of the object pointed to by that pointer. Untyped pointers don't carry the information to make that check easy. Also, I don't think the extension modified this instruction. So you could have a function variable containing an untyped pointer (say to cross-workgroup), but not an untyped function variable I think.
There was a problem hiding this comment.
ok, so ya, this makes sense... I guess my question is I am over following the spec, trying to think where in the spec would be where to make a change to make this explicit
For this, since I did the check as IsConcreteType, where would I then look for the untyped pointer exception... is this suppose to mean that an untyped pointer is abstract?
There was a problem hiding this comment.
I think it's like the following: if pointer has OpTypePointer, then check that the pointee is concrete. Because OpenCL uses Physical32 or Physical64 addressing model, all pointers (including untyped) are physical, and thus concrete. I'm on the fence about banning untyped pointers as the pointer operand since OpSizeOf is not particularly well described. I briefly spent some time on godbolt.org trying to generate it and I couldn't find a situation where it was not statically known very easily.
There was a problem hiding this comment.
updated with a condition to ban untyped
7779d4d to
a518a01
Compare
a518a01 to
c3e0585
Compare
in pursuit of learning more about OpenCL, found some un-validated instructions