diff options
author | River Riddle <riverriddle@google.com> | 2019-07-01 10:29:09 -0700 |
---|---|---|
committer | jpienaar <jpienaar@google.com> | 2019-07-01 11:39:00 -0700 |
commit | 54cd6a7e97a226738e2c85b86559918dd9e3cd5d (patch) | |
tree | affa803347d6695be575137d1ad55a055a8021e3 /mlir/examples/Linalg/Linalg3/Execution.cpp | |
parent | 84bd67fc4fd116e80f7a66bfadfe9a7fd6fd5e82 (diff) | |
download | bcm5719-llvm-54cd6a7e97a226738e2c85b86559918dd9e3cd5d.tar.gz bcm5719-llvm-54cd6a7e97a226738e2c85b86559918dd9e3cd5d.zip |
NFC: Refactor Function to be value typed.
Move the data members out of Function and into a new impl storage class 'FunctionStorage'. This allows for Function to become value typed, which will greatly simplify the transition of Function to FuncOp(given that FuncOp is also value typed).
PiperOrigin-RevId: 255983022
Diffstat (limited to 'mlir/examples/Linalg/Linalg3/Execution.cpp')
-rw-r--r-- | mlir/examples/Linalg/Linalg3/Execution.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/mlir/examples/Linalg/Linalg3/Execution.cpp b/mlir/examples/Linalg/Linalg3/Execution.cpp index 00d571cbc99..94b233a56b0 100644 --- a/mlir/examples/Linalg/Linalg3/Execution.cpp +++ b/mlir/examples/Linalg/Linalg3/Execution.cpp @@ -37,26 +37,26 @@ using namespace linalg; using namespace linalg::common; using namespace linalg::intrinsics; -Function *makeFunctionWithAMatmulOp(Module &module, StringRef name) { +Function makeFunctionWithAMatmulOp(Module &module, StringRef name) { MLIRContext *context = module.getContext(); auto dynamic2DMemRefType = floatMemRefType<2>(context); - mlir::Function *f = linalg::common::makeFunction( + mlir::Function f = linalg::common::makeFunction( module, name, {dynamic2DMemRefType, dynamic2DMemRefType, dynamic2DMemRefType}, {}); - mlir::OpBuilder builder(f->getBody()); - ScopedContext scope(builder, f->getLoc()); + mlir::OpBuilder builder(f.getBody()); + ScopedContext scope(builder, f.getLoc()); // clang-format off ValueHandle - M = dim(f->getArgument(0), 0), - N = dim(f->getArgument(2), 1), - K = dim(f->getArgument(0), 1), + M = dim(f.getArgument(0), 0), + N = dim(f.getArgument(2), 1), + K = dim(f.getArgument(0), 1), rM = range(constant_index(0), M, constant_index(1)), rN = range(constant_index(0), N, constant_index(1)), rK = range(constant_index(0), K, constant_index(1)), - vA = view(f->getArgument(0), {rM, rK}), - vB = view(f->getArgument(1), {rK, rN}), - vC = view(f->getArgument(2), {rM, rN}); + vA = view(f.getArgument(0), {rM, rK}), + vB = view(f.getArgument(1), {rK, rN}), + vC = view(f.getArgument(2), {rM, rN}); matmul(vA, vB, vC); ret(); // clang-format on @@ -110,7 +110,7 @@ TEST_FUNC(execution) { // dialect through partial conversions. MLIRContext context; Module module(&context); - mlir::Function *f = makeFunctionWithAMatmulOp(module, "matmul_as_loops"); + mlir::Function f = makeFunctionWithAMatmulOp(module, "matmul_as_loops"); lowerToLoops(f); convertLinalg3ToLLVM(module); |