[llvm] [AMDGPU] Consider FLAT instructions for VMEM hazard detection (PR #137170)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu May 29 01:11:30 PDT 2025


================
@@ -1417,9 +1417,8 @@ static bool shouldRunLdsBranchVmemWARHazardFixup(const MachineFunction &MF,
   bool HasVmem = false;
   for (auto &MBB : MF) {
     for (auto &MI : MBB) {
-      HasLds |= SIInstrInfo::isDS(MI);
-      HasVmem |= (SIInstrInfo::isVMEM(MI) && !SIInstrInfo::isFLAT(MI)) ||
-                 SIInstrInfo::isSegmentSpecificFLAT(MI);
+      HasLds |= SIInstrInfo::isDS(MI) || SIInstrInfo::isLDSDMA(MI);
+      HasVmem |= SIInstrInfo::isVMEM(MI) && !SIInstrInfo::isLDSDMA(MI);
----------------
jayfoad wrote:

> I think the intent here was to check for GLOBAL_* or SCRATCH_* instructions, excluding FLAT_* instructions (but all 3 sets are FLAT encoded instructions)

Agreed, that matches the GFX9/GFX10 docs that I have found. Only MUBUF, GLOBAL_* and SCRATCH_* instructions support load-to-LDS.

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


More information about the llvm-commits mailing list