[Mlir-commits] [mlir] [MLIR][ROCDL] Add conversion for gpu.subgroup_id to ROCDL (PR #136405)
Alan Li
llvmlistbot at llvm.org
Tue Apr 22 10:13:02 PDT 2025
================
@@ -204,6 +204,15 @@ def ROCDL_ReadlaneOp : ROCDL_IntrOp<"readlane", [], [0], [AllTypesMatch<["res",
}];
}
+// The LLVM intrinsic function name is rather mouthful,
+// so here we opt to use a shorter rocdl name.
+def ROCDL_WaveIdOp : LLVM_IntrOpBase<ROCDL_Dialect, "wave_id",
+ "amdgcn_s_get_waveid_in_workgroup", [], [], [], 1>,
----------------
lialan wrote:
@kuhar so it is only conditionally speculatable in that it cannot be hoisted out of parallel loops but speculatable within parallel loops. Something like this might help:
```C++
::mlir::Speculation::Speculatability
WaveIdOp::getSpeculatability() {
Operation* enclosingParallelLoopOp =
getParentOfType<::mlir::scf::ForallOp>();
return enclosingParallelLoopOp ?
::mlir::Speculation::Speculatable : ::mlir::Speculation::NotSpeculatable;
}
```
But question: should this go into ROCDL op definitions? I feel it will be a bit out of place, as the restriction is downstream-specific.
Any thoughts on this?
https://github.com/llvm/llvm-project/pull/136405
More information about the Mlir-commits
mailing list