SPIR-V compute shaders require OpExecutionMode to set workgroup size (e.g., 64x1x1 threads). The backend auto-emits a default of 1x1x1 (single thread).
If you want a different size, you'd write inline asm: asm volatile ("OpExecutionMode %entry LocalSize 64 1 1");
But:
- Before commit 1: This errors with "cannot set execution mode in assembly"
- After commit 1: It works, but now you get TWO OpExecutionMode instructions (yours + the default 1x1x1)
- After commit 2: Backend checks if you already emitted one, skips the default
TL;DR: Lets users set custom workgroup sizes via inline asm without duplicate instructions.
SPIR-V compute shaders require OpExecutionMode to set workgroup size (e.g., 64x1x1 threads). The backend auto-emits a default of 1x1x1 (single thread).
If you want a different size, you'd write inline asm: `asm volatile ("OpExecutionMode %entry LocalSize 64 1 1");`
But:
1. Before commit 1: This errors with "cannot set execution mode in assembly"
2. After commit 1: It works, but now you get TWO OpExecutionMode instructions (yours + the default 1x1x1)
3. After commit 2: Backend checks if you already emitted one, skips the default
TL;DR: Lets users set custom workgroup sizes via inline asm without duplicate instructions.