[llvm] [AMDGPU] Update hasUnwantedEffectsWhenEXECEmpty (PR #97982)
Carl Ritson via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 02:07:26 PDT 2024
perlfu wrote:
> Seems reasonable, but I don't really feel super confident about whether this could break anything or fix anything. Does it have any effect on Vulkan CTS?
This change passes Vulkan CTS.
Let me clarify why I think this is "correct".
Current codegen can generate branches over barriers, these will be always be retained if we run with -O0.
SIPreEmitPeephole can remove these if the branch distances is short and the function modified in this change returns false.
This leads to the situation where we *might* not skip a barrier for arbitrary reasons.
In practice, if all invocations in the workgroup are running the same shader/kernel in non-cyclic control flow then unskipping the barrier will not make any difference.
However if we have some kind cyclic barrier invocation with divergence, or interaction of different kernels on a barrier, then we should respect the branches over barrier operations, because we do not know any better.
We might of course decide that certain barriers should *always* be executed.
However I think this is for the control flow lowering to decide.
If we want this then we simply need to not introduce a branch over the barrier in the first place.
https://github.com/llvm/llvm-project/pull/97982
More information about the llvm-commits
mailing list