[llvm] [AMDGPU] Add intrinsic readanylane (PR #115696)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 11 02:23:59 PST 2024
jayfoad wrote:
Thanks for working on this!
> It doesn't convergent, so can be moved between control flows.
Unfortunately the new intrinsic still has to be `convergent`.
Consider these transformations:
```
A: x = def(); B: x = def();
y = read*lane(x); if (divergentcondition) {
if (divergentcondition) { y = read*lane(x);
use(y); use(y);
} }
```
Transforming A-->B is not safe for `readfirstlane`, but it is safe for `readanylane` (because if x is uniform outside the `if` then it must also be uniform inside the `if`). Transforming B-->A is not safe for `readfirstlane` and not safe for `readanylane`.
Unfortunately the `convergent` attribute currently restricts both of these transforms, so we need `readanylane` to be convergent to prevent B-->A.
Maybe in future we can have some better way to express this which will allow transforming A-->B but prevent B-->A.
Cc: @nhaehnle @ssahasra
https://github.com/llvm/llvm-project/pull/115696
More information about the llvm-commits
mailing list