Conversation
`OpExecutionModeId` and the `LocalSizeId` execution mode are missing before SPIR-V 1.2[0], and currently when targeting an earlier version, it is ignored and the work group sizes are set to 1 instead without any diagnostic. So to prevent surprises, reject `local_size_*_id` layout qualifiers when targeting a SPIR-V version before 1.2. [0]: https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpExecutionModeId
Only use `LocalSizeId` when necessary, same changes as KhronosGroup#3351 but applied to mesh and task shaders. Fixes KhronosGroup#3739
`OpExecutionModeId` and the `LocalSizeId` execution mode were added in SPIR-V 1.2[0]. So use them when targeting at least 1.2. [0]: https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpExecutionModeId See KhronosGroup#3510
Changing the value of `needSizeId` in the loop will have no effect because it is not checked after that anywhere.
|
|
| } | ||
| } | ||
| if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6 && needSizeId) { | ||
| if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_2 && needSizeId) { |
There was a problem hiding this comment.
Could you please add a test for this? The one in #3510 seems fine. Also, please split it into its own PR for clarity.
There was a problem hiding this comment.
I suppose I should add it to Spv.FromFile.cpp? And I imagine I can just add two new test suites CompileToSpirv11Test and CompileToSpirv12Test, and then use the same input file for both?
|
I have somehow missed the test suite, sorry. These changes generate 11 failures: Mostly due to to new "requires SPIR-V 1.2" error message. |
The first commit adds a diagnostic when
local_size_*_idis used when targeting < SPIR-V 1.2. I think it would be nice to get a diagnostic if the qualifier will be ignored in the end; I was surprised by this behaviour.The second commit essentially applies #3351 to mesh and task shaders (#3739).
The third commit, I'm not entirely sure about, but according to https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpExecutionModeId
local_size_*_idshould be available when targeting at least SPIR-V 1.2, so that commit lowers the required versions.The fourth is a trivial cleanup.
Related: