MLIR
20.0.0git
|
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) |
Initializes the vectorization state, including the computation of the canonical vector shape for vectorization. More... | |
ArrayRef< int64_t > | getCanonicalVecShape () const |
Returns the canonical vector shape used to vectorize the iteration space. More... | |
ArrayRef< bool > | getScalableVecDims () const |
Returns the vector dimensions that are scalable in the canonical vector shape. More... | |
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. More... | |
Operation * | 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. More... | |
Contains the vectorization state and related methods used across the vectorization process of a given operation.
Definition at line 186 of file Vectorization.cpp.
|
inline |
Definition at line 187 of file Vectorization.cpp.
|
inline |
Returns the canonical vector shape used to vectorize the iteration space.
Definition at line 196 of file Vectorization.cpp.
|
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 206 of file Vectorization.cpp.
References mlir::get(), and vectorShape().
|
inline |
Returns the vector dimensions that are scalable in the canonical vector shape.
Definition at line 200 of file Vectorization.cpp.
LogicalResult VectorizationState::initState | ( | RewriterBase & | rewriter, |
LinalgOp | linalgOp, | ||
ArrayRef< int64_t > | inputVectorSizes, | ||
ArrayRef< bool > | inputScalableVecDims | ||
) |
Initializes the vectorization state, including the computation of the canonical vector shape for vectorization.
Definition at line 339 of file Vectorization.cpp.
References initState(), LDBG, and mlir::OpBuilder::setInsertionPoint().
Referenced by initState().
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 456 of file Vectorization.cpp.
References mlir::detail::enumerate(), mlir::Operation::getResults(), LDBG, mlir::vector::maskOperation(), and mlir::RewriterBase::replaceAllUsesExcept().