MLIR  19.0.0git
Macros | Functions
LowerVectorContract.cpp File Reference
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Arith/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/Tensor/IR/Tensor.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/LoweringPatterns.h"
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/IR/BuiltinAttributeInterfaces.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/VectorInterfaces.h"
#include "mlir/Support/LogicalResult.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "vector-contract-lowering"
 

Functions

static std::optional< int64_t > getResultIndex (AffineMap map, int64_t index)
 
static SmallVector< AttributeadjustIter (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)
 
static std::optional< ValuecreateContractArithOp (Location loc, Value x, Value y, Value acc, vector::CombiningKind kind, PatternRewriter &rewriter, bool isInt, Value mask=Value())
 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 std::optional< unsigned > getDimPosition (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...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "vector-contract-lowering"

Definition at line 36 of file LowerVectorContract.cpp.

Function Documentation

◆ adjustIter()

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

Definition at line 55 of file LowerVectorContract.cpp.

References mlir::detail::enumerate().

◆ adjustMap()

static AffineMap adjustMap ( AffineMap  map,
int64_t  index,
PatternRewriter rewriter 
)
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 196 of file LowerVectorContract.cpp.

References mlir::OpBuilder::create().

◆ createContractArithOp()

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

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

Definition at line 134 of file LowerVectorContract.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 205 of file LowerVectorContract.cpp.

References mlir::OpBuilder::create().

◆ getDimPosition()

static std::optional<unsigned> getDimPosition ( AffineMap  map,
unsigned  dim 
)
static

Look for a given dimension in an affine map and return its position.

Return std::nullopt if the dimension is not in the map results.

Definition at line 186 of file LowerVectorContract.cpp.

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

◆ getReductionIndex()

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

Return the positions of the reductions in the given map.

Definition at line 174 of file LowerVectorContract.cpp.

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

◆ getResultIndex()

static std::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