[llvm] [WIP][AMDGPU] combine uniform AMDGPU lane Intrinsics (PR #116953)
Sameer Sahasrabuddhe via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 9 19:08:08 PST 2024
ssahasra wrote:
> ```
> if (ballot_all(x)) {
> speculatable_use(x)
> ...
> }
> ```
>
> Which may then later be incorrectly hoisted:
>
> ```
> speculatable_use(x) // x is not actually uniform anymore
> if (ballot_all(x)) { ... }
> ```
>
> There needs to be something tying the uniformity to the use position
Actually there is more going on here than just a lack of `convergent`. `ballot_all(x)` is a uniform condition. It will allow convergent operations to be hoisted over it. So if `speculatable_use(x)` really does depend on `x` being uniform, then it `convergent` is not enough to stop it. But should this use have `speculatable` in the first place? By explicitly putting the `speculatable` attribute, the user is saying that the compiler is free to move hoist this use wherever other conditions are met. Perhaps they shouldn't be using `speculatable` in the absence of nuance about uniformity?
https://github.com/llvm/llvm-project/pull/116953
More information about the llvm-commits
mailing list