[clang] [llvm] [HLSL] Implement `WaveReadLaneAt` intrinsic (PR #111010)
Steven Perron via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 9 11:14:17 PDT 2024
================
@@ -428,6 +431,7 @@ bool SPIRVInstructionSelector::spvSelect(Register ResVReg,
case TargetOpcode::G_INTRINSIC:
case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS:
+ case TargetOpcode::G_INTRINSIC_CONVERGENT:
----------------
s-perron wrote:
The extra convergence information is being used when we generate the merge instructions. They should not change how the instrinsic itself is generated. The convergence token help us distinguish between:
```
int i;
for(i = 0; i < N; ++i) {
if (cond(i)) {
// The "active" lanes are those where cond was true in the same iteration.
WaveReadLaneAt(i);
break;
}
}
for(i = 0; i < N; ++i) {
if (cond(i))
break;
}
// All lanes are active because they all reconverged at the end of the loop.
WaveReadLaneAt(i);
```
https://github.com/llvm/llvm-project/pull/111010
More information about the cfe-commits
mailing list