[llvm] [AMDGPU] Add intrinsic readanylane (PR #115696)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 2 04:37:40 PST 2024
jayfoad wrote:
> > It is better to describe it as "readanylane(x) is x if x is uniform, otherwise readanylane(x) is undefined".
>
> Compared to that, `@llvm.assume(@llvm.is.uniform())` actively tells the compiler that the user _knows_ that this use of the value is uniform. But then, if the user is wrong, then the result is undefined anyway. In what way is one better than the other?
Are you asking me? I am slightly reluctant to use `@llvm.assume` because I am less familiar with it, and it seems more complicated: to tell whether a value `%x` is uniform you would have to search its uses looking for the `@llvm.assume(@llvm.is.uniform(%x))` pattern, and probably check that those intrinsic calls dominate the use of `%x`. I guess InstCombine is already set up to do this for you, but I am not sure about other parts of the compiler that might want to do an ad hoc optimization when they can assume `%x` is uniform.
https://github.com/llvm/llvm-project/pull/115696
More information about the llvm-commits
mailing list