[llvm] [AMDGPU] Add intrinsic readanylane (PR #115696)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 02:48:30 PST 2024


jayfoad wrote:

> `y = readanylane(x)` that means x is uniform outside of if, and `z = readanylane(x)` that means x is uniform inside of if.
> Looks like okay, OTOW, x is always uniform in this case, either inside or outside of the if. Right?

I don't think it is helpful to say "readanylane(x) _means_ x is uniform", because the presence of the readanylane() call does not magically make x uniform if it was not already uniform. It is better to describe it as "readanylane(x) is x if x is uniform, otherwise readanylane(x) is undefined".

With that in mind, does my explanation make sense to you:

> The problem is when x is uniform inside the if but divergent outside the if. Then z is defined but y is undefined, so it is not OK to replace a use of z with a use of y.

https://github.com/llvm/llvm-project/pull/115696


More information about the llvm-commits mailing list