[clang] [llvm] [AMDGPU] Introduce asyncmark/wait intrinsics (PR #173259)

Pierre van Houtryve via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 5 02:46:31 PST 2026


================
@@ -566,6 +569,27 @@ class SIInsertWaitcnts {
     return VmemReadMapping[getVmemType(Inst)];
   }
 
+  bool hasCPolAsyncBit(const MachineInstr &MI) const {
+    const MachineOperand *CPol = TII->getNamedOperand(MI, AMDGPU::OpName::cpol);
+    return CPol && (CPol->getImm() & AMDGPU::CPol::ASYNC_pregfx12);
+  }
+
+  bool isAsync(const MachineInstr &MI) const {
+    if (!SIInstrInfo::isLDSDMA(MI))
+      return false;
+    if (SIInstrInfo::usesASYNC_CNT(MI))
+      return true;
+    return hasCPolAsyncBit(MI);
----------------
Pierre-vh wrote:

```suggestion
    return SIInstrInfo::usesASYNC_CNT(MI) || hasCPolAsyncBit(MI);
```

small nit: Should all of these be in the SIInstrInfo class instead (or some other memory util header) ? They're generic utils
I personally prefer when small utils like these (with a clear name and simple impl) are in a separate place, even though the consensus (I think) is to leave them in here because they're only used in one place.

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


More information about the cfe-commits mailing list