MLIR  15.0.0git
Classes | Namespaces | Typedefs | Enumerations | Functions
Transforms.h File Reference
#include <utility>
#include "mlir/Conversion/VectorToSCF/VectorToSCF.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/Dialect/Vector/Transforms/VectorTransforms.h"
#include "mlir/Dialect/X86Vector/Transforms.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallSet.h"
+ Include dependency graph for Transforms.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mlir::linalg::TiledLinalgOp
 Perform standalone tiling of a single LinalgOp by tileSizes. More...
 
struct  mlir::linalg::TiledAndFusedLinalgOps
 Fuse a sequence of linalg operations (ops) using tile-and-fuse. More...
 
struct  mlir::linalg::LinalgPromotionOptions
 
struct  mlir::linalg::PromotionInfo
 Create a new buffer using the allocationFn provided. More...
 
struct  mlir::linalg::LinalgTransforms
 
struct  mlir::linalg::LinalgTransformationFilter
 Helper class to control application of linalg transformation patterns. More...
 
struct  mlir::linalg::LinalgPaddingOptions
 
struct  mlir::linalg::LinalgTilingAndFusionOptions
 
struct  mlir::linalg::LinalgTilingOptions
 
struct  mlir::linalg::LinalgTilingPattern
 Linalg tiling pattern. More...
 
struct  mlir::linalg::LinalgPaddingPattern
 Linalg padding pattern. More...
 
struct  mlir::linalg::LinalgFusionOptions
 
struct  mlir::linalg::LinalgBaseTileAndFusePattern
 
struct  mlir::linalg::LinalgTileAndFusePattern< OpTy >
 
struct  mlir::linalg::LinalgTileAndFuseTensorOpsPattern
 Linalg tile and fuse tensor ops pattern. More...
 
struct  mlir::linalg::GenericOpInterchangePattern
 Linalg generic interchange pattern. More...
 
struct  mlir::linalg::LinalgGeneralizationPattern
 Linalg generalization pattern. More...
 
struct  mlir::linalg::LinalgBasePromotionPattern
 Linalg promotion patterns. More...
 
struct  mlir::linalg::LinalgPromotionPattern< OpTy >
 
struct  mlir::linalg::LinalgVectorizationOptions
 Linalg vectorization patterns. More...
 
struct  mlir::linalg::LinalgVectorizationPattern
 filter controls LinalgTransformMarker matching and update when specified. More...
 
struct  mlir::linalg::CopyVectorizationPattern
 filter controls LinalgTransformMarker matching and update when specified. More...
 
struct  mlir::linalg::LinalgEnablingOptions
 Options to control the application of enabling transformations. More...
 
struct  mlir::linalg::LinalgVectorLoweringOptions
 Vector lowering options control how ops are lowered down to 1-D and scf.for form. More...
 
struct  mlir::linalg::LinalgLoweringPattern< OpTy >
 
struct  mlir::linalg::PadOpTransformationPattern
 tensor::PadOp is not canonicalized away yet, so we provide a transformation to linalg.generic. More...
 
struct  mlir::linalg::GeneralizePadOpPattern
 Rewrite a tensor::PadOp into a sequence of InitTensorOp, FillOp and InsertSliceOp. More...
 
struct  mlir::linalg::LinalgCopyVTRForwardingPattern
 Match and rewrite for the pattern: ``` alloc = ... More...
 
struct  mlir::linalg::LinalgCopyVTWForwardingPattern
 Match and rewrite for the pattern: ``` alloc = ... More...
 
struct  mlir::linalg::ExtractSliceOfPadTensorSwapPattern
 Rewrite extract_slice(tensor.pad(x)) into tensor.pad(extract_slice(x)). More...
 
class  mlir::linalg::VectorizationPatterns< OpTypes >
 
class  mlir::linalg::VectorizationPatterns<>
 
class  mlir::linalg::VectorizationPatterns< OpTy, OpTypes... >
 
class  mlir::linalg::TilingPatterns< OpTypes >
 
class  mlir::linalg::TilingPatterns<>
 
class  mlir::linalg::TilingPatterns< OpTy, OpTypes... >
 

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::bufferization
 
 mlir::linalg
 

Typedefs

using mlir::linalg::LinalgLoops = SmallVector< Operation *, 4 >
 
using mlir::linalg::ControlFusionFn = std::function< bool(const OpResult &producer, OpOperand &consumer)>
 Function type which is used to control when to stop fusion. More...
 
using mlir::linalg::AllocBufferCallbackFn = std::function< Optional< Value >(OpBuilder &b, memref::SubViewOp subView, ArrayRef< Value > boundingSubViewSize, DataLayout &layout)>
 Callback function type used to perform the allocation for the promoted subView. More...
 
using mlir::linalg::DeallocBufferCallbackFn = std::function< LogicalResult(OpBuilder &b, Value buffer)>
 Callback function type used to deallocate the buffers used to hold the promoted subview. More...
 
using mlir::linalg::CopyCallbackFn = std::function< LogicalResult(OpBuilder &b, Value src, Value dst)>
 Callback function type used to insert copy from original subview to subview of the promoted region for the read operands/subview of promoted region to original subview for the results. More...
 
using mlir::linalg::TileSizeComputationFunction = std::function< SmallVector< Value, 4 >(OpBuilder &, Operation *)>
 
using mlir::linalg::LoopIndexToRangeIndexMap = DenseMap< int, int >
 Creates a number of ranges equal to the number of non-zero in tileSizes. More...
 
using mlir::linalg::OptimizeCopyFn = std::function< LogicalResult(PatternRewriter &, tensor::PadOp, Value)>
 
using mlir::linalg::ControlSplitReductionFn = std::function< std::pair< int64_t, unsigned >(LinalgOp op)>
 Function signature to control reduction splitting. More...
 

Enumerations

enum  mlir::linalg::LinalgLoweringType { mlir::linalg::LinalgLoweringType::LibraryCall = 0, mlir::linalg::LinalgLoweringType::Loops = 1, mlir::linalg::LinalgLoweringType::AffineLoops = 2, mlir::linalg::LinalgLoweringType::ParallelLoops = 3 }
 Linalg lowering patterns. More...
 

Functions

void mlir::linalg::populatePadTensorTilingPatterns (RewritePatternSet &patterns, const LinalgTilingOptions &options)
 
void mlir::linalg::populateConvolutionVectorizationPatterns (RewritePatternSet &patterns, PatternBenefit benefit=1)
 Populate patterns for vectorizing low-D convolution ops. More...
 
void mlir::linalg::populateElementwiseToLinalgConversionPatterns (RewritePatternSet &patterns)
 Populate patterns that convert ElementwiseMappable ops to linalg parallel loops. More...
 
void mlir::linalg::populateSparseTensorRewriting (RewritePatternSet &patterns)
 Populate patterns that are only useful in the context of sparse tensors. More...
 
void mlir::linalg::populateElementwiseOpsFusionPatterns (RewritePatternSet &patterns, const ControlFusionFn &controlElementwiseOpFusion)
 Patterns for fusing linalg operation on tensors. More...
 
void mlir::linalg::populateFoldReshapeOpsByExpansionPatterns (RewritePatternSet &patterns, const ControlFusionFn &controlFoldingReshapes)
 Patterns to fold an expanding (collapsing) tensor_reshape operation with its producer (consumer) generic operation by expanding the dimensionality of the loop in the generic op. More...
 
void mlir::linalg::populateFoldReshapeOpsByCollapsingPatterns (RewritePatternSet &patterns, const ControlFusionFn &controlFoldingReshapes)
 Patterns to fold an expanding tensor.expand_shape operation with its producer generic operation by collapsing the dimensions of the generic op. More...
 
void mlir::linalg::populateConstantFoldLinalgOperations (RewritePatternSet &patterns, const ControlFusionFn &controlFn)
 Patterns to constant fold Linalg operations. More...
 
void mlir::linalg::populateFuseTensorPadWithProducerLinalgOpPatterns (RewritePatternSet &patterns)
 Pattern to fuse a tensor.pad operation with the producer of its source, if the producer is a linalg operation with all parallel iterator types. More...
 
void mlir::linalg::populateLinalgNamedOpConversionPatterns (RewritePatternSet &patterns)
 Patterns to convert from one named op to another. More...
 
void mlir::linalg::populateFoldUnitExtentDimsPatterns (RewritePatternSet &patterns)
 Patterns to fold unit-extent dimensions in operands/results of linalg ops on tensors. More...
 
void mlir::linalg::populateInlineConstantOperandsPatterns (RewritePatternSet &patterns)
 Patterns that are used to inline constant operands into linalg generic ops. More...
 
void mlir::linalg::populateBubbleUpExtractSliceOpPatterns (RewritePatternSet &patterns)
 Patterns that are used to bubble up extract slice op above linalg op. More...
 
FailureOr< TiledLinalgOpmlir::linalg::tileLinalgOp (RewriterBase &b, LinalgOp op, const LinalgTilingOptions &options)
 
void mlir::linalg::peelTiledLinalgOp (RewriterBase &rewriter, TiledLinalgOp &res, ArrayRef< int64_t > peeledLoops, LinalgTilingLoopType loopType)
 Peel the loops of a TiledLinalgOp. More...
 
FailureOr< TiledAndFusedLinalgOpsmlir::linalg::tileAndFuseLinalgOps (OpBuilder &builder, ArrayRef< LinalgOp > ops, const LinalgDependenceGraph &dependenceGraph, const LinalgTilingOptions &tilingOptions)
 
FailureOr< GenericOp > mlir::linalg::interchangeGenericOp (RewriterBase &rewriter, GenericOp genericOp, ArrayRef< unsigned > interchangeVector)
 Interchange the iterator_types and iterator_maps dimensions and adapts the index accesses of op. More...
 
FailureOr< GenericOp > mlir::linalg::generalizeNamedOp (RewriterBase &rewriter, LinalgOp namedOp)
 Create a GenericOp from the given named operation namedOp and replace namedOp. More...
 
FailureOr< PromotionInfomlir::linalg::promoteSubviewAsNewBuffer (OpBuilder &b, Location loc, memref::SubViewOp subView, const AllocBufferCallbackFn &allocationFn, DataLayout &layout)
 
FailureOr< LinalgOp > mlir::linalg::promoteSubViews (OpBuilder &b, LinalgOp op, const LinalgPromotionOptions &options)
 Promote the subViews into a new buffer allocated at the insertion point b. More...
 
LogicalResult mlir::linalg::vectorize (RewriterBase &builder, LinalgOp linalgOp)
 Emit a suitable vector form for a Linalg op with fully static shape. More...
 
LogicalResult mlir::linalg::vectorizeCopy (RewriterBase &builder, memref::CopyOp copyOp)
 Emit a suitable vector form for a Copy op with fully static shape. More...
 
FailureOr< LinalgLoopsmlir::linalg::linalgOpToLoops (PatternRewriter &rewriter, LinalgOp linalgOp)
 Emit a loop nest of scf.for with the proper body for linalgOp. More...
 
FailureOr< LinalgLoopsmlir::linalg::linalgOpToParallelLoops (PatternRewriter &rewriter, LinalgOp linalgOp)
 Emit a loop nest of scf.parallel with the proper body for linalgOp. More...
 
FailureOr< LinalgLoopsmlir::linalg::linalgOpToAffineLoops (PatternRewriter &rewriter, LinalgOp linalgOp)
 Emit a loop nest of affine.for with the proper body for linalgOp. More...
 
LogicalResult mlir::linalg::promoteSubviewsPrecondition (Operation *op, LinalgPromotionOptions options)
 Promote memref.subviews feeding linalg-on-buffers operations. More...
 
std::tuple< SmallVector< Range, 4 >, LoopIndexToRangeIndexMapmlir::linalg::makeTiledLoopRanges (RewriterBase &b, Location loc, AffineMap map, ValueRange allShapeSizes, ValueRange allTileSizes)
 
void mlir::linalg::transformIndexOps (RewriterBase &b, LinalgOp op, SmallVectorImpl< Value > &ivs, const LoopIndexToRangeIndexMap &loopIndexToRangeIndex)
 All indices returned by IndexOp should be invariant with respect to tiling. More...
 
RewritePatternSet mlir::linalg::getLinalgTilingCanonicalizationPatterns (MLIRContext *ctx)
 Canonicalization patterns relevant to apply after tiling patterns. More...
 
void mlir::linalg::populateLinalgTilingCanonicalizationPatterns (RewritePatternSet &patterns)
 
llvm::Optional< vector::CombiningKind > mlir::linalg::getCombinerOpKind (Operation *combinerOp)
 Return vector::CombiningKind for the given op. More...
 
void mlir::linalg::populateLinalgNamedOpsGeneralizationPatterns (RewritePatternSet &patterns, const LinalgTransformationFilter &filter=LinalgTransformationFilter())
 Linalg generalization patterns. More...
 
void mlir::linalg::populateDecomposeConvolutionPatterns (RewritePatternSet &patterns, const LinalgTransformationFilter &filter=LinalgTransformationFilter(), PatternBenefit benefit=1)
 Linalg decompose convolutions patterns. More...
 
FailureOr< SmallVector< Value > > mlir::linalg::rewriteAsPaddedOp (OpBuilder &b, LinalgOp opToPad, ArrayRef< int64_t > paddingDimensions, ArrayRef< Attribute > paddingValues, ArrayRef< bool > packPaddings, LinalgOp &paddedOp)
 Pad the iterator dimensions paddingDimensions of all opToPad operands to a static bounding box. More...
 
void mlir::linalg::populatePadOpVectorizationPatterns (RewritePatternSet &patterns, PatternBenefit baseBenefit=1)
 Populates patterns with patterns that vectorize tensor.pad. More...
 
LogicalResult mlir::linalg::applyStagedPatterns (Operation *op, ArrayRef< FrozenRewritePatternSet > stage1Patterns, const FrozenRewritePatternSet &stage2Patterns, function_ref< LogicalResult(Operation *)> stage3Lambda=nullptr)
 Helper function to allow applying rewrite patterns, interleaved with more global transformations, in a staged fashion: More...
 
void mlir::linalg::populateSplitReductionPattern (RewritePatternSet &patterns, const ControlSplitReductionFn &controlSplitReductionFn, const LinalgTransformationFilter &f=LinalgTransformationFilter())
 Patterns to apply splitReduction below. More...
 
FailureOr< LinalgOp > mlir::linalg::splitReduction (PatternRewriter &b, LinalgOp op, const ControlSplitReductionFn &controlSplitReductionFn, const LinalgTransformationFilter &f)
 Apply transformation to split the single linalg op reduction into a parallel and reduction dimension. More...