mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 14:20:17 +00:00
[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
This commit is contained in:
parent
603d58b5e4
commit
a6d6b0ac93
@ -98,7 +98,7 @@ void ConstantOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
|
||||
ConstantOp::build(builder, state, dataType, dataAttribute);
|
||||
}
|
||||
|
||||
/// The 'OpAsmPrinter' class provides a collection of methods for parsing
|
||||
/// The 'OpAsmParser' class provides a collection of methods for parsing
|
||||
/// various punctuation, as well as attributes, operands, types, etc. Each of
|
||||
/// these methods returns a `ParseResult`. This class is a wrapper around
|
||||
/// `LogicalResult` that can be converted to a boolean `true` value on failure,
|
||||
@ -116,7 +116,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
|
||||
return success();
|
||||
}
|
||||
|
||||
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
|
||||
/// The 'OpAsmPrinter' class is a stream that allows for formatting
|
||||
/// strings, attributes, operands, types, etc.
|
||||
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
|
||||
printer << "toy.constant ";
|
||||
|
@ -98,7 +98,7 @@ void ConstantOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
|
||||
ConstantOp::build(builder, state, dataType, dataAttribute);
|
||||
}
|
||||
|
||||
/// The 'OpAsmPrinter' class provides a collection of methods for parsing
|
||||
/// The 'OpAsmParser' class provides a collection of methods for parsing
|
||||
/// various punctuation, as well as attributes, operands, types, etc. Each of
|
||||
/// these methods returns a `ParseResult`. This class is a wrapper around
|
||||
/// `LogicalResult` that can be converted to a boolean `true` value on failure,
|
||||
@ -116,7 +116,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
|
||||
return success();
|
||||
}
|
||||
|
||||
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
|
||||
/// The 'OpAsmPrinter' class is a stream that allows for formatting
|
||||
/// strings, attributes, operands, types, etc.
|
||||
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
|
||||
printer << "toy.constant ";
|
||||
|
@ -24,7 +24,7 @@ namespace {
|
||||
} // end anonymous namespace
|
||||
|
||||
/// This is an example of a c++ rewrite pattern for the TransposeOp. It
|
||||
/// optimizes the following scenario: transpose(transpose(x)) -> transpose(x)
|
||||
/// optimizes the following scenario: transpose(transpose(x)) -> x
|
||||
struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
|
||||
/// We register this pattern to match every toy.transpose in the IR.
|
||||
/// The "benefit" is used by the framework to order the patterns and process
|
||||
|
@ -166,7 +166,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
|
||||
return success();
|
||||
}
|
||||
|
||||
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
|
||||
/// The 'OpAsmPrinter' class is a stream that allows for formatting
|
||||
/// strings, attributes, operands, types, etc.
|
||||
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
|
||||
printer << "toy.constant ";
|
||||
|
@ -29,7 +29,7 @@ OpFoldResult CastOp::fold(ArrayRef<Attribute> operands) {
|
||||
}
|
||||
|
||||
/// This is an example of a c++ rewrite pattern for the TransposeOp. It
|
||||
/// optimizes the following scenario: transpose(transpose(x)) -> transpose(x)
|
||||
/// optimizes the following scenario: transpose(transpose(x)) -> x
|
||||
struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
|
||||
/// We register this pattern to match every toy.transpose in the IR.
|
||||
/// The "benefit" is used by the framework to order the patterns and process
|
||||
|
@ -148,7 +148,7 @@ void ConstantOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
|
||||
ConstantOp::build(builder, state, dataType, dataAttribute);
|
||||
}
|
||||
|
||||
/// The 'OpAsmPrinter' class provides a collection of methods for parsing
|
||||
/// The 'OpAsmParser' class provides a collection of methods for parsing
|
||||
/// various punctuation, as well as attributes, operands, types, etc. Each of
|
||||
/// these methods returns a `ParseResult`. This class is a wrapper around
|
||||
/// `LogicalResult` that can be converted to a boolean `true` value on failure,
|
||||
@ -166,7 +166,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
|
||||
return success();
|
||||
}
|
||||
|
||||
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
|
||||
/// The 'OpAsmPrinter' class is a stream that allows for formatting
|
||||
/// strings, attributes, operands, types, etc.
|
||||
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
|
||||
printer << "toy.constant ";
|
||||
|
@ -29,7 +29,7 @@ OpFoldResult CastOp::fold(ArrayRef<Attribute> operands) {
|
||||
}
|
||||
|
||||
/// This is an example of a c++ rewrite pattern for the TransposeOp. It
|
||||
/// optimizes the following scenario: transpose(transpose(x)) -> transpose(x)
|
||||
/// optimizes the following scenario: transpose(transpose(x)) -> x
|
||||
struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
|
||||
/// We register this pattern to match every toy.transpose in the IR.
|
||||
/// The "benefit" is used by the framework to order the patterns and process
|
||||
|
@ -148,7 +148,7 @@ void ConstantOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
|
||||
ConstantOp::build(builder, state, dataType, dataAttribute);
|
||||
}
|
||||
|
||||
/// The 'OpAsmPrinter' class provides a collection of methods for parsing
|
||||
/// The 'OpAsmParser' class provides a collection of methods for parsing
|
||||
/// various punctuation, as well as attributes, operands, types, etc. Each of
|
||||
/// these methods returns a `ParseResult`. This class is a wrapper around
|
||||
/// `LogicalResult` that can be converted to a boolean `true` value on failure,
|
||||
@ -166,7 +166,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
|
||||
return success();
|
||||
}
|
||||
|
||||
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
|
||||
/// The 'OpAsmPrinter' class is a stream that allows for formatting
|
||||
/// strings, attributes, operands, types, etc.
|
||||
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
|
||||
printer << "toy.constant ";
|
||||
|
@ -6,9 +6,18 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements a partial lowering of Toy operations to a combination of
|
||||
// affine loops and standard operations. This lowering expects that all calls
|
||||
// have been inlined, and all shapes have been resolved.
|
||||
// This file implements full lowering of Toy operations to LLVM MLIR dialect.
|
||||
// 'toy.print' is lowered to a loop nest that calls `printf` on each element of
|
||||
// the input array. The file also sets up the ToyToLLVMLoweringPass. This pass
|
||||
// lowers the combination of Affine + SCF + Standard dialects to the LLVM one:
|
||||
//
|
||||
// Affine --
|
||||
// |
|
||||
// v
|
||||
// Standard --> LLVM (Dialect)
|
||||
// ^
|
||||
// |
|
||||
// 'toy.print' --> Loop (SCF) --
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@ -29,7 +29,7 @@ OpFoldResult CastOp::fold(ArrayRef<Attribute> operands) {
|
||||
}
|
||||
|
||||
/// This is an example of a c++ rewrite pattern for the TransposeOp. It
|
||||
/// optimizes the following scenario: transpose(transpose(x)) -> transpose(x)
|
||||
/// optimizes the following scenario: transpose(transpose(x)) -> x
|
||||
struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
|
||||
/// We register this pattern to match every toy.transpose in the IR.
|
||||
/// The "benefit" is used by the framework to order the patterns and process
|
||||
|
@ -161,7 +161,7 @@ void ConstantOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
|
||||
ConstantOp::build(builder, state, dataType, dataAttribute);
|
||||
}
|
||||
|
||||
/// The 'OpAsmPrinter' class provides a collection of methods for parsing
|
||||
/// The 'OpAsmParser' class provides a collection of methods for parsing
|
||||
/// various punctuation, as well as attributes, operands, types, etc. Each of
|
||||
/// these methods returns a `ParseResult`. This class is a wrapper around
|
||||
/// `LogicalResult` that can be converted to a boolean `true` value on failure,
|
||||
@ -179,7 +179,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
|
||||
return success();
|
||||
}
|
||||
|
||||
/// The 'OpAsmPrinter' class is a stream that will allows for formatting
|
||||
/// The 'OpAsmPrinter' class is a stream that allows for formatting
|
||||
/// strings, attributes, operands, types, etc.
|
||||
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
|
||||
printer << "toy.constant ";
|
||||
|
@ -6,9 +6,18 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements a partial lowering of Toy operations to a combination of
|
||||
// affine loops and standard operations. This lowering expects that all calls
|
||||
// have been inlined, and all shapes have been resolved.
|
||||
// This file implements full lowering of Toy operations to LLVM MLIR dialect.
|
||||
// 'toy.print' is lowered to a loop nest that calls `printf` on each element of
|
||||
// the input array. The file also sets up the ToyToLLVMLoweringPass. This pass
|
||||
// lowers the combination of Affine + SCF + Standard dialects to the LLVM one:
|
||||
//
|
||||
// Affine --
|
||||
// |
|
||||
// v
|
||||
// Standard --> LLVM (Dialect)
|
||||
// ^
|
||||
// |
|
||||
// 'toy.print' --> Loop (SCF) --
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@ -47,7 +47,7 @@ OpFoldResult StructAccessOp::fold(ArrayRef<Attribute> operands) {
|
||||
}
|
||||
|
||||
/// This is an example of a c++ rewrite pattern for the TransposeOp. It
|
||||
/// optimizes the following scenario: transpose(transpose(x)) -> transpose(x)
|
||||
/// optimizes the following scenario: transpose(transpose(x)) -> x
|
||||
struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
|
||||
/// We register this pattern to match every toy.transpose in the IR.
|
||||
/// The "benefit" is used by the framework to order the patterns and process
|
||||
|
Loading…
Reference in New Issue
Block a user