MLIR
17.0.0git
|
Functions | |
LogicalResult | foldMemRefCast (Operation *op, Value inner=nullptr) |
This is a common utility used for patterns of the form "someop(memref.cast) -> someop". More... | |
Type | getTensorTypeFromMemRefType (Type type) |
Return an unranked/ranked tensor type for the given unranked/ranked memref type. More... | |
std::optional< Operation * > | findDealloc (Value allocValue) |
Finds a single dealloc operation for the given allocated value. More... | |
SmallVector< OpFoldResult > | getMixedSizes (OpBuilder &builder, Location loc, Value value) |
Return the dimensions of the given memref value. More... | |
Value | createCanonicalRankReducingSubViewOp (OpBuilder &b, Location loc, Value memref, ArrayRef< int64_t > targetShape) |
Create a rank-reducing SubViewOp @[0 . More... | |
void | registerTransformDialectExtension (DialectRegistry ®istry) |
void | registerBufferizableOpInterfaceExternalModels (DialectRegistry ®istry) |
void | populateComposeSubViewPatterns (RewritePatternSet &patterns, MLIRContext *context) |
void | populateExpandOpsPatterns (RewritePatternSet &patterns) |
Collects a set of patterns to rewrite ops within the memref dialect. More... | |
void | populateFoldMemRefAliasOpPatterns (RewritePatternSet &patterns) |
Appends patterns for folding memref aliasing ops into consumer load/store ops into patterns . More... | |
void | populateResolveRankedShapeTypeResultDimsPatterns (RewritePatternSet &patterns) |
Appends patterns that resolve memref.dim operations with values that are defined by operations that implement the ReifyRankedShapeTypeShapeOpInterface , in terms of shapes of its input operands. More... | |
void | populateResolveShapedTypeResultDimsPatterns (RewritePatternSet &patterns) |
Appends patterns that resolve memref.dim operations with values that are defined by operations that implement the InferShapedTypeOpInterface , in terms of shapes of its input operands. More... | |
void | populateExpandStridedMetadataPatterns (RewritePatternSet &patterns) |
Appends patterns for expanding memref operations that modify the metadata (sizes, offset, strides) of a memref into easier to analyze constructs. More... | |
void | populateMemRefWideIntEmulationPatterns (arith::WideIntEmulationConverter &typeConverter, RewritePatternSet &patterns) |
Appends patterns for emulating wide integer memref operations with ops over narrower integer types. More... | |
void | populateMemRefWideIntEmulationConversions (arith::WideIntEmulationConverter &typeConverter) |
Appends type converions for emulating wide integer memref operations with ops over narrowe integer types. More... | |
FailureOr< memref::AllocOp > | multiBuffer (RewriterBase &rewriter, memref::AllocOp allocOp, unsigned multiplier, bool skipOverrideAnalysis=false) |
Transformation to do multi-buffering/array expansion to remove dependencies on the temporary allocation between consecutive loop iterations. More... | |
FailureOr< memref::AllocOp > | multiBuffer (memref::AllocOp allocOp, unsigned multiplier, bool skipOverrideAnalysis=false) |
Call into multiBuffer with locally constructed IRRewriter. More... | |
std::unique_ptr< Pass > | createExpandOpsPass () |
Creates an instance of the ExpandOps pass that legalizes memref dialect ops to be convertible to LLVM. More... | |
std::unique_ptr< Pass > | createFoldMemRefAliasOpsPass () |
Creates an operation pass to fold memref aliasing ops into consumer load/store ops into patterns . More... | |
std::unique_ptr< OperationPass< ModuleOp > > | createNormalizeMemRefsPass () |
Creates an interprocedural pass to normalize memrefs to have a trivial (identity) layout map. More... | |
std::unique_ptr< Pass > | createResolveRankedShapeTypeResultDimsPass () |
Creates an operation pass to resolve memref.dim operations with values that are defined by operations that implement the ReifyRankedShapeTypeShapeOpInterface , in terms of shapes of its input operands. More... | |
std::unique_ptr< Pass > | createResolveShapedTypeResultDimsPass () |
Creates an operation pass to resolve memref.dim operations with values that are defined by operations that implement the InferShapedTypeOpInterface or the ReifyRankedShapeTypeShapeOpInterface , in terms of shapes of its input operands. More... | |
std::unique_ptr< Pass > | createExpandStridedMetadataPass () |
Creates an operation pass to expand some memref operation into easier to reason about operations. More... | |
void | registerRuntimeVerifiableOpInterfaceExternalModels (DialectRegistry ®istry) |
Value mlir::memref::createCanonicalRankReducingSubViewOp | ( | OpBuilder & | b, |
Location | loc, | ||
Value | memref, | ||
ArrayRef< int64_t > | targetShape | ||
) |
Create a rank-reducing SubViewOp @[0 .
. 0] with strides [1 .. 1] and appropriate sizes (i.e. memref.getSizes()
) to reduce the rank of memref
to that of targetShape
.
Definition at line 2963 of file MemRefOps.cpp.
References mlir::Type::cast(), mlir::OpBuilder::createOrFold(), mlir::Builder::getIndexAttr(), getMixedSizes(), and mlir::Value::getType().
std::unique_ptr< Pass > mlir::memref::createExpandOpsPass | ( | ) |
Creates an instance of the ExpandOps pass that legalizes memref dialect ops to be convertible to LLVM.
For example, memref.reshape
gets converted to memref_reinterpret_cast
.
Definition at line 158 of file ExpandOps.cpp.
std::unique_ptr< Pass > mlir::memref::createExpandStridedMetadataPass | ( | ) |
Creates an operation pass to expand some memref operation into easier to reason about operations.
Definition at line 786 of file ExpandStridedMetadata.cpp.
Referenced by mlir::sparse_tensor::buildSparseCompiler().
std::unique_ptr< Pass > mlir::memref::createFoldMemRefAliasOpsPass | ( | ) |
Creates an operation pass to fold memref aliasing ops into consumer load/store ops into patterns
.
Definition at line 631 of file FoldMemRefAliasOps.cpp.
std::unique_ptr< OperationPass< ModuleOp > > mlir::memref::createNormalizeMemRefsPass | ( | ) |
Creates an interprocedural pass to normalize memrefs to have a trivial (identity) layout map.
Definition at line 56 of file NormalizeMemRefs.cpp.
std::unique_ptr< Pass > mlir::memref::createResolveRankedShapeTypeResultDimsPass | ( | ) |
Creates an operation pass to resolve memref.dim
operations with values that are defined by operations that implement the ReifyRankedShapeTypeShapeOpInterface
, in terms of shapes of its input operands.
Definition at line 157 of file ResolveShapedTypeResultDims.cpp.
std::unique_ptr< Pass > mlir::memref::createResolveShapedTypeResultDimsPass | ( | ) |
Creates an operation pass to resolve memref.dim
operations with values that are defined by operations that implement the InferShapedTypeOpInterface
or the ReifyRankedShapeTypeShapeOpInterface
, in terms of shapes of its input operands.
Definition at line 153 of file ResolveShapedTypeResultDims.cpp.
Finds a single dealloc operation for the given allocated value.
Finds the unique dealloc operation (if one exists) for allocValue
.
If there are > 1 deallocates for allocValue
, returns std::nullopt, else returns the single deallocate if it exists or nullptr.
Definition at line 47 of file MemRefDialect.cpp.
References mlir::Value::getUsers().
LogicalResult mlir::memref::foldMemRefCast | ( | Operation * | op, |
Value | inner = nullptr |
||
) |
This is a common utility used for patterns of the form "someop(memref.cast) -> someop".
This is a common class used for patterns of the form "someop(memrefcast) -> someop".
It folds the source of any memref.cast into the root operation directly.
Definition at line 89 of file MemRefOps.cpp.
References mlir::Operation::getOpOperands(), mlir::Value::getType(), mlir::Type::isa(), and mlir::success().
Referenced by mlir::AffineDmaStartOp::fold(), and mlir::AffineDmaWaitOp::fold().
SmallVector< OpFoldResult > mlir::memref::getMixedSizes | ( | OpBuilder & | builder, |
Location | loc, | ||
Value | value | ||
) |
Return the dimensions of the given memref value.
Definition at line 112 of file MemRefOps.cpp.
References mlir::Type::cast(), mlir::OpBuilder::create(), mlir::Builder::getIndexAttr(), and mlir::Value::getType().
Referenced by createCanonicalRankReducingSubViewOp().
Return an unranked/ranked tensor type for the given unranked/ranked memref type.
Definition at line 104 of file MemRefOps.cpp.
References mlir::Type::dyn_cast(), and mlir::Type::getContext().
Referenced by parseGlobalMemrefOpTypeAndInitialValue().
FailureOr< memref::AllocOp > mlir::memref::multiBuffer | ( | memref::AllocOp | allocOp, |
unsigned | multiplier, | ||
bool | skipOverrideAnalysis = false |
||
) |
Call into multiBuffer
with locally constructed IRRewriter.
Definition at line 243 of file MultiBuffer.cpp.
References multiBuffer().
FailureOr< memref::AllocOp > mlir::memref::multiBuffer | ( | RewriterBase & | rewriter, |
memref::AllocOp | allocOp, | ||
unsigned | multiplier, | ||
bool | skipOverrideAnalysis = false |
||
) |
Transformation to do multi-buffering/array expansion to remove dependencies on the temporary allocation between consecutive loop iterations.
It returns the new allocation if the original allocation was multi-buffered and returns failure() otherwise. When skipOverrideAnalysis
, the pass will apply the transformation without checking thwt the buffer is overrided at the beginning of each iteration. This implies that user knows that there is no data carried across loop iterations. Example:
into:
Make sure there is no loop-carried dependency on the allocation.
Definition at line 98 of file MultiBuffer.cpp.
References mlir::bindDims(), mlir::OpBuilder::create(), DBGS, mlir::DominanceInfo::dominates(), mlir::RewriterBase::eraseOp(), mlir::failure(), mlir::floorDiv(), mlir::Builder::getContext(), mlir::Builder::getIndexAttr(), mlir::Operation::getUsers(), mlir::getValueOrCreateConstantIndexOp(), mlir::makeComposedAffineApply(), overrideBuffer(), replaceUsesAndPropagateType(), mlir::OpBuilder::setInsertionPoint(), mlir::OpBuilder::setInsertionPointToStart(), and mlir::MemRefType::Builder::setShape().
Referenced by multiBuffer().
void mlir::memref::populateComposeSubViewPatterns | ( | RewritePatternSet & | patterns, |
MLIRContext * | context | ||
) |
Definition at line 130 of file ComposeSubView.cpp.
References mlir::RewritePatternSet::add().
void mlir::memref::populateExpandOpsPatterns | ( | RewritePatternSet & | patterns | ) |
Collects a set of patterns to rewrite ops within the memref dialect.
Definition at line 153 of file ExpandOps.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
void mlir::memref::populateExpandStridedMetadataPatterns | ( | RewritePatternSet & | patterns | ) |
Appends patterns for expanding memref operations that modify the metadata (sizes, offset, strides) of a memref into easier to analyze constructs.
Definition at line 751 of file ExpandStridedMetadata.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
void mlir::memref::populateFoldMemRefAliasOpPatterns | ( | RewritePatternSet & | patterns | ) |
Appends patterns for folding memref aliasing ops into consumer load/store ops into patterns
.
Definition at line 592 of file FoldMemRefAliasOps.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
void mlir::memref::populateMemRefWideIntEmulationConversions | ( | arith::WideIntEmulationConverter & | typeConverter | ) |
Appends type converions for emulating wide integer memref operations with ops over narrowe integer types.
Definition at line 147 of file EmulateWideInt.cpp.
References mlir::TypeConverter::addConversion(), mlir::TypeConverter::convertType(), and mlir::arith::WideIntEmulationConverter::getMaxTargetIntBitWidth().
void mlir::memref::populateMemRefWideIntEmulationPatterns | ( | arith::WideIntEmulationConverter & | typeConverter, |
RewritePatternSet & | patterns | ||
) |
Appends patterns for emulating wide integer memref operations with ops over narrower integer types.
Definition at line 139 of file EmulateWideInt.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
void mlir::memref::populateResolveRankedShapeTypeResultDimsPatterns | ( | RewritePatternSet & | patterns | ) |
Appends patterns that resolve memref.dim
operations with values that are defined by operations that implement the ReifyRankedShapeTypeShapeOpInterface
, in terms of shapes of its input operands.
Definition at line 123 of file ResolveShapedTypeResultDims.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
Referenced by mlir::linalg::populateFoldUnitExtentDimsViaReshapesPatterns(), and mlir::linalg::populateFoldUnitExtentDimsViaSlicesPatterns().
void mlir::memref::populateResolveShapedTypeResultDimsPatterns | ( | RewritePatternSet & | patterns | ) |
Appends patterns that resolve memref.dim
operations with values that are defined by operations that implement the InferShapedTypeOpInterface
, in terms of shapes of its input operands.
Definition at line 130 of file ResolveShapedTypeResultDims.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
Referenced by mlir::linalg::populateFoldUnitExtentDimsViaReshapesPatterns(), and mlir::linalg::populateFoldUnitExtentDimsViaSlicesPatterns().
void mlir::memref::registerBufferizableOpInterfaceExternalModels | ( | DialectRegistry & | registry | ) |
Definition at line 58 of file BufferizableOpInterfaceImpl.cpp.
References mlir::DialectRegistry::addExtension().
Referenced by mlir::registerAllDialects().
void mlir::memref::registerRuntimeVerifiableOpInterfaceExternalModels | ( | DialectRegistry & | registry | ) |
Definition at line 181 of file RuntimeOpVerification.cpp.
References mlir::DialectRegistry::addExtension(), and mlir::MLIRContext::loadDialect().
Referenced by mlir::registerAllDialects().
void mlir::memref::registerTransformDialectExtension | ( | DialectRegistry & | registry | ) |
Definition at line 98 of file MemRefTransformOps.cpp.
References mlir::DialectRegistry::addExtensions().
Referenced by mlir::registerAllDialects().