[Mlir-commits] [mlir] [mlir][gpu] Introduce `gpu.dynamic_shared_memory` Op (PR #71546)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Tue Nov 7 09:09:19 PST 2023
================
@@ -433,6 +433,29 @@ def GPU_GPUFuncOp : GPU_Op<"func", [
let hasVerifier = 1;
}
+def GPU_DynamicSharedMemoryOp : GPU_Op<"dynamic_shared_memory", [] > {
+ let summary = "Get the memref for dynamic shared memory";
+
+ let description = [{
+ This operation provides a memref pointer to the start of dynamic shared
+ memory, often referred to as workgroup memory. It's important to note that
+ this dynamic shared memory needs to be allocated at kernel launch. One can
+ conveniently utilize `the dynamic_shared_memory_size` parameter of
+ `gpu.launch` for this purpose.
+
+ Examples:
+ ```mlir
+ %0 = gpu.dynamic.shared.memory : memref<?xi8, 3>
+ %1 = memref.view %0[%c8192][] : memref<?xi8, 3> to memref<32x64xf32, #gpu.address_space<workgroup>>
+ %2 = memref.view %0[%c16384][] : memref<?xi8, 3> to memref<32x64xf32, #gpu.address_space<workgroup>>
----------------
ftynse wrote:
Nit: the magic change of address space from `3` to `workgroup` will raise questions from the reader of documentation.
https://github.com/llvm/llvm-project/pull/71546
More information about the Mlir-commits
mailing list