[mlir][toy] Add missing spacing to tensor literal closing bracket#195502
[mlir][toy] Add missing spacing to tensor literal closing bracket#195502rdong8 wants to merge 2 commits into
Conversation
|
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
|
@llvm/pr-subscribers-mlir Author: rdong8 ChangesThis is my first commit to LLVM. There's a missing space before the right closing bracket of tensor literals for the Toy language. This PR fixes the AST dumper to include it. Tagging last 3 contributors to toy for review: @kuhar @joker-eph @Hardcode84 Full diff: https://github.com/llvm/llvm-project/pull/195502.diff 16 Files Affected:
diff --git a/mlir/docs/Tutorials/Toy/Ch-1.md b/mlir/docs/Tutorials/Toy/Ch-1.md
index 09cee88db419d..777ea637a932d 100644
--- a/mlir/docs/Tutorials/Toy/Ch-1.md
+++ b/mlir/docs/Tutorials/Toy/Ch-1.md
@@ -91,9 +91,9 @@ Module:
Params: []
Block {
VarDecl a<> @test/Examples/Toy/Ch1/ast.toy:11:3
- Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @test/Examples/Toy/Ch1/ast.toy:11:11
+ Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00 ], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00 ] ] @test/Examples/Toy/Ch1/ast.toy:11:11
VarDecl b<2, 3> @test/Examples/Toy/Ch1/ast.toy:15:3
- Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @test/Examples/Toy/Ch1/ast.toy:15:17
+ Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+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
diff --git a/mlir/examples/toy/Ch1/parser/AST.cpp b/mlir/examples/toy/Ch1/parser/AST.cpp
index 841642488db68..fd9a51aa8b4d2 100644
--- a/mlir/examples/toy/Ch1/parser/AST.cpp
+++ b/mlir/examples/toy/Ch1/parser/AST.cpp
@@ -137,7 +137,7 @@ static void printLitHelper(ExprAST *litOrNum) {
llvm::errs() << "[ ";
llvm::interleaveComma(literal->getValues(), llvm::errs(),
[&](auto &elt) { printLitHelper(elt.get()); });
- llvm::errs() << "]";
+ llvm::errs() << " ]";
}
/// Print a literal, see the recursive helper above for the implementation.
diff --git a/mlir/examples/toy/Ch2/parser/AST.cpp b/mlir/examples/toy/Ch2/parser/AST.cpp
index 841642488db68..fd9a51aa8b4d2 100644
--- a/mlir/examples/toy/Ch2/parser/AST.cpp
+++ b/mlir/examples/toy/Ch2/parser/AST.cpp
@@ -137,7 +137,7 @@ static void printLitHelper(ExprAST *litOrNum) {
llvm::errs() << "[ ";
llvm::interleaveComma(literal->getValues(), llvm::errs(),
[&](auto &elt) { printLitHelper(elt.get()); });
- llvm::errs() << "]";
+ llvm::errs() << " ]";
}
/// Print a literal, see the recursive helper above for the implementation.
diff --git a/mlir/examples/toy/Ch3/parser/AST.cpp b/mlir/examples/toy/Ch3/parser/AST.cpp
index 841642488db68..fd9a51aa8b4d2 100644
--- a/mlir/examples/toy/Ch3/parser/AST.cpp
+++ b/mlir/examples/toy/Ch3/parser/AST.cpp
@@ -137,7 +137,7 @@ static void printLitHelper(ExprAST *litOrNum) {
llvm::errs() << "[ ";
llvm::interleaveComma(literal->getValues(), llvm::errs(),
[&](auto &elt) { printLitHelper(elt.get()); });
- llvm::errs() << "]";
+ llvm::errs() << " ]";
}
/// Print a literal, see the recursive helper above for the implementation.
diff --git a/mlir/examples/toy/Ch4/parser/AST.cpp b/mlir/examples/toy/Ch4/parser/AST.cpp
index 841642488db68..fd9a51aa8b4d2 100644
--- a/mlir/examples/toy/Ch4/parser/AST.cpp
+++ b/mlir/examples/toy/Ch4/parser/AST.cpp
@@ -137,7 +137,7 @@ static void printLitHelper(ExprAST *litOrNum) {
llvm::errs() << "[ ";
llvm::interleaveComma(literal->getValues(), llvm::errs(),
[&](auto &elt) { printLitHelper(elt.get()); });
- llvm::errs() << "]";
+ llvm::errs() << " ]";
}
/// Print a literal, see the recursive helper above for the implementation.
diff --git a/mlir/examples/toy/Ch5/parser/AST.cpp b/mlir/examples/toy/Ch5/parser/AST.cpp
index 841642488db68..fd9a51aa8b4d2 100644
--- a/mlir/examples/toy/Ch5/parser/AST.cpp
+++ b/mlir/examples/toy/Ch5/parser/AST.cpp
@@ -137,7 +137,7 @@ static void printLitHelper(ExprAST *litOrNum) {
llvm::errs() << "[ ";
llvm::interleaveComma(literal->getValues(), llvm::errs(),
[&](auto &elt) { printLitHelper(elt.get()); });
- llvm::errs() << "]";
+ llvm::errs() << " ]";
}
/// Print a literal, see the recursive helper above for the implementation.
diff --git a/mlir/examples/toy/Ch6/parser/AST.cpp b/mlir/examples/toy/Ch6/parser/AST.cpp
index 841642488db68..fd9a51aa8b4d2 100644
--- a/mlir/examples/toy/Ch6/parser/AST.cpp
+++ b/mlir/examples/toy/Ch6/parser/AST.cpp
@@ -137,7 +137,7 @@ static void printLitHelper(ExprAST *litOrNum) {
llvm::errs() << "[ ";
llvm::interleaveComma(literal->getValues(), llvm::errs(),
[&](auto &elt) { printLitHelper(elt.get()); });
- llvm::errs() << "]";
+ llvm::errs() << " ]";
}
/// Print a literal, see the recursive helper above for the implementation.
diff --git a/mlir/examples/toy/Ch7/parser/AST.cpp b/mlir/examples/toy/Ch7/parser/AST.cpp
index aa2c7846329c3..809f0552d7f2c 100644
--- a/mlir/examples/toy/Ch7/parser/AST.cpp
+++ b/mlir/examples/toy/Ch7/parser/AST.cpp
@@ -140,7 +140,7 @@ static void printLitHelper(ExprAST *litOrNum) {
llvm::errs() << "[ ";
llvm::interleaveComma(literal->getValues(), llvm::errs(),
[&](auto &elt) { printLitHelper(elt.get()); });
- llvm::errs() << "]";
+ llvm::errs() << " ]";
}
/// Print a literal, see the recursive helper above for the implementation.
diff --git a/mlir/test/Examples/Toy/Ch1/ast.toy b/mlir/test/Examples/Toy/Ch1/ast.toy
index 4af2d25fe1821..0acf9dde09f4b 100644
--- a/mlir/test/Examples/Toy/Ch1/ast.toy
+++ b/mlir/test/Examples/Toy/Ch1/ast.toy
@@ -48,9 +48,9 @@ def main() {
# CHECK-NEXT: Params: []
# CHECK-NEXT: Block {
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3
-# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:11:11
+# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00 ], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00 ] ] @{{.*}}ast.toy:11:11
# CHECK-NEXT: VarDecl b<2, 3> @{{.*}}ast.toy:15:3
-# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @{{.*}}ast.toy:15:17
+# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00 ] @{{.*}}ast.toy:15:17
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:19:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:19:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:19:30
diff --git a/mlir/test/Examples/Toy/Ch2/ast.toy b/mlir/test/Examples/Toy/Ch2/ast.toy
index 48bd4432bf727..674ba30df56c6 100644
--- a/mlir/test/Examples/Toy/Ch2/ast.toy
+++ b/mlir/test/Examples/Toy/Ch2/ast.toy
@@ -48,9 +48,9 @@ def main() {
# CHECK-NEXT: Params: []
# CHECK-NEXT: Block {
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3
-# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:11:11
+# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00 ], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00 ] ] @{{.*}}ast.toy:11:11
# CHECK-NEXT: VarDecl b<2, 3> @{{.*}}ast.toy:15:3
-# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @{{.*}}ast.toy:15:17
+# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00 ] @{{.*}}ast.toy:15:17
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:19:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:19:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:19:30
diff --git a/mlir/test/Examples/Toy/Ch3/ast.toy b/mlir/test/Examples/Toy/Ch3/ast.toy
index 15ac2425390c8..4b86dba5b542d 100644
--- a/mlir/test/Examples/Toy/Ch3/ast.toy
+++ b/mlir/test/Examples/Toy/Ch3/ast.toy
@@ -48,9 +48,9 @@ def main() {
# CHECK-NEXT: Params: []
# CHECK-NEXT: Block {
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3
-# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:11:11
+# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00 ], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00 ] ] @{{.*}}ast.toy:11:11
# CHECK-NEXT: VarDecl b<2, 3> @{{.*}}ast.toy:15:3
-# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @{{.*}}ast.toy:15:17
+# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00 ] @{{.*}}ast.toy:15:17
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:19:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:19:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:19:30
diff --git a/mlir/test/Examples/Toy/Ch4/ast.toy b/mlir/test/Examples/Toy/Ch4/ast.toy
index d665be5e85ab9..1889d9a9e7579 100644
--- a/mlir/test/Examples/Toy/Ch4/ast.toy
+++ b/mlir/test/Examples/Toy/Ch4/ast.toy
@@ -48,9 +48,9 @@ def main() {
# CHECK-NEXT: Params: []
# CHECK-NEXT: Block {
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3
-# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:11:11
+# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00 ], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00 ] ] @{{.*}}ast.toy:11:11
# CHECK-NEXT: VarDecl b<2, 3> @{{.*}}ast.toy:15:3
-# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @{{.*}}ast.toy:15:17
+# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00 ] @{{.*}}ast.toy:15:17
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:19:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:19:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:19:30
diff --git a/mlir/test/Examples/Toy/Ch5/ast.toy b/mlir/test/Examples/Toy/Ch5/ast.toy
index 9840ea2c5663b..10cb1eb5503eb 100644
--- a/mlir/test/Examples/Toy/Ch5/ast.toy
+++ b/mlir/test/Examples/Toy/Ch5/ast.toy
@@ -48,9 +48,9 @@ def main() {
# CHECK-NEXT: Params: []
# CHECK-NEXT: Block {
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3
-# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:11:11
+# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00 ], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00 ] ] @{{.*}}ast.toy:11:11
# CHECK-NEXT: VarDecl b<2, 3> @{{.*}}ast.toy:15:3
-# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @{{.*}}ast.toy:15:17
+# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00 ] @{{.*}}ast.toy:15:17
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:19:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:19:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:19:30
diff --git a/mlir/test/Examples/Toy/Ch6/ast.toy b/mlir/test/Examples/Toy/Ch6/ast.toy
index f5fc2789a2f5c..d7321723b75ec 100644
--- a/mlir/test/Examples/Toy/Ch6/ast.toy
+++ b/mlir/test/Examples/Toy/Ch6/ast.toy
@@ -48,9 +48,9 @@ def main() {
# CHECK-NEXT: Params: []
# CHECK-NEXT: Block {
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3
-# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:11:11
+# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00 ], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00 ] ] @{{.*}}ast.toy:11:11
# CHECK-NEXT: VarDecl b<2, 3> @{{.*}}ast.toy:15:3
-# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @{{.*}}ast.toy:15:17
+# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00 ] @{{.*}}ast.toy:15:17
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:19:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:19:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:19:30
diff --git a/mlir/test/Examples/Toy/Ch7/ast.toy b/mlir/test/Examples/Toy/Ch7/ast.toy
index 878450a6affaa..47c31ac10bab8 100644
--- a/mlir/test/Examples/Toy/Ch7/ast.toy
+++ b/mlir/test/Examples/Toy/Ch7/ast.toy
@@ -48,9 +48,9 @@ def main() {
# CHECK-NEXT: Params: []
# CHECK-NEXT: Block {
# CHECK-NEXT: VarDecl a<> @{{.*}}ast.toy:11:3
-# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}ast.toy:11:11
+# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00 ], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00 ] ] @{{.*}}ast.toy:11:11
# CHECK-NEXT: VarDecl b<2, 3> @{{.*}}ast.toy:15:3
-# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @{{.*}}ast.toy:15:17
+# CHECK-NEXT: Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00 ] @{{.*}}ast.toy:15:17
# CHECK-NEXT: VarDecl c<> @{{.*}}ast.toy:19:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:19:11
# CHECK-NEXT: var: a @{{.*}}ast.toy:19:30
diff --git a/mlir/test/Examples/Toy/Ch7/struct-ast.toy b/mlir/test/Examples/Toy/Ch7/struct-ast.toy
index d2ccc5accd1cb..80dacfa948ebb 100644
--- a/mlir/test/Examples/Toy/Ch7/struct-ast.toy
+++ b/mlir/test/Examples/Toy/Ch7/struct-ast.toy
@@ -48,8 +48,8 @@ def main() {
# CHECK-NEXT: Params: []
# CHECK-NEXT: Block {
# CHECK-NEXT: VarDecl value<Struct> @{{.*}}struct-ast.toy:16:3
-# CHECK-NEXT: Struct Literal: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}struct-ast.toy:16:19
-# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @{{.*}}struct-ast.toy:16:43
+# CHECK-NEXT: Struct Literal: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00 ], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00 ] ] @{{.*}}struct-ast.toy:16:19
+# CHECK-NEXT: Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00 ], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00 ] ] @{{.*}}struct-ast.toy:16:43
# CHECK-NEXT: @{{.*}}struct-ast.toy:16:18
# CHECK-NEXT: VarDecl c<> @{{.*}}struct-ast.toy:19:3
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}struct-ast.toy:19:11
|
This is my first commit to LLVM. There's a missing space before the right closing bracket of tensor literals for the Toy language. This PR fixes the AST dumper to include it.