[llvm-branch-commits] [llvm] [AMDGPU] Make amdgpu.noclobber respect acquire operations (PR #219991)

Fabian Ritter via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 5 05:10:50 PST 2026


ritter-x2a wrote:

@jayfoad 

> Add a fence case to promote-kernel-arguments.ll. The PR changes that pass's behaviour and no test shows it.

Added a test in #219990 and made sure that it changes the behavior with this PR.

> Add a call to an external function, or a helper containing an acquire, to noclobber-barrier.ll. It works, but nothing pins it.

Added a test with an external function in #219990; it counted as a clobber before and still does.

> The noclobber-barrier.ll header comment ("barrier or fence in between of loads is not considered a clobber") is now wrong for acquire fences.

Updated the comment in this PR.

> isReallyAClobber's comment says "Ignore non-acquire atomics not aliasing ... just like a fence". Fences are now not always ignored. Reword it[...]

Updated the comment in this PR.

> - fence syncscope("singlethread") acquire can't synchronise with another thread, so it could be ignored.
> - Acquires marked !mmra !{!"amdgcn-av", !"none"} are not make-visible operations, so they could also be ignored.
> - A follow-up could ignore workgroup-or-narrower acquires when the kernel has no possibly-aliasing writes, no unknown calls, and no acquire wider than workgroup anywhere in the function.

Not wrong, but I'd suggest we put those up for future work in separate PRs.
- Singlethread fences should be rather rare (because they are mostly useless).
- Checking for the AV-none MMRA here will require some more refactoring like in #231854.
- I'm not sure about the compile-time impact of the last suggestion. Is this kind of kernel-wide analysis something we commonly do?

> Needs a rebase after #235806 to fix a failing test.

Done.

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


More information about the llvm-branch-commits mailing list