MLIR 23.0.0git
VectorizationState Struct Reference

Contains the vectorization state and related methods used across the vectorization process of a given operation. More...

Public Member Functions

 VectorizationState (RewriterBase &rewriter)
LogicalResult initState (RewriterBase &rewriter, LinalgOp linalgOp, ArrayRef< int64_t > inputVectorSizes, ArrayRef< bool > inputScalableVecDims, bool assumeDynamicDimsMatchVecSizes=false)
 Initializes the vectorization state, including the computation of the canonical vector shape for vectorization.
ArrayRef< int64_tgetCanonicalVecShape () const
 Returns the canonical vector shape used to vectorize the iteration space.
ArrayRef< boolgetScalableVecDims () const
 Returns the vector dimensions that are scalable in the canonical vector shape.
VectorType getCanonicalVecType (Type elementType, std::optional< AffineMap > dimPermutation=std::nullopt) const
 Returns a vector type of the provided elementType with the canonical vector shape and the corresponding fixed/scalable dimensions bit.
OperationmaskOperation (RewriterBase &rewriter, Operation *opToMask, LinalgOp linalgOp, std::optional< AffineMap > maybeIndexingMap=std::nullopt)
 Masks an operation with the canonical vector mask if the operation needs masking.

Detailed Description

Contains the vectorization state and related methods used across the vectorization process of a given operation.

Definition at line 220 of file Vectorization.cpp.

Constructor & Destructor Documentation

◆ VectorizationState()

VectorizationState::VectorizationState ( RewriterBase & rewriter)
inline

Definition at line 221 of file Vectorization.cpp.

Member Function Documentation

◆ getCanonicalVecShape()

ArrayRef< int64_t > VectorizationState::getCanonicalVecShape ( ) const
inline

Returns the canonical vector shape used to vectorize the iteration space.

Definition at line 231 of file Vectorization.cpp.

◆ getCanonicalVecType()

VectorType VectorizationState::getCanonicalVecType ( Type elementType,
std::optional< AffineMap > dimPermutation = std::nullopt ) const
inline

Returns a vector type of the provided elementType with the canonical vector shape and the corresponding fixed/scalable dimensions bit.

If dimPermutation is provided, the canonical vector dimensions are permuted accordingly.

Definition at line 241 of file Vectorization.cpp.

References mlir::applyPermutationMap(), and vectorShape().

◆ getScalableVecDims()

ArrayRef< bool > VectorizationState::getScalableVecDims ( ) const
inline

Returns the vector dimensions that are scalable in the canonical vector shape.

Definition at line 235 of file Vectorization.cpp.

◆ initState()

LogicalResult VectorizationState::initState ( RewriterBase & rewriter,
LinalgOp linalgOp,
ArrayRef< int64_t > inputVectorSizes,
ArrayRef< bool > inputScalableVecDims,
bool assumeDynamicDimsMatchVecSizes = false )

Initializes the vectorization state, including the computation of the canonical vector shape for vectorization.

Definition at line 382 of file Vectorization.cpp.

References initState(), mlir::OpBuilder::setInsertionPoint(), and success().

Referenced by initState().

◆ maskOperation()

Operation * VectorizationState::maskOperation ( RewriterBase & rewriter,
Operation * opToMask,
LinalgOp linalgOp,
std::optional< AffineMap > maybeIndexingMap = std::nullopt )

Masks an operation with the canonical vector mask if the operation needs masking.

Returns the masked operation or the original operation if masking is not needed. If provided, the canonical mask for this operation is permuted using maybeIndexingMap.

Definition at line 514 of file Vectorization.cpp.

References mlir::Builder::getBoolArrayAttr(), mlir::AffineMap::getPermutationMap(), mlir::AffineMap::getResult(), mlir::Operation::getResults(), mlir::vector::maskOperation(), maskOperation(), mlir::RewriterBase::modifyOpInPlace(), and mlir::RewriterBase::replaceAllUsesExcept().

Referenced by maskOperation().


The documentation for this struct was generated from the following file: