|
MLIR 24.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, bool assumeDynamicDimsMatchVecSizes=false) |
| Initializes the vectorization state, including the computation of the canonical vector shape for vectorization. | |
| ArrayRef< int64_t > | getCanonicalVecShape () const |
| Returns the canonical vector shape used to vectorize the iteration space. | |
| ArrayRef< bool > | getScalableVecDims () 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. | |
| 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. | |
| Value | getOrCreateMaskFor (RewriterBase &rewriter, LinalgOp linalgOp, std::optional< AffineMap > maybeMaskingMap=std::nullopt) |
| Create or retrieve an existing mask value for the canonical vector iteration space. | |
Contains the vectorization state and related methods used across the vectorization process of a given operation.
Definition at line 206 of file Vectorization.cpp.
|
inline |
Definition at line 207 of file Vectorization.cpp.
Returns the canonical vector shape used to vectorize the iteration space.
Definition at line 217 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 227 of file Vectorization.cpp.
References mlir::applyPermutationMap(), and vectorShape().
Referenced by getOrCreateMaskFor().
| Value VectorizationState::getOrCreateMaskFor | ( | RewriterBase & | rewriter, |
| LinalgOp | linalgOp, | ||
| std::optional< AffineMap > | maybeMaskingMap = std::nullopt ) |
Create or retrieve an existing mask value for the canonical vector iteration space.
If maybeMaskingMap the mask is permuted using that permutation map. If a new mask is created, it will be cached for future users. Returns a null value if no mask is needed.
Definition at line 410 of file Vectorization.cpp.
References mlir::applyPermutationMap(), getCanonicalVecType(), mlir::Builder::getContext(), mlir::Builder::getI1Type(), mlir::AffineMap::getMultiDimIdentityMap(), and getOrCreateMaskFor().
Referenced by getOrCreateMaskFor(), and maskOperation().
Returns the vector dimensions that are scalable in the canonical vector shape.
Definition at line 221 of file Vectorization.cpp.
| 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 368 of file Vectorization.cpp.
References initState(), mlir::OpBuilder::setInsertionPoint(), and success().
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 488 of file Vectorization.cpp.
References mlir::Builder::getBoolArrayAttr(), getOrCreateMaskFor(), mlir::AffineMap::getPermutationMap(), mlir::AffineMap::getResult(), mlir::Operation::getResults(), mlir::vector::maskOperation(), maskOperation(), mlir::RewriterBase::modifyOpInPlace(), and mlir::RewriterBase::replaceAllUsesExcept().
Referenced by maskOperation().