MLIR
22.0.0git
|
Namespaces | |
arith | |
Functions | |
void | registerAllExtensions (DialectRegistry ®istry) |
Register all extensions of the func dialect. More... | |
void | registerInlinerExtension (DialectRegistry ®istry) |
Register the extension used to support inlining the func dialect. More... | |
void | registerShardingInterfaceExternalModels (DialectRegistry ®istry) |
void | registerTransformDialectExtension (DialectRegistry ®istry) |
mlir::FailureOr< mlir::func::FuncOp > | replaceFuncWithNewMapping (mlir::RewriterBase &rewriter, mlir::func::FuncOp funcOp, ArrayRef< int > oldArgIdxToNewArgIdx, ArrayRef< int > oldResIdxToNewResIdx) |
Creates a new function operation with the same name as the original function operation, but with the arguments mapped according to the oldArgToNewArg and oldResToNewRes . More... | |
mlir::func::CallOp | replaceCallOpWithNewMapping (mlir::RewriterBase &rewriter, mlir::func::CallOp callOp, ArrayRef< int > oldArgIdxToNewArgIdx, ArrayRef< int > oldResIdxToNewResIdx) |
Creates a new call operation with the values as the original call operation, but with the arguments mapped according to the oldArgToNewArg and oldResToNewRes . More... | |
mlir::FailureOr< std::pair< mlir::func::FuncOp, mlir::func::CallOp > > | deduplicateArgsOfFuncOp (mlir::RewriterBase &rewriter, mlir::func::FuncOp funcOp, mlir::ModuleOp moduleOp) |
This utility function examines all call operations within the given moduleOp that target the specified funcOp . More... | |
mlir::FailureOr<std::pair<mlir::func::FuncOp, mlir::func::CallOp> > mlir::func::deduplicateArgsOfFuncOp | ( | mlir::RewriterBase & | rewriter, |
mlir::func::FuncOp | funcOp, | ||
mlir::ModuleOp | moduleOp | ||
) |
This utility function examines all call operations within the given moduleOp
that target the specified funcOp
.
It identifies duplicate operands in the call operations, creates mappings to deduplicate them, and then applies the transformation to both the function and its call sites. For now, it only supports one call operation for the function operation. The function returns a pair containing the new funcOp and the new callOp. Note: after the transformation, the original funcOp and callOp will be erased.
void mlir::func::registerAllExtensions | ( | DialectRegistry & | registry | ) |
Register all extensions of the func dialect.
This should generally only be used by tools, or other use cases that really do want all extensions of the dialect. All other cases should prefer to instead register the specific extensions they intend to take advantage of.
Definition at line 15 of file AllExtensions.cpp.
References registerInlinerExtension(), and mlir::arith::registerShardingInterfaceExternalModels().
Referenced by mlir::registerAllExtensions().
void mlir::func::registerInlinerExtension | ( | DialectRegistry & | registry | ) |
Register the extension used to support inlining the func dialect.
Definition at line 87 of file InlinerExtension.cpp.
References mlir::DialectRegistry::addExtension(), and mlir::MLIRContext::getOrLoadDialect().
Referenced by registerAllExtensions().
void mlir::func::registerShardingInterfaceExternalModels | ( | DialectRegistry & | registry | ) |
Definition at line 16 of file ShardingExtensions.cpp.
References mlir::DialectRegistry::addExtension().
void mlir::func::registerTransformDialectExtension | ( | DialectRegistry & | registry | ) |
Definition at line 412 of file FuncTransformOps.cpp.
References mlir::DialectRegistry::addExtensions().
mlir::func::CallOp mlir::func::replaceCallOpWithNewMapping | ( | mlir::RewriterBase & | rewriter, |
mlir::func::CallOp | callOp, | ||
ArrayRef< int > | oldArgIdxToNewArgIdx, | ||
ArrayRef< int > | oldResIdxToNewResIdx | ||
) |
Creates a new call operation with the values as the original call operation, but with the arguments mapped according to the oldArgToNewArg
and oldResToNewRes
.
Note: the method asserts that the oldArgToNewArg
and oldResToNewRes
maps the whole call operation arguments and results.
mlir::FailureOr<mlir::func::FuncOp> mlir::func::replaceFuncWithNewMapping | ( | mlir::RewriterBase & | rewriter, |
mlir::func::FuncOp | funcOp, | ||
ArrayRef< int > | oldArgIdxToNewArgIdx, | ||
ArrayRef< int > | oldResIdxToNewResIdx | ||
) |
Creates a new function operation with the same name as the original function operation, but with the arguments mapped according to the oldArgToNewArg
and oldResToNewRes
.
The funcOp
operation must have exactly one block. Returns the new function operation or failure if funcOp
doesn't have exactly one block. Note: the method asserts that the oldArgToNewArg
and oldResToNewRes
maps the whole function arguments and results.