-
Notifications
You must be signed in to change notification settings - Fork 537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Operands are treated as literals instead of ids at capability check #248
Comments
Confirmed. I tracked it down to the CapCheck function at https://github.com/KhronosGroup/SPIRV-Tools/blob/master/source/validate_instruction.cpp#L87 For operands that are IDs, it should not be checking the ID value itself, but rather the underlying constant if it can find one. Note that we should have a one-sided error, i.e. if we can't determine the value then let it pass. (This might occur if there's a complex expression the code doesn't know how to evaluate. Looking at the operand types in libspirv.h, this kind of problem would only affect SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID (as in this reported but), or SPV_OEPRAND_TYPE_SCOPE_ID, but none of those values have required capabilities. Sending to @umar456 |
I have a stopgap PR that I'll post shortly. |
Works around issue 248 by weakening the test: KhronosGroup#248 The validator should try to track (32-bit) constant values, and then for capability checks on IDs, check the referenced value, not the raw ID number.
Works around issue 248 by weakening the test: KhronosGroup#248 The validator should try to track (32-bit) constant values, and then for capability checks on IDs, check the referenced value, not the raw ID number.
Workaround has been merged. I filed #252 for the "proper" (completist) fix. |
Implement header definitions for SPV_NV_bindless_texture
In particular during validation of atomic instructions memory semantics operands are treated as literals, but according to the spec they must be id.
In the attached example, it happened that OpAtomicIAdd has memory semantics operand = %64. Literally it corresponds to 0x40 (UniformMemory, which require shader capability). But actually %64 is an id of an integer constant = 0x10(SequentiallyConsistent, no capability required).
This causes false positive errors to be reported by spirv-val tool:
atomic_exchange.global_atomic_double_declared_in_program.used_in_generic_function.order_relaxed.spv20_32.zip
atomic_exchange.global_atomic_double_declared_in_program.used_in_generic_function.order_relaxed.spv20_32.txt
The text was updated successfully, but these errors were encountered: