MLIR  15.0.0git
Classes | Namespaces | Macros | Functions
VectorTransforms.cpp File Reference
#include "mlir/Dialect/Vector/Transforms/VectorTransforms.h"
#include <type_traits>
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Arithmetic/Utils/Utils.h"
#include "mlir/Dialect/Linalg/IR/Linalg.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/Utils/VectorUtils.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/VectorInterfaces.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
+ Include dependency graph for VectorTransforms.cpp:

Go to the source code of this file.

Classes

struct  TransferReadToVectorLoadLowering
 Progressive lowering of transfer_read. More...
 
struct  VectorLoadToMemrefLoadLowering
 Replace a 0-d vector.load with a memref.load + vector.broadcast. More...
 
struct  VectorStoreToMemrefStoreLowering
 Replace a 0-d vector.store with a vector.extractelement + memref.store. More...
 
struct  TransferWriteToVectorStoreLowering
 Progressive lowering of transfer_write. More...
 
struct  BubbleDownVectorBitCastForExtract
 
struct  BubbleDownBitCastForStridedSliceExtract
 
struct  BubbleUpBitCastForStridedSliceInsert
 
struct  MaterializeTransferMask< ConcreteOp >
 
class  VectorCreateMaskOpConversion
 Conversion pattern for a vector.create_mask (0-D and 1-D only). More...
 
class  DropInnerMostUnitDims
 

Namespaces

 mlir
 TODO: Remove this file when SCCP and integer range analysis have been ported to the new framework.
 

Macros

#define DEBUG_TYPE   "vector-to-vector"
 

Functions

static Optional< int64_t > getResultIndex (AffineMap map, int64_t index)
 
static SmallVector< Attribute, 4 > adjustIter (ArrayAttr iteratorTypes, int64_t index)
 
static AffineMap adjustMap (AffineMap map, int64_t index, PatternRewriter &rewriter)
 
static Value reshapeLoad (Location loc, Value val, VectorType type, int64_t index, int64_t pos, PatternRewriter &rewriter)
 
static Value reshapeStore (Location loc, Value val, Value result, VectorType type, int64_t index, int64_t pos, PatternRewriter &rewriter)
 
template<typename IntType >
static SmallVector< IntType, 4 > extractVector (ArrayAttr arrayAttr)
 
static Optional< ValuecreateContractArithOp (Location loc, Value x, Value y, Value acc, vector::CombiningKind kind, PatternRewriter &rewriter, bool isInt)
 Helper to create arithmetic operation associated with a kind of contraction. More...
 
static SmallVector< int64_t > getReductionIndex (AffineMap map, ArrayAttr iteratorTypes)
 Return the positions of the reductions in the given map. More...
 
static llvm::Optional< unsignedgetDimPosition (AffineMap map, unsigned dim)
 Look for a given dimension in an affine map and return its position. More...
 
static Value createAdd (Location loc, Value x, Value y, bool isInt, PatternRewriter &rewriter)
 Creates an AddIOp if isInt is true otherwise create an arith::AddFOp using operands x and y. More...
 
static Value createMul (Location loc, Value x, Value y, bool isInt, PatternRewriter &rewriter)
 Creates a MulIOp if isInt is true otherwise create an MulFOp using operands x andy`. More...
 
static SmallVector< int64_t, 4 > getIntValueVector (ArrayAttr arrayAttr)
 
static Value buildVectorComparison (PatternRewriter &rewriter, Operation *op, bool force32BitVectorIndices, int64_t dim, Value b, Value *off=nullptr)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "vector-to-vector"

Definition at line 39 of file VectorTransforms.cpp.

Function Documentation

◆ adjustIter()

static SmallVector<Attribute, 4> adjustIter ( ArrayAttr  iteratorTypes,
int64_t  index 
)
static

Definition at line 55 of file VectorTransforms.cpp.

References mlir::detail::enumerate().

◆ adjustMap()

static AffineMap adjustMap ( AffineMap  map,
int64_t  index,
PatternRewriter rewriter 
)
static

◆ buildVectorComparison()

static Value buildVectorComparison ( PatternRewriter rewriter,
Operation op,
bool  force32BitVectorIndices,
int64_t  dim,
Value  b,
Value off = nullptr 
)
static

◆ createAdd()

static Value createAdd ( Location  loc,
Value  x,
Value  y,
bool  isInt,
PatternRewriter rewriter 
)
static

Creates an AddIOp if isInt is true otherwise create an arith::AddFOp using operands x and y.

Definition at line 1310 of file VectorTransforms.cpp.

References mlir::OpBuilder::create().

◆ createContractArithOp()

static Optional<Value> createContractArithOp ( Location  loc,
Value  x,
Value  y,
Value  acc,
vector::CombiningKind  kind,
PatternRewriter rewriter,
bool  isInt 
)
static

Helper to create arithmetic operation associated with a kind of contraction.

Definition at line 148 of file VectorTransforms.cpp.

◆ createMul()

static Value createMul ( Location  loc,
Value  x,
Value  y,
bool  isInt,
PatternRewriter rewriter 
)
static

Creates a MulIOp if isInt is true otherwise create an MulFOp using operands x andy`.

Definition at line 1319 of file VectorTransforms.cpp.

References mlir::OpBuilder::create().

◆ extractVector()

template<typename IntType >
static SmallVector<IntType, 4> extractVector ( ArrayAttr  arrayAttr)
static

Definition at line 141 of file VectorTransforms.cpp.

◆ getDimPosition()

static llvm::Optional<unsigned> getDimPosition ( AffineMap  map,
unsigned  dim 
)
static

◆ getIntValueVector()

static SmallVector<int64_t, 4> getIntValueVector ( ArrayAttr  arrayAttr)
static

◆ getReductionIndex()

static SmallVector<int64_t> getReductionIndex ( AffineMap  map,
ArrayAttr  iteratorTypes 
)
static

Return the positions of the reductions in the given map.

Definition at line 180 of file VectorTransforms.cpp.

References mlir::AffineMap::getDimPosition(), mlir::AffineMap::getNumResults(), and mlir::isReductionIterator().

◆ getResultIndex()

static Optional<int64_t> getResultIndex ( AffineMap  map,
int64_t  index 
)
static

◆ reshapeLoad()

static Value reshapeLoad ( Location  loc,
Value  val,
VectorType  type,
int64_t  index,
int64_t  pos,
PatternRewriter rewriter 
)
static

◆ reshapeStore()

static Value reshapeStore ( Location  loc,
Value  val,
Value  result,
VectorType  type,
int64_t  index,
int64_t  pos,
PatternRewriter rewriter 
)
static

Variable Documentation

◆ strRef

StringRef strRef