[Mlir-commits] [mlir] [mlir][AMDGPU] Set uniform-work-group-size=true by default (PR #79077)
Krzysztof Drewniak
llvmlistbot at llvm.org
Wed Feb 14 07:51:28 PST 2024
================
@@ -100,6 +100,12 @@ class ROCDLDialectLLVMIRTranslationInterface
llvmFunc->addFnAttr("amdgpu-flat-work-group-size", "1,256");
}
+ // MLIR's GPU kernel APIs all assume and produce uniformly-sized
+ // workgroups, so the lowering of the `rocdl.kernel` marker encodes this
+ // assumption. This assumption may be overridden by setting
+ // `rocdl.uniform_work_group_size` on a given function.
+ if (!llvmFunc->hasFnAttribute("uniform-work-group-size"))
----------------
krzysz00 wrote:
Yeah, this is a hook `amendOperation`. It gets called when you have a `rocdl` attribute on an operation being translated, once per attribute.
So given
```mlir
llvm.func @foo(...) attributes {llvm.something = N : i64, rocdl.kernel, rocdl.uniform_work_group_size = true}
```
The LLVM dialect is responsible for translating `llvm.func` into LLVM IR, and then you'll end up with three `amendOperation()` calls in some order, one to the LLVM dialect's, two to ROCDL's.
https://github.com/llvm/llvm-project/pull/79077
More information about the Mlir-commits
mailing list