[PATCH] D72336: [mlir] Create a gpu.module operation for the GPU Dialect.

Stephan Herhut via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 07:06:10 PST 2020


herhut accepted this revision.
herhut added a comment.

LGTM from my side if rriddle@ is happy with the latest changes.



================
Comment at: mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp:186
     Builder builder(context);
-    auto kernelModule =
-        ModuleOp::create(builder.getUnknownLoc(), kernelFunc.getName());
-    kernelModule.setAttr(gpu::GPUDialect::getKernelModuleAttrName(),
-                         builder.getUnitAttr());
+    OperationState state(builder.getUnknownLoc(),
+                         gpu::GPUModuleOp::getOperationName());
----------------
Can you use `kernelFunc.getLoc()` here? 


================
Comment at: mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp:188-191
+    gpu::GPUModuleOp::build(&builder, state, kernelFunc.getName());
+    auto kernelModule = cast<gpu::GPUModuleOp>(Operation::create(state));
     SymbolTable symbolTable(kernelModule);
     symbolTable.insert(kernelFunc);
----------------
Maybe SymbolTable should also provide a create<T> abstraction to hide these details of construction an operation. Not for this change, though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72336/new/

https://reviews.llvm.org/D72336





More information about the llvm-commits mailing list