[Mlir-commits] [mlir] [mlir][gpu] Introduce `gpu.dynamic_shared_memory` Op (PR #71546)
Guray Ozen
llvmlistbot at llvm.org
Sat Nov 11 03:47:07 PST 2023
================
@@ -554,6 +557,101 @@ static IntegerAttr wrapNumericMemorySpace(MLIRContext *ctx, unsigned space) {
return IntegerAttr::get(IntegerType::get(ctx, 64), space);
}
+/// Generates a symbol with 0-sized array type for dynamic shared memory usage,
+/// or uses existing symbol.
+LLVM::GlobalOp
+getDynamicSharedMemorySymbol(ConversionPatternRewriter &rewriter,
+ gpu::DynamicSharedMemoryOp op,
+ const LLVMTypeConverter *typeConverter,
+ MemRefType memrefType, unsigned alignmentBit) {
+ LLVM::LLVMFuncOp funcOp = op->getParentOfType<LLVM::LLVMFuncOp>();
+ assert(funcOp && "cannot find llvm.func op");
+
+ gpu::GPUModuleOp moduleOp = funcOp->getParentOfType<gpu::GPUModuleOp>();
+ assert(moduleOp && "cannot find gpu.module op");
----------------
grypp wrote:
I understand your point.
I added verifier to [check parent on the Op](https://github.com/llvm/llvm-project/pull/71546/files#diff-b467fda330bf516296cbea52276b9a0cf8bf99731ef17dc9e210c9c8851106adR437-R438). I now support [`ModuleOp` as well as `GPUModuleOp`](https://github.com/llvm/llvm-project/pull/71546/files#diff-e005e4a41aa239d557bb6509143968c83769c591cd4dbf79a0302b949081655cR624-R632).
https://github.com/llvm/llvm-project/pull/71546
More information about the Mlir-commits
mailing list