[Mlir-commits] [mlir] [mlir][amdgpu] Add `rocdl.s.waitcnt` wrapper (PR #149670)

Stanley Winata llvmlistbot at llvm.org
Sat Jul 19 16:32:31 PDT 2025


================
@@ -419,6 +419,52 @@ struct RawBufferOpLowering : public ConvertOpToLLVMPattern<GpuOp> {
   }
 };
 
+// TODO: AMDGPU backend already have all this bitpacking logic, we should move
+// it to some common place.
+static FailureOr<unsigned> encodeWaitcnt(Chipset chipset, unsigned vmcnt,
+                                         unsigned expcnt, unsigned lgkmcnt) {
+  if (chipset.majorVersion == 9) {
----------------
raikonenfnu wrote:

NIT: Thoughts on adding some doc based on https://github.com/llvm/llvm-project/blob/54492c231c5d9091d086bfb767423415ea6bd0bc/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h#L1128-L1135 here too?  Something like:
```
///     \p Vmcnt = \p Waitcnt[15:14,3:0]
///     \p Expcnt = \p Waitcnt[6:4]
///     \p Lgkmcnt = \p Waitcnt[11:8]
```

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


More information about the Mlir-commits mailing list