diff --git a/mlir/docs/Tutorials/Toy/Ch-1.md b/mlir/docs/Tutorials/Toy/Ch-1.md --- a/mlir/docs/Tutorials/Toy/Ch-1.md +++ b/mlir/docs/Tutorials/Toy/Ch-1.md @@ -29,7 +29,7 @@ with Interfaces. Here we will show how to plug dialect specific information into generic transformations like shape inference and inlining. - [Chapter #5](Ch-5.md): Partially lowering to lower-level dialects. We'll - convert some our high level language specific semantics towards a generic + convert some of our high level language specific semantics towards a generic affine oriented dialect for optimization. - [Chapter #6](Ch-6.md): Lowering to LLVM and code generation. Here we'll target LLVM IR for code generation, and detail more of the lowering diff --git a/mlir/docs/Tutorials/Toy/Ch-2.md b/mlir/docs/Tutorials/Toy/Ch-2.md --- a/mlir/docs/Tutorials/Toy/Ch-2.md +++ b/mlir/docs/Tutorials/Toy/Ch-2.md @@ -146,8 +146,6 @@ and seeing it round-trip without tripping the verifier: ```mlir -// RUN: toyc %s -emit=mlir - func @main() { %0 = "toy.print"() : () -> tensor<2x3xf64> } diff --git a/mlir/docs/Tutorials/Toy/Ch-3.md b/mlir/docs/Tutorials/Toy/Ch-3.md --- a/mlir/docs/Tutorials/Toy/Ch-3.md +++ b/mlir/docs/Tutorials/Toy/Ch-3.md @@ -98,7 +98,7 @@ return failure(); // Otherwise, we have a redundant transpose. Use the rewriter. - rewriter.replaceOp(op, {transposeInputOp.getOperand()}, {transposeInputOp}); + rewriter.replaceOp(op, {transposeInputOp.getOperand()}); return success(); } }; diff --git a/mlir/docs/Tutorials/Toy/Ch-5.md b/mlir/docs/Tutorials/Toy/Ch-5.md --- a/mlir/docs/Tutorials/Toy/Ch-5.md +++ b/mlir/docs/Tutorials/Toy/Ch-5.md @@ -268,8 +268,8 @@ } // Multiply and store into the output buffer. - affine.for %arg0 = 0 to 2 { - affine.for %arg1 = 0 to 3 { + affine.for %arg0 = 0 to 3 { + affine.for %arg1 = 0 to 2 { %3 = affine.load %1[%arg0, %arg1] : memref<3x2xf64> %4 = affine.load %1[%arg0, %arg1] : memref<3x2xf64> %5 = mulf %3, %4 : f64 diff --git a/mlir/examples/toy/Ch1/parser/AST.cpp b/mlir/examples/toy/Ch1/parser/AST.cpp --- a/mlir/examples/toy/Ch1/parser/AST.cpp +++ b/mlir/examples/toy/Ch1/parser/AST.cpp @@ -201,7 +201,7 @@ /// parameters names. void ASTDumper::dump(PrototypeAST *node) { INDENT(); - llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "'\n"; + llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "\n"; indent(); llvm::errs() << "Params: ["; llvm::interleaveComma(node->getArgs(), llvm::errs(), diff --git a/mlir/examples/toy/Ch2/include/toy/Ops.td b/mlir/examples/toy/Ch2/include/toy/Ops.td --- a/mlir/examples/toy/Ch2/include/toy/Ops.td +++ b/mlir/examples/toy/Ch2/include/toy/Ops.td @@ -125,7 +125,7 @@ // The generic call operation returns a single value of TensorType. let results = (outs F64Tensor); - // The return operation only emits the input in the format if it is present. + // Specialize assembly printing and parsing using a declarative format. let assemblyFormat = [{ $callee `(` $inputs `)` attr-dict `:` functional-type($inputs, results) }]; diff --git a/mlir/examples/toy/Ch2/mlir/Dialect.cpp b/mlir/examples/toy/Ch2/mlir/Dialect.cpp --- a/mlir/examples/toy/Ch2/mlir/Dialect.cpp +++ b/mlir/examples/toy/Ch2/mlir/Dialect.cpp @@ -216,10 +216,9 @@ resultType.isa()) return mlir::success(); - return op.emitError() << "type of return operand (" - << *op.operand_type_begin() + return op.emitError() << "type of return operand (" << inputType << ") doesn't match function result type (" - << results.front() << ")"; + << resultType << ")"; } //===----------------------------------------------------------------------===// diff --git a/mlir/examples/toy/Ch2/parser/AST.cpp b/mlir/examples/toy/Ch2/parser/AST.cpp --- a/mlir/examples/toy/Ch2/parser/AST.cpp +++ b/mlir/examples/toy/Ch2/parser/AST.cpp @@ -201,7 +201,7 @@ /// parameters names. void ASTDumper::dump(PrototypeAST *node) { INDENT(); - llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "'\n"; + llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "\n"; indent(); llvm::errs() << "Params: ["; llvm::interleaveComma(node->getArgs(), llvm::errs(), diff --git a/mlir/examples/toy/Ch3/include/toy/Ops.td b/mlir/examples/toy/Ch3/include/toy/Ops.td --- a/mlir/examples/toy/Ch3/include/toy/Ops.td +++ b/mlir/examples/toy/Ch3/include/toy/Ops.td @@ -124,7 +124,7 @@ // The generic call operation returns a single value of TensorType. let results = (outs F64Tensor); - // The return operation only emits the input in the format if it is present. + // Specialize assembly printing and parsing using a declarative format. let assemblyFormat = [{ $callee `(` $inputs `)` attr-dict `:` functional-type($inputs, results) }]; diff --git a/mlir/examples/toy/Ch3/mlir/Dialect.cpp b/mlir/examples/toy/Ch3/mlir/Dialect.cpp --- a/mlir/examples/toy/Ch3/mlir/Dialect.cpp +++ b/mlir/examples/toy/Ch3/mlir/Dialect.cpp @@ -216,10 +216,9 @@ resultType.isa()) return mlir::success(); - return op.emitError() << "type of return operand (" - << *op.operand_type_begin() + return op.emitError() << "type of return operand (" << inputType << ") doesn't match function result type (" - << results.front() << ")"; + << resultType << ")"; } //===----------------------------------------------------------------------===// diff --git a/mlir/examples/toy/Ch3/parser/AST.cpp b/mlir/examples/toy/Ch3/parser/AST.cpp --- a/mlir/examples/toy/Ch3/parser/AST.cpp +++ b/mlir/examples/toy/Ch3/parser/AST.cpp @@ -201,7 +201,7 @@ /// parameters names. void ASTDumper::dump(PrototypeAST *node) { INDENT(); - llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "'\n"; + llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "\n"; indent(); llvm::errs() << "Params: ["; llvm::interleaveComma(node->getArgs(), llvm::errs(), diff --git a/mlir/examples/toy/Ch4/include/toy/Ops.td b/mlir/examples/toy/Ch4/include/toy/Ops.td --- a/mlir/examples/toy/Ch4/include/toy/Ops.td +++ b/mlir/examples/toy/Ch4/include/toy/Ops.td @@ -149,7 +149,7 @@ // The generic call operation returns a single value of TensorType. let results = (outs F64Tensor); - // The return operation only emits the input in the format if it is present. + // Specialize assembly printing and parsing using a declarative format. let assemblyFormat = [{ $callee `(` $inputs `)` attr-dict `:` functional-type($inputs, results) }]; diff --git a/mlir/examples/toy/Ch4/mlir/Dialect.cpp b/mlir/examples/toy/Ch4/mlir/Dialect.cpp --- a/mlir/examples/toy/Ch4/mlir/Dialect.cpp +++ b/mlir/examples/toy/Ch4/mlir/Dialect.cpp @@ -291,10 +291,9 @@ resultType.isa()) return mlir::success(); - return op.emitError() << "type of return operand (" - << *op.operand_type_begin() + return op.emitError() << "type of return operand (" << inputType << ") doesn't match function result type (" - << results.front() << ")"; + << resultType << ")"; } //===----------------------------------------------------------------------===// diff --git a/mlir/examples/toy/Ch4/parser/AST.cpp b/mlir/examples/toy/Ch4/parser/AST.cpp --- a/mlir/examples/toy/Ch4/parser/AST.cpp +++ b/mlir/examples/toy/Ch4/parser/AST.cpp @@ -201,7 +201,7 @@ /// parameters names. void ASTDumper::dump(PrototypeAST *node) { INDENT(); - llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "'\n"; + llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "\n"; indent(); llvm::errs() << "Params: ["; llvm::interleaveComma(node->getArgs(), llvm::errs(), diff --git a/mlir/examples/toy/Ch5/include/toy/Ops.td b/mlir/examples/toy/Ch5/include/toy/Ops.td --- a/mlir/examples/toy/Ch5/include/toy/Ops.td +++ b/mlir/examples/toy/Ch5/include/toy/Ops.td @@ -149,7 +149,7 @@ // The generic call operation returns a single value of TensorType. let results = (outs F64Tensor); - // The return operation only emits the input in the format if it is present. + // Specialize assembly printing and parsing using a declarative format. let assemblyFormat = [{ $callee `(` $inputs `)` attr-dict `:` functional-type($inputs, results) }]; diff --git a/mlir/examples/toy/Ch5/mlir/Dialect.cpp b/mlir/examples/toy/Ch5/mlir/Dialect.cpp --- a/mlir/examples/toy/Ch5/mlir/Dialect.cpp +++ b/mlir/examples/toy/Ch5/mlir/Dialect.cpp @@ -291,10 +291,9 @@ resultType.isa()) return mlir::success(); - return op.emitError() << "type of return operand (" - << *op.operand_type_begin() + return op.emitError() << "type of return operand (" << inputType << ") doesn't match function result type (" - << results.front() << ")"; + << resultType << ")"; } //===----------------------------------------------------------------------===// diff --git a/mlir/examples/toy/Ch5/parser/AST.cpp b/mlir/examples/toy/Ch5/parser/AST.cpp --- a/mlir/examples/toy/Ch5/parser/AST.cpp +++ b/mlir/examples/toy/Ch5/parser/AST.cpp @@ -201,7 +201,7 @@ /// parameters names. void ASTDumper::dump(PrototypeAST *node) { INDENT(); - llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "'\n"; + llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "\n"; indent(); llvm::errs() << "Params: ["; llvm::interleaveComma(node->getArgs(), llvm::errs(), diff --git a/mlir/examples/toy/Ch6/include/toy/Ops.td b/mlir/examples/toy/Ch6/include/toy/Ops.td --- a/mlir/examples/toy/Ch6/include/toy/Ops.td +++ b/mlir/examples/toy/Ch6/include/toy/Ops.td @@ -149,7 +149,7 @@ // The generic call operation returns a single value of TensorType. let results = (outs F64Tensor); - // The return operation only emits the input in the format if it is present. + // Specialize assembly printing and parsing using a declarative format. let assemblyFormat = [{ $callee `(` $inputs `)` attr-dict `:` functional-type($inputs, results) }]; diff --git a/mlir/examples/toy/Ch6/mlir/Dialect.cpp b/mlir/examples/toy/Ch6/mlir/Dialect.cpp --- a/mlir/examples/toy/Ch6/mlir/Dialect.cpp +++ b/mlir/examples/toy/Ch6/mlir/Dialect.cpp @@ -291,10 +291,9 @@ resultType.isa()) return mlir::success(); - return op.emitError() << "type of return operand (" - << *op.operand_type_begin() + return op.emitError() << "type of return operand (" << inputType << ") doesn't match function result type (" - << results.front() << ")"; + << resultType << ")"; } //===----------------------------------------------------------------------===// diff --git a/mlir/examples/toy/Ch6/parser/AST.cpp b/mlir/examples/toy/Ch6/parser/AST.cpp --- a/mlir/examples/toy/Ch6/parser/AST.cpp +++ b/mlir/examples/toy/Ch6/parser/AST.cpp @@ -201,7 +201,7 @@ /// parameters names. void ASTDumper::dump(PrototypeAST *node) { INDENT(); - llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "'\n"; + llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "\n"; indent(); llvm::errs() << "Params: ["; llvm::interleaveComma(node->getArgs(), llvm::errs(), diff --git a/mlir/examples/toy/Ch7/include/toy/Ops.td b/mlir/examples/toy/Ch7/include/toy/Ops.td --- a/mlir/examples/toy/Ch7/include/toy/Ops.td +++ b/mlir/examples/toy/Ch7/include/toy/Ops.td @@ -163,7 +163,7 @@ // StructType. let results = (outs Toy_Type); - // The return operation only emits the input in the format if it is present. + // Specialize assembly printing and parsing using a declarative format. let assemblyFormat = [{ $callee `(` $inputs `)` attr-dict `:` functional-type($inputs, results) }]; diff --git a/mlir/examples/toy/Ch7/mlir/Dialect.cpp b/mlir/examples/toy/Ch7/mlir/Dialect.cpp --- a/mlir/examples/toy/Ch7/mlir/Dialect.cpp +++ b/mlir/examples/toy/Ch7/mlir/Dialect.cpp @@ -343,10 +343,9 @@ resultType.isa()) return mlir::success(); - return op.emitError() << "type of return operand (" - << *op.operand_type_begin() + return op.emitError() << "type of return operand (" << inputType << ") doesn't match function result type (" - << results.front() << ")"; + << resultType << ")"; } //===----------------------------------------------------------------------===// diff --git a/mlir/examples/toy/Ch7/parser/AST.cpp b/mlir/examples/toy/Ch7/parser/AST.cpp --- a/mlir/examples/toy/Ch7/parser/AST.cpp +++ b/mlir/examples/toy/Ch7/parser/AST.cpp @@ -217,7 +217,7 @@ /// parameters names. void ASTDumper::dump(PrototypeAST *node) { INDENT(); - llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "'\n"; + llvm::errs() << "Proto '" << node->getName() << "' " << loc(node) << "\n"; indent(); llvm::errs() << "Params: ["; llvm::interleaveComma(node->getArgs(), llvm::errs(), diff --git a/mlir/include/mlir/ExecutionEngine/OptUtils.h b/mlir/include/mlir/ExecutionEngine/OptUtils.h --- a/mlir/include/mlir/ExecutionEngine/OptUtils.h +++ b/mlir/include/mlir/ExecutionEngine/OptUtils.h @@ -27,7 +27,7 @@ namespace mlir { -/// Initialize LLVM passes that can be when running MLIR code using +/// Initialize LLVM passes that can be used when running MLIR code using /// ExecutionEngine. void initializeLLVMPasses(); diff --git a/mlir/test/Examples/Toy/Ch1/ast.toy b/mlir/test/Examples/Toy/Ch1/ast.toy --- a/mlir/test/Examples/Toy/Ch1/ast.toy +++ b/mlir/test/Examples/Toy/Ch1/ast.toy @@ -31,7 +31,7 @@ # CHECK: Module: # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1' +# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1 # CHECK-NEXT: Params: [a, b] # CHECK-NEXT: Block { # CHECK-NEXT: Return @@ -44,7 +44,7 @@ # CHECK-NEXT: ] # CHECK-NEXT: } // Block # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1' +# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1 # CHECK-NEXT: Params: [] # CHECK-NEXT: Block { # CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3 diff --git a/mlir/test/Examples/Toy/Ch2/ast.toy b/mlir/test/Examples/Toy/Ch2/ast.toy --- a/mlir/test/Examples/Toy/Ch2/ast.toy +++ b/mlir/test/Examples/Toy/Ch2/ast.toy @@ -31,7 +31,7 @@ # CHECK: Module: # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1' +# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1 # CHECK-NEXT: Params: [a, b] # CHECK-NEXT: Block { # CHECK-NEXT: Return @@ -44,7 +44,7 @@ # CHECK-NEXT: ] # CHECK-NEXT: } // Block # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1' +# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1 # CHECK-NEXT: Params: [] # CHECK-NEXT: Block { # CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3 diff --git a/mlir/test/Examples/Toy/Ch3/ast.toy b/mlir/test/Examples/Toy/Ch3/ast.toy --- a/mlir/test/Examples/Toy/Ch3/ast.toy +++ b/mlir/test/Examples/Toy/Ch3/ast.toy @@ -31,7 +31,7 @@ # CHECK: Module: # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1' +# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1 # CHECK-NEXT: Params: [a, b] # CHECK-NEXT: Block { # CHECK-NEXT: Return @@ -44,7 +44,7 @@ # CHECK-NEXT: ] # CHECK-NEXT: } // Block # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1' +# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1 # CHECK-NEXT: Params: [] # CHECK-NEXT: Block { # CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3 diff --git a/mlir/test/Examples/Toy/Ch4/ast.toy b/mlir/test/Examples/Toy/Ch4/ast.toy --- a/mlir/test/Examples/Toy/Ch4/ast.toy +++ b/mlir/test/Examples/Toy/Ch4/ast.toy @@ -31,7 +31,7 @@ # CHECK: Module: # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1' +# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1 # CHECK-NEXT: Params: [a, b] # CHECK-NEXT: Block { # CHECK-NEXT: Return @@ -44,7 +44,7 @@ # CHECK-NEXT: ] # CHECK-NEXT: } // Block # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1' +# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1 # CHECK-NEXT: Params: [] # CHECK-NEXT: Block { # CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3 diff --git a/mlir/test/Examples/Toy/Ch5/ast.toy b/mlir/test/Examples/Toy/Ch5/ast.toy --- a/mlir/test/Examples/Toy/Ch5/ast.toy +++ b/mlir/test/Examples/Toy/Ch5/ast.toy @@ -31,7 +31,7 @@ # CHECK: Module: # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1' +# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1 # CHECK-NEXT: Params: [a, b] # CHECK-NEXT: Block { # CHECK-NEXT: Return @@ -44,7 +44,7 @@ # CHECK-NEXT: ] # CHECK-NEXT: } // Block # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1' +# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1 # CHECK-NEXT: Params: [] # CHECK-NEXT: Block { # CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3 diff --git a/mlir/test/Examples/Toy/Ch6/ast.toy b/mlir/test/Examples/Toy/Ch6/ast.toy --- a/mlir/test/Examples/Toy/Ch6/ast.toy +++ b/mlir/test/Examples/Toy/Ch6/ast.toy @@ -31,7 +31,7 @@ # CHECK: Module: # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1' +# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1 # CHECK-NEXT: Params: [a, b] # CHECK-NEXT: Block { # CHECK-NEXT: Return @@ -44,7 +44,7 @@ # CHECK-NEXT: ] # CHECK-NEXT: } // Block # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1' +# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1 # CHECK-NEXT: Params: [] # CHECK-NEXT: Block { # CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3 diff --git a/mlir/test/Examples/Toy/Ch7/ast.toy b/mlir/test/Examples/Toy/Ch7/ast.toy --- a/mlir/test/Examples/Toy/Ch7/ast.toy +++ b/mlir/test/Examples/Toy/Ch7/ast.toy @@ -31,7 +31,7 @@ # CHECK: Module: # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1' +# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}ast.toy:4:1 # CHECK-NEXT: Params: [a, b] # CHECK-NEXT: Block { # CHECK-NEXT: Return @@ -44,7 +44,7 @@ # CHECK-NEXT: ] # CHECK-NEXT: } // Block # CHECK-NEXT: Function -# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1' +# CHECK-NEXT: Proto 'main' @{{.*}}ast.toy:8:1 # CHECK-NEXT: Params: [] # CHECK-NEXT: Block { # CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3 diff --git a/mlir/test/Examples/Toy/Ch7/struct-ast.toy b/mlir/test/Examples/Toy/Ch7/struct-ast.toy --- a/mlir/test/Examples/Toy/Ch7/struct-ast.toy +++ b/mlir/test/Examples/Toy/Ch7/struct-ast.toy @@ -27,7 +27,7 @@ # CHECK-NEXT: VarDecl b<> @{{.*}}struct-ast.toy:5:3 # CHECK-NEXT: ] # CHECK-NEXT:Function -# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}struct-ast.toy:9:1' +# CHECK-NEXT: Proto 'multiply_transpose' @{{.*}}struct-ast.toy:9:1 # CHECK-NEXT: Params: [value] # CHECK-NEXT: Block { # CHECK-NEXT: Return @@ -44,7 +44,7 @@ # CHECK-NEXT: ] # CHECK-NEXT: } # CHECK-NEXT:Function -# CHECK-NEXT: Proto 'main' @{{.*}}struct-ast.toy:14:1' +# CHECK-NEXT: Proto 'main' @{{.*}}struct-ast.toy:14:1 # CHECK-NEXT: Params: [] # CHECK-NEXT: Block { # CHECK-NEXT: VarDecl value @{{.*}}struct-ast.toy:16:3