Skip to content

Commit a6d6b0a

Browse files
KareemErgawyantiagainst
authored andcommitted
[MLIR][Toy] Fix a few typos in the comments/docs.
Fixes a few typos and errors in MLIR's Toy tutorial docs and comments. Differential Revision: https://reviews.llvm.org/D81406
1 parent 603d58b commit a6d6b0a

File tree

13 files changed

+40
-22
lines changed

13 files changed

+40
-22
lines changed

mlir/examples/toy/Ch2/mlir/Dialect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void ConstantOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
9898
ConstantOp::build(builder, state, dataType, dataAttribute);
9999
}
100100

101-
/// The 'OpAsmPrinter' class provides a collection of methods for parsing
101+
/// The 'OpAsmParser' class provides a collection of methods for parsing
102102
/// various punctuation, as well as attributes, operands, types, etc. Each of
103103
/// these methods returns a `ParseResult`. This class is a wrapper around
104104
/// `LogicalResult` that can be converted to a boolean `true` value on failure,
@@ -116,7 +116,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
116116
return success();
117117
}
118118

119-
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
119+
/// The 'OpAsmPrinter' class is a stream that allows for formatting
120120
/// strings, attributes, operands, types, etc.
121121
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
122122
printer << "toy.constant ";

mlir/examples/toy/Ch3/mlir/Dialect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void ConstantOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
9898
ConstantOp::build(builder, state, dataType, dataAttribute);
9999
}
100100

101-
/// The 'OpAsmPrinter' class provides a collection of methods for parsing
101+
/// The 'OpAsmParser' class provides a collection of methods for parsing
102102
/// various punctuation, as well as attributes, operands, types, etc. Each of
103103
/// these methods returns a `ParseResult`. This class is a wrapper around
104104
/// `LogicalResult` that can be converted to a boolean `true` value on failure,
@@ -116,7 +116,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
116116
return success();
117117
}
118118

119-
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
119+
/// The 'OpAsmPrinter' class is a stream that allows for formatting
120120
/// strings, attributes, operands, types, etc.
121121
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
122122
printer << "toy.constant ";

mlir/examples/toy/Ch3/mlir/ToyCombine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace {
2424
} // end anonymous namespace
2525

2626
/// This is an example of a c++ rewrite pattern for the TransposeOp. It
27-
/// optimizes the following scenario: transpose(transpose(x)) -> transpose(x)
27+
/// optimizes the following scenario: transpose(transpose(x)) -> x
2828
struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
2929
/// We register this pattern to match every toy.transpose in the IR.
3030
/// The "benefit" is used by the framework to order the patterns and process

mlir/examples/toy/Ch4/mlir/Dialect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
166166
return success();
167167
}
168168

169-
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
169+
/// The 'OpAsmPrinter' class is a stream that allows for formatting
170170
/// strings, attributes, operands, types, etc.
171171
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
172172
printer << "toy.constant ";

mlir/examples/toy/Ch4/mlir/ToyCombine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ OpFoldResult CastOp::fold(ArrayRef<Attribute> operands) {
2929
}
3030

3131
/// This is an example of a c++ rewrite pattern for the TransposeOp. It
32-
/// optimizes the following scenario: transpose(transpose(x)) -> transpose(x)
32+
/// optimizes the following scenario: transpose(transpose(x)) -> x
3333
struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
3434
/// We register this pattern to match every toy.transpose in the IR.
3535
/// The "benefit" is used by the framework to order the patterns and process

mlir/examples/toy/Ch5/mlir/Dialect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void ConstantOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
148148
ConstantOp::build(builder, state, dataType, dataAttribute);
149149
}
150150

151-
/// The 'OpAsmPrinter' class provides a collection of methods for parsing
151+
/// The 'OpAsmParser' class provides a collection of methods for parsing
152152
/// various punctuation, as well as attributes, operands, types, etc. Each of
153153
/// these methods returns a `ParseResult`. This class is a wrapper around
154154
/// `LogicalResult` that can be converted to a boolean `true` value on failure,
@@ -166,7 +166,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
166166
return success();
167167
}
168168

169-
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
169+
/// The 'OpAsmPrinter' class is a stream that allows for formatting
170170
/// strings, attributes, operands, types, etc.
171171
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
172172
printer << "toy.constant ";

mlir/examples/toy/Ch5/mlir/ToyCombine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ OpFoldResult CastOp::fold(ArrayRef<Attribute> operands) {
2929
}
3030

3131
/// This is an example of a c++ rewrite pattern for the TransposeOp. It
32-
/// optimizes the following scenario: transpose(transpose(x)) -> transpose(x)
32+
/// optimizes the following scenario: transpose(transpose(x)) -> x
3333
struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
3434
/// We register this pattern to match every toy.transpose in the IR.
3535
/// The "benefit" is used by the framework to order the patterns and process

mlir/examples/toy/Ch6/mlir/Dialect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void ConstantOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
148148
ConstantOp::build(builder, state, dataType, dataAttribute);
149149
}
150150

151-
/// The 'OpAsmPrinter' class provides a collection of methods for parsing
151+
/// The 'OpAsmParser' class provides a collection of methods for parsing
152152
/// various punctuation, as well as attributes, operands, types, etc. Each of
153153
/// these methods returns a `ParseResult`. This class is a wrapper around
154154
/// `LogicalResult` that can be converted to a boolean `true` value on failure,
@@ -166,7 +166,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
166166
return success();
167167
}
168168

169-
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
169+
/// The 'OpAsmPrinter' class is a stream that allows for formatting
170170
/// strings, attributes, operands, types, etc.
171171
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
172172
printer << "toy.constant ";

mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@
66
//
77
//===----------------------------------------------------------------------===//
88
//
9-
// This file implements a partial lowering of Toy operations to a combination of
10-
// affine loops and standard operations. This lowering expects that all calls
11-
// have been inlined, and all shapes have been resolved.
9+
// This file implements full lowering of Toy operations to LLVM MLIR dialect.
10+
// 'toy.print' is lowered to a loop nest that calls `printf` on each element of
11+
// the input array. The file also sets up the ToyToLLVMLoweringPass. This pass
12+
// lowers the combination of Affine + SCF + Standard dialects to the LLVM one:
13+
//
14+
// Affine --
15+
// |
16+
// v
17+
// Standard --> LLVM (Dialect)
18+
// ^
19+
// |
20+
// 'toy.print' --> Loop (SCF) --
1221
//
1322
//===----------------------------------------------------------------------===//
1423

mlir/examples/toy/Ch6/mlir/ToyCombine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ OpFoldResult CastOp::fold(ArrayRef<Attribute> operands) {
2929
}
3030

3131
/// This is an example of a c++ rewrite pattern for the TransposeOp. It
32-
/// optimizes the following scenario: transpose(transpose(x)) -> transpose(x)
32+
/// optimizes the following scenario: transpose(transpose(x)) -> x
3333
struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
3434
/// We register this pattern to match every toy.transpose in the IR.
3535
/// The "benefit" is used by the framework to order the patterns and process

mlir/examples/toy/Ch7/mlir/Dialect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void ConstantOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
161161
ConstantOp::build(builder, state, dataType, dataAttribute);
162162
}
163163

164-
/// The 'OpAsmPrinter' class provides a collection of methods for parsing
164+
/// The 'OpAsmParser' class provides a collection of methods for parsing
165165
/// various punctuation, as well as attributes, operands, types, etc. Each of
166166
/// these methods returns a `ParseResult`. This class is a wrapper around
167167
/// `LogicalResult` that can be converted to a boolean `true` value on failure,
@@ -179,7 +179,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
179179
return success();
180180
}
181181

182-
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
182+
/// The 'OpAsmPrinter' class is a stream that allows for formatting
183183
/// strings, attributes, operands, types, etc.
184184
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
185185
printer << "toy.constant ";

mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@
66
//
77
//===----------------------------------------------------------------------===//
88
//
9-
// This file implements a partial lowering of Toy operations to a combination of
10-
// affine loops and standard operations. This lowering expects that all calls
11-
// have been inlined, and all shapes have been resolved.
9+
// This file implements full lowering of Toy operations to LLVM MLIR dialect.
10+
// 'toy.print' is lowered to a loop nest that calls `printf` on each element of
11+
// the input array. The file also sets up the ToyToLLVMLoweringPass. This pass
12+
// lowers the combination of Affine + SCF + Standard dialects to the LLVM one:
13+
//
14+
// Affine --
15+
// |
16+
// v
17+
// Standard --> LLVM (Dialect)
18+
// ^
19+
// |
20+
// 'toy.print' --> Loop (SCF) --
1221
//
1322
//===----------------------------------------------------------------------===//
1423

mlir/examples/toy/Ch7/mlir/ToyCombine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ OpFoldResult StructAccessOp::fold(ArrayRef<Attribute> operands) {
4747
}
4848

4949
/// This is an example of a c++ rewrite pattern for the TransposeOp. It
50-
/// optimizes the following scenario: transpose(transpose(x)) -> transpose(x)
50+
/// optimizes the following scenario: transpose(transpose(x)) -> x
5151
struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
5252
/// We register this pattern to match every toy.transpose in the IR.
5353
/// The "benefit" is used by the framework to order the patterns and process

0 commit comments

Comments
 (0)