[llvm-branch-commits] [llvm] [AMDGPU][SIMemoryLegalizer] Lower single-wave workgroup scope to wavefront in absence of LDSDMA (PR #224065)
Pierre van Houtryve via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Sep 16 17:00:15 PDT 2026
================
@@ -824,9 +838,23 @@ SIAtomicAddrSpace SIMemOpAccess::toSIAtomicAddrSpace(unsigned AS) const {
return SIAtomicAddrSpace::OTHER;
}
+/// returns true if any instruction in \p MF accesses LDS through DMA.
+static bool containsLDSDMA(const MachineFunction &MF) {
+ return any_of(MF, [](const MachineBasicBlock &MBB) {
+ return any_of(MBB.instrs(), [](const MachineInstr &MI) {
+ return SIInstrInfo::isLDSDMA(MI);
----------------
Pierre-vh wrote:
I think this belongs in the attributor, same as FLAT_SCRATCH_INIT - create a generic attribute to say whether a function may issue any kind of asynchronous operation such as LDSDMA, TENSOR, ASYNC, etc.
I think the property we're interested in is knowing whether there is any chance a thread may perform accesses via a third-party of some kind (async engine, DMA, etc.) ? And if it does, we can't demote because, in a way, the workgroup is technically no longer a single wave, an external engine is also involved.
You also need to conservatively assume it can perform async operations on targets where such ops are available and you have indirect calls or external calls.
cc @arsenm does that seem sensible to you ?
https://github.com/llvm/llvm-project/pull/224065
More information about the llvm-branch-commits
mailing list