|
MLIR 24.0.0git
|
#include "mlir/Dialect/Vector/Transforms/VectorTransforms.h"#include "mlir/Dialect/Arith/IR/Arith.h"#include "mlir/Dialect/Arith/Utils/Utils.h"#include "mlir/Dialect/MemRef/IR/MemRef.h"#include "mlir/Dialect/SCF/IR/SCF.h"#include "mlir/Dialect/Utils/IndexingUtils.h"#include "mlir/Dialect/Utils/StructuredOpsUtils.h"#include "mlir/Dialect/Vector/IR/VectorOps.h"#include "mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h"#include "mlir/Dialect/Vector/Utils/VectorUtils.h"#include "mlir/IR/BuiltinTypes.h"#include "mlir/IR/Location.h"#include "mlir/IR/Matchers.h"#include "mlir/IR/PatternMatch.h"#include "mlir/IR/TypeUtilities.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallVectorExtras.h"#include "llvm/Support/FormatVariadic.h"#include <cassert>#include <cstdint>#include <functional>#include <optional>#include "mlir/Dialect/Vector/Transforms/VectorTransformsEnums.cpp.inc"Go to the source code of this file.
Classes | |
| class | DropInnerMostUnitDimsTransferRead |
| Drop inner most contiguous unit dimensions from transfer_read operand. More... | |
| class | DropInnerMostUnitDimsTransferWrite |
| Drop inner most contiguous unit dimensions from transfer_write operand. E.g., vector.transfer_write arg1, arg0[c0, arg2, c0, c0, c0] {in_bounds = [true, true, true, true, true]} : vector<1x16x16x1x1xf32>, memref<1x512x16x1x1xf32> More... | |
| struct | CanonicalizeContractMatmulToMMT |
| Canonicalization of a vector.contract a, b, c with row-major matmul semantics to a contraction suitable for MMT (matrix matrix multiplication with the RHS transposed) lowering. More... | |
| struct | FoldArithExtIntoContractionOp< ExtOp > |
| Pattern to fold arithmetic extensions on floating point data types into vector contraction operations. linalg.matmul introduces arithmetic extensions on its operands. Please mlir snippets below for more details. More... | |
| struct | ChainedReduction |
| Pattern to fold chained reduction to a series of vector additions and a final reduction. This form should require fewer subgroup operations. More... | |
| struct | DropUnitDimFromElementwiseOps |
| For vectors with at least one unit dim, replaces: elementwise(a, b) with: sc_a = shape_cast(a) sc_b = shape_cast(b) res = elementwise(sc_a, sc_b) return shape_cast(res) The newly inserted shape_cast Ops fold (before elementwise Op) and then restore (after elementwise Op) the unit dim. Vectors a and b are required to be rank > 1. More... | |
| struct | DropUnitDimsFromTransposeOp |
| A pattern to drop unit dims from vector.transpose. More... | |
| struct | DropUnitDimsFromScfForOp |
| A pattern to drop unit dims from the iter_args of an scf.for. More... | |
| struct | ReduceRedundantZero |
| Pattern to eliminate redundant zero-constants added to reduction operands. It's enough for there to be one initial zero value, so we can eliminate the extra ones that feed into vector.reduction <add>. These get created by the ChainedReduction pattern. More... | |
| struct | BreakDownVectorReduction |
| Example: More... | |
Macros | |
| #define | DEBUG_TYPE "vector-to-vector" |
Functions | |
| static Operation * | createWithProperties (OpBuilder &builder, Operation *op, ValueRange operands, TypeRange types) |
| static std::optional< int64_t > | getResultIndex (AffineMap map, int64_t index) |
| static FailureOr< size_t > | getTransferFoldableInnerUnitDims (MemRefType srcType, VectorType vectorType) |
| Returns the number of dims can be folded away from transfer ops. It returns a failure if it can not determine the number of dims to be folded. | |
| static VectorType | dropNonScalableUnitDimFromType (VectorType inVecTy) |
Variables | |
| *B * | Example |
| Fold mulf(tr(broadcast(A)), broadcast(B)) into `vector.outerproduct(A,. | |
| *B | rhsBcast |
| *B | rhs |
| *B vector< 4xi32 > **Supports only to broadcasts The following cases are not supported * | ex1 |
| #define DEBUG_TYPE "vector-to-vector" |
Definition at line 39 of file VectorTransforms.cpp.
|
static |
Definition at line 44 of file VectorTransforms.cpp.
References mlir::OpBuilder::create(), mlir::Operation::getDiscardableAttrDictionary(), mlir::Operation::getLoc(), mlir::Operation::getName(), mlir::Operation::getPropertiesAsAttribute(), and mlir::OperationState::propertiesAttr.
Referenced by DropUnitDimFromElementwiseOps::matchAndRewrite().
|
static |
Definition at line 1976 of file VectorTransforms.cpp.
Referenced by DropUnitDimFromElementwiseOps::matchAndRewrite(), DropUnitDimsFromScfForOp::matchAndRewrite(), and DropUnitDimsFromTransposeOp::matchAndRewrite().
Definition at line 53 of file VectorTransforms.cpp.
References mlir::AffineMap::getDimPosition(), and mlir::AffineMap::getNumResults().
|
static |
Returns the number of dims can be folded away from transfer ops. It returns a failure if it can not determine the number of dims to be folded.
Ex 1: returns "2" if srcType is memref<512x16x1x1xf32> and vectorType is vector<16x16x1x1xf32> (there two inner most dims can be dropped by memref.subview ops)
Ex 2: returns "1" if srcType is memref<512x16x1x1xf32> with [8192, 16, 8, 1] strides and vectorType is vector<16x16x1x1xf32> (only the inner most unit dim of srcType can be dropped)
Ex 3: return "0" if srcType is memref<512x16x1x1xf32> and vectorType is vector<16x16x1x[1]xf32> (the most inner dim in vectorType is not a unit dim (it's a "scalable unit")
Definition at line 1575 of file VectorTransforms.cpp.
References result.
| * B vector<4xi32>* * Supports only to broadcasts The following cases are not supported* ex1 |
Definition at line 2311 of file VectorTransforms.cpp.
| * B* Example |
Fold mulf(tr(broadcast(A)), broadcast(B)) into `vector.outerproduct(A,.
Definition at line 2300 of file VectorTransforms.cpp.
| * B rhs |
Definition at line 2308 of file VectorTransforms.cpp.
Referenced by CanonicalizeContractMatmulToMMT::matchAndRewrite(), and mlir::sparse_tensor::ir_detail::DimLvlExpr::unpackBinop().
| * B rhsBcast |
Definition at line 2304 of file VectorTransforms.cpp.