[Mlir-commits] [mlir] e1364f1 - Replace use of OperationState with builder::create in GPU Kernel Outlining (NFC)

Mehdi Amini llvmlistbot at llvm.org
Thu Mar 11 16:14:13 PST 2021


Author: Mehdi Amini
Date: 2021-03-12T00:14:02Z
New Revision: e1364f10684be374783eb5ec5490a48d5c31ec53

URL: https://github.com/llvm/llvm-project/commit/e1364f10684be374783eb5ec5490a48d5c31ec53
DIFF: https://github.com/llvm/llvm-project/commit/e1364f10684be374783eb5ec5490a48d5c31ec53.diff

LOG: Replace use of OperationState with builder::create in GPU Kernel Outlining (NFC)

OperationState is a low level API that is rarely indicated, the builder
API convenient wrapper is preferred when possible.

Added: 
    

Modified: 
    mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
index ae9b2fe14f185..cee931aefc7bb 100644
--- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
@@ -283,10 +283,8 @@ class GpuKernelOutliningPass
     // and then this needs to use the OpBuilder.
     auto context = getOperation().getContext();
     OpBuilder builder(context);
-    OperationState state(kernelFunc.getLoc(),
-                         gpu::GPUModuleOp::getOperationName());
-    gpu::GPUModuleOp::build(builder, state, kernelFunc.getName());
-    auto kernelModule = cast<gpu::GPUModuleOp>(Operation::create(state));
+    auto kernelModule = builder.create<gpu::GPUModuleOp>(kernelFunc.getLoc(),
+                                                         kernelFunc.getName());
     SymbolTable symbolTable(kernelModule);
     symbolTable.insert(kernelFunc);
 


        


More information about the Mlir-commits mailing list