[llvm] [AMDGPU] Eliminate likely-spurious execz checks (PR #117567)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 26 00:20:42 PST 2024
jayfoad wrote:
I see. I think you really want to know "will this divergent condition be true for at least one lane", in which case the "execz" condition will not be satisfied so you can remove the s_cbranch_execz.
I agree that using normal branch weights for this feels wrong, since a condition like "laneid == 0" is mostly false (for most lanes) but it _does_ satisfy the condition you're interested in.
I don't see how any heuristic based on sources of divergence can help you here. Source of divergence just mean "not guaranteed to be uniform", and says nothing about whether the results in different lanes are actually likely to be different. I think perhaps you just need to pattern match specific cases like "laneid == constant" and "x == readfirstlane(x)".
https://github.com/llvm/llvm-project/pull/117567
More information about the llvm-commits
mailing list