[llvm-branch-commits] [mlir] 9cad0d0 - [MLIR] Update tutorial to add missing tests and bring directory paths and code snippets up to date.
Author: Lucy Fox Date: 2020-04-17T17:53:48-07:00 New Revision: 9cad0d090d33bd1012439818b87c63ec25d84f60 URL: https://github.com/llvm/llvm-project/commit/9cad0d090d33bd1012439818b87c63ec25d84f60 DIFF: https://github.com/llvm/llvm-project/commit/9cad0d090d33bd1012439818b87c63ec25d84f60.diff LOG: [MLIR] Update tutorial to add missing tests and bring directory paths and code snippets up to date. Summary: The tests referred to in Chapter 3 of the tutorial were missing from the tutorial test directory; this adds those missing tests. This also cleans up some stale directory paths and code snippets used throughout the tutorial. Differential Revision: https://reviews.llvm.org/D76809 Added: Modified: mlir/test/Examples/Toy/Ch3/transpose_transpose.toy mlir/test/Examples/Toy/Ch3/trivial_reshape.toy mlir/test/Examples/Toy/Ch4/transpose_transpose.toy mlir/test/Examples/Toy/Ch4/trivial_reshape.toy mlir/test/Examples/Toy/Ch5/transpose_transpose.toy mlir/test/Examples/Toy/Ch5/trivial_reshape.toy mlir/test/Examples/Toy/Ch6/transpose_transpose.toy mlir/test/Examples/Toy/Ch6/trivial_reshape.toy mlir/test/Examples/Toy/Ch7/transpose_transpose.toy mlir/test/Examples/Toy/Ch7/trivial_reshape.toy Removed: diff --git a/mlir/test/Examples/Toy/Ch3/transpose_transpose.toy b/mlir/test/Examples/Toy/Ch3/transpose_transpose.toy index 9945e7cf8397..c686f6ab1c31 100644 --- a/mlir/test/Examples/Toy/Ch3/transpose_transpose.toy +++ b/mlir/test/Examples/Toy/Ch3/transpose_transpose.toy @@ -1,4 +1,4 @@ -# RUN: toyc-ch3 %s -emit=mlir 2>&1 | FileCheck %s +# RUN: toyc-ch3 %s -emit=mlir -opt 2>&1 | FileCheck %s # User defined generic function that operates on unknown shaped arguments def transpose_transpose(x) { @@ -13,13 +13,10 @@ def main() { # CHECK-LABEL: func @transpose_transpose( # CHECK-SAME: [[VAL_0:%.*]]: tensor<*xf64>) -> tensor<*xf64> -# CHECK: [[VAL_1:%.*]] = toy.transpose([[VAL_0]] : tensor<*xf64>) to tensor<*xf64> -# CHECK-NEXT:[[VAL_2:%.*]] = toy.transpose([[VAL_1]] : tensor<*xf64>) to tensor<*xf64> -# CHECK-NEXT:toy.return [[VAL_2]] : tensor<*xf64> +# CHECK-NEXT:toy.return [[VAL_0]] : tensor<*xf64> # CHECK-LABEL: func @main() -# CHECK-NEXT:[[VAL_3:%.*]] = toy.constant dense<{{\[\[}}1.00e+00, 2.00e+00, 3.00e+00], [4.00e+00, 5.00e+00, 6.00e+00]]> : tensor<2x3xf64> -# CHECK-NEXT:[[VAL_4:%.*]] = toy.reshape([[VAL_3]] : tensor<2x3xf64>) to tensor<2x3xf64> -# CHECK-NEXT:[[VAL_5:%.*]] = toy.generic_call @transpose_transpose([[VAL_4]]) : (tensor<2x3xf64>) -> tensor<*xf64> -# CHECK-NEXT:toy.print [[VAL_5]] : tensor<*xf64> +# CHECK-NEXT:[[VAL_1:%.*]] = toy.constant dense<{{\[\[}}1.00e+00, 2.00e+00, 3.00e+00], [4.00e+00, 5.00e+00, 6.00e+00]]> : tensor<2x3xf64> +# CHECK-NEXT:[[VAL_2:%.*]] = toy.generic_call @transpose_transpose([[VAL_1]]) : (tensor<2x3xf64>) -> tensor<*xf64> +# CHECK-NEXT:toy.print [[VAL_2]] : tensor<*xf64> # CHECK-NEXT:toy.return \ No newline at end of file diff --git a/mlir/test/Examples/Toy/Ch3/trivial_reshape.toy b/mlir/test/Examples/Toy/Ch3/trivial_reshape.toy index aa2c38714cf8..0f0b1af1f50e 100644 --- a/mlir/test/Examples/Toy/Ch3/trivial_reshape.toy +++ b/mlir/test/Examples/Toy/Ch3/trivial_reshape.toy @@ -1,4 +1,4 @@ -# RUN: toyc-ch3 %s -emit=mlir 2>&1 | FileCheck %s +# RUN: toyc-ch3 %s -emit=mlir -opt 2>&1 | FileCheck %s def main() { var a<2,1> = [1, 2]; @@ -8,9 +8,9 @@ def main() { } # CHECK-LABEL: func @main() -# CHECK-NEXT:[[VAL_0:%.*]] = toy.constant dense<[1.00e+00, 2.00e+00]> : tensor<2xf64> -# CHECK-NEXT:[[VAL_1:%.*]] = toy.reshape([[VAL_0]] : tensor<2xf64>) to tensor<2x1xf64> -# CHECK-NEXT:[[VAL_2:%.*]] = toy.reshape([[VAL_1]] : tensor<2x1xf64>) to tensor<2x1xf64> -# CHECK-NEXT:[[VAL_3:%.*]] = toy.reshape([[VAL_2]] : tensor<2x1xf64>) to tensor<2x1xf64> -# CHECK-NEXT:toy.print [[VAL_3]] : tensor<2x1xf64> +# CHECK-NEXT:[[VAL_0:%.*]] = toy.constant +# CHECK-SAME: dense<[ +# CHECK-SAME: [1.00e+00], [2.00e+00] +# CHECK-SAME: ]> : tensor<2x1xf64> +# CHECK-NEXT:toy.print [[VAL_0]] : tensor<2x1xf64> # CHECK-NEXT:toy.return \ No newline at end of file diff --git a/mlir/test/Examples/Toy/Ch4/transpose_transpose.toy b/mlir/test/Examples/Toy/Ch4/transpose_transpose.toy index 77bacec0ae80..2177c35fa93d 100644 --- a/mlir/test/Examples/Toy/Ch4/transpose_transpose.toy +++ b/mlir/test/Examples/Toy/Ch4/transpose_transpose.toy @@ -1,4 +1,4 @@ -# RUN: toyc-ch4 %s -emit=mlir 2>&1 | FileCheck %s +# RUN: toyc-ch4 %s -emit=mlir -opt 2>&1 | FileCheck %s # User defined generic function that operates on unknown shaped arguments def transpose_transpose(x) { @@ -11,15 +11,7 @@ def main() { print(b); } -# CHECK-LABEL: func @transpose_transpose( -#
[llvm-branch-commits] [mlir] 01d7814 - [MLIR] Update tutorial to add missing tests and bring directory paths and code snippets up to date.
Author: Lucy Fox Date: 2020-04-17T17:53:48-07:00 New Revision: 01d781489e71bee1ac37c6b89089df7e72fd0423 URL: https://github.com/llvm/llvm-project/commit/01d781489e71bee1ac37c6b89089df7e72fd0423 DIFF: https://github.com/llvm/llvm-project/commit/01d781489e71bee1ac37c6b89089df7e72fd0423.diff LOG: [MLIR] Update tutorial to add missing tests and bring directory paths and code snippets up to date. Summary: The tests referred to in Chapter 3 of the tutorial were missing from the tutorial test directory; this adds those missing tests. This also cleans up some stale directory paths and code snippets used throughout the tutorial. Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, aartbik, liufengdb, Joonsoo, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D76809 Added: mlir/test/Examples/Toy/Ch3/transpose_transpose.toy mlir/test/Examples/Toy/Ch3/trivial_reshape.toy mlir/test/Examples/Toy/Ch4/transpose_transpose.toy mlir/test/Examples/Toy/Ch4/trivial_reshape.toy mlir/test/Examples/Toy/Ch5/transpose_transpose.toy mlir/test/Examples/Toy/Ch5/trivial_reshape.toy mlir/test/Examples/Toy/Ch6/transpose_transpose.toy mlir/test/Examples/Toy/Ch6/trivial_reshape.toy mlir/test/Examples/Toy/Ch7/transpose_transpose.toy mlir/test/Examples/Toy/Ch7/trivial_reshape.toy Modified: mlir/docs/Tutorials/Toy/Ch-1.md mlir/docs/Tutorials/Toy/Ch-2.md mlir/docs/Tutorials/Toy/Ch-3.md mlir/docs/Tutorials/Toy/Ch-5.md mlir/docs/Tutorials/Toy/Ch-6.md Removed: diff --git a/mlir/docs/Tutorials/Toy/Ch-1.md b/mlir/docs/Tutorials/Toy/Ch-1.md index 347eb3b03b04..7c2f49918049 100644 --- a/mlir/docs/Tutorials/Toy/Ch-1.md +++ b/mlir/docs/Tutorials/Toy/Ch-1.md @@ -109,48 +109,48 @@ The AST from the above code is fairly straightforward; here is a dump of it: ``` Module: - Function -Proto 'multiply_transpose' @test/ast.toy:5:1' -Args: [a, b] + Function +Proto 'multiply_transpose' @test/Examples/Toy/Ch1/ast.toy:4:1' +Params: [a, b] Block { Return -BinOp: * @test/ast.toy:6:25 - Call 'transpose' [ @test/ast.toy:6:10 -var: a @test/ast.toy:6:20 +BinOp: * @test/Examples/Toy/Ch1/ast.toy:5:25 + Call 'transpose' [ @test/Examples/Toy/Ch1/ast.toy:5:10 +var: a @test/Examples/Toy/Ch1/ast.toy:5:20 ] - Call 'transpose' [ @test/ast.toy:6:25 -var: b @test/ast.toy:6:35 + Call 'transpose' [ @test/Examples/Toy/Ch1/ast.toy:5:25 +var: b @test/Examples/Toy/Ch1/ast.toy:5:35 ] } // Block - Function -Proto 'main' @test/ast.toy:9:1' -Args: [] + Function +Proto 'main' @test/Examples/Toy/Ch1/ast.toy:8:1' +Params: [] Block { - VarDecl a<> @test/ast.toy:11:3 -Literal: <2, 3>[<3>[1.00e+00, 2.00e+00, 3.00e+00], <3>[4.00e+00, 5.00e+00, 6.00e+00]] @test/ast.toy:11:17 - VarDecl b<2, 3> @test/ast.toy:12:3 -Literal: <6>[1.00e+00, 2.00e+00, 3.00e+00, 4.00e+00, 5.00e+00, 6.00e+00] @test/ast.toy:12:17 - VarDecl c<> @test/ast.toy:15:3 -Call 'multiply_transpose' [ @test/ast.toy:15:11 - var: a @test/ast.toy:15:30 - var: b @test/ast.toy:15:33 + VarDecl a<> @test/Examples/Toy/Ch1/ast.toy:11:3 +Literal: <2, 3>[ <3>[ 1.00e+00, 2.00e+00, 3.00e+00], <3>[ 4.00e+00, 5.00e+00, 6.00e+00]] @test/Examples/Toy/Ch1/ast.toy:11:11 + VarDecl b<2, 3> @test/Examples/Toy/Ch1/ast.toy:15:3 +Literal: <6>[ 1.00e+00, 2.00e+00, 3.00e+00, 4.00e+00, 5.00e+00, 6.00e+00] @test/Examples/Toy/Ch1/ast.toy:15:17 + VarDecl c<> @test/Examples/Toy/Ch1/ast.toy:19:3 +Call 'multiply_transpose' [ @test/Examples/Toy/Ch1/ast.toy:19:11 + var: a @test/Examples/Toy/Ch1/ast.toy:19:30 + var: b @test/Examples/Toy/Ch1/ast.toy:19:33 ] - VarDecl d<> @test/ast.toy:18:3 -Call 'multiply_transpose' [ @test/ast.toy:18:11 - var: b @test/ast.toy:18:30 - var: a @test/ast.toy:18:33 + VarDecl d<> @test/Examples/Toy/Ch1/ast.toy:22:3 +Call 'multiply_transpose' [ @test/Examples/Toy/Ch1/ast.toy:22:11 + var: b @test/Examples/Toy/Ch1/ast.toy:22:30 + var: a @test/Examples/Toy/Ch1/ast.toy:22:33 ] - VarDecl e<> @test/ast.toy:21:3 -Call 'multiply_transpose' [ @test/ast.toy:21:11 - var: b @test/ast.toy:21:30 - var: c @test/ast.toy:21:33 + VarDecl e<> @test/Examples/Toy/Ch1/ast.toy:25:3 +Call 'multiply_transpose' [ @test/Examples/Toy/Ch1/ast.toy:25:11 + var: b @test/Examples/Toy/Ch1/ast.toy:25:30 + var: c @test/Examples/Toy/Ch1/ast.toy:25:33 ] - VarDecl f<> @test/ast.toy:24:3
[llvm-branch-commits] [mlir] 46294ff - [MLIR] Update tutorial to add missing tests and bring directory paths and code snippets up to date.
Author: Lucy Fox Date: 2020-04-17T17:58:16-07:00 New Revision: 46294ffd1c083151f04a94668aa4bbf1fd415e9d URL: https://github.com/llvm/llvm-project/commit/46294ffd1c083151f04a94668aa4bbf1fd415e9d DIFF: https://github.com/llvm/llvm-project/commit/46294ffd1c083151f04a94668aa4bbf1fd415e9d.diff LOG: [MLIR] Update tutorial to add missing tests and bring directory paths and code snippets up to date. Summary: The tests referred to in Chapter 3 of the tutorial were missing from the tutorial test directory; this adds those missing tests. This also cleans up some stale directory paths and code snippets used throughout the tutorial. Differential Revision: https://reviews.llvm.org/D76809 Added: Modified: mlir/test/Examples/Toy/Ch5/trivial_reshape.toy mlir/test/Examples/Toy/Ch6/trivial_reshape.toy mlir/test/Examples/Toy/Ch7/trivial_reshape.toy Removed: diff --git a/mlir/test/Examples/Toy/Ch5/trivial_reshape.toy b/mlir/test/Examples/Toy/Ch5/trivial_reshape.toy index 453efa3ef312..1addb06022e0 100644 --- a/mlir/test/Examples/Toy/Ch5/trivial_reshape.toy +++ b/mlir/test/Examples/Toy/Ch5/trivial_reshape.toy @@ -1,4 +1,4 @@ -# RUN: toyc-ch4 %s -emit=mlir -opt 2>&1 | FileCheck %s +# RUN: toyc-ch5 %s -emit=mlir -opt 2>&1 | FileCheck %s def main() { var a<2,1> = [1, 2]; @@ -13,4 +13,4 @@ def main() { # CHECK-SAME: [1.00e+00], [2.00e+00] # CHECK-SAME: ]> : tensor<2x1xf64> # CHECK-NEXT:toy.print [[VAL_0]] : tensor<2x1xf64> -# CHECK-NEXT:toy.return \ No newline at end of file +# CHECK-NEXT:toy.return diff --git a/mlir/test/Examples/Toy/Ch6/trivial_reshape.toy b/mlir/test/Examples/Toy/Ch6/trivial_reshape.toy index 453efa3ef312..17832ace3782 100644 --- a/mlir/test/Examples/Toy/Ch6/trivial_reshape.toy +++ b/mlir/test/Examples/Toy/Ch6/trivial_reshape.toy @@ -1,4 +1,4 @@ -# RUN: toyc-ch4 %s -emit=mlir -opt 2>&1 | FileCheck %s +# RUN: toyc-ch6 %s -emit=mlir -opt 2>&1 | FileCheck %s def main() { var a<2,1> = [1, 2]; @@ -13,4 +13,4 @@ def main() { # CHECK-SAME: [1.00e+00], [2.00e+00] # CHECK-SAME: ]> : tensor<2x1xf64> # CHECK-NEXT:toy.print [[VAL_0]] : tensor<2x1xf64> -# CHECK-NEXT:toy.return \ No newline at end of file +# CHECK-NEXT:toy.return diff --git a/mlir/test/Examples/Toy/Ch7/trivial_reshape.toy b/mlir/test/Examples/Toy/Ch7/trivial_reshape.toy index 453efa3ef312..5ca8c4b6e41a 100644 --- a/mlir/test/Examples/Toy/Ch7/trivial_reshape.toy +++ b/mlir/test/Examples/Toy/Ch7/trivial_reshape.toy @@ -1,4 +1,4 @@ -# RUN: toyc-ch4 %s -emit=mlir -opt 2>&1 | FileCheck %s +# RUN: toyc-ch7 %s -emit=mlir -opt 2>&1 | FileCheck %s def main() { var a<2,1> = [1, 2]; @@ -13,4 +13,4 @@ def main() { # CHECK-SAME: [1.00e+00], [2.00e+00] # CHECK-SAME: ]> : tensor<2x1xf64> # CHECK-NEXT:toy.print [[VAL_0]] : tensor<2x1xf64> -# CHECK-NEXT:toy.return \ No newline at end of file +# CHECK-NEXT:toy.return ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits