MLIR  16.0.0git
Functions
SplitReduction.cpp File Reference
#include <utility>
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tensor/Utils/Utils.h"
#include "mlir/IR/PatternMatch.h"
+ Include dependency graph for SplitReduction.cpp:

Go to the source code of this file.

Functions

static Attribute getNeutralElement (Operation *op)
 Return the identity numeric value associated to the give op. More...
 
static AffineMap scaleReductionDim (LinalgOp op, OpOperand &opOperand, unsigned reductionDimPos, int64_t reductionRatio)
 Rewrite f(i, j, k, ...) into f(i, j, k * ratio + kk, ...) TODO: Additional pattern to rewrite f(i, j, k * ratio + kk, ...) into f(i, j, k, kk, ...) with a proper ExpandShapeOp. More...
 
static AffineMap insertParallelDim (LinalgOp op, OpOperand &opOperand, unsigned reductionDimPos, int64_t size)
 

Function Documentation

◆ getNeutralElement()

static Attribute getNeutralElement ( Operation op)
static

Return the identity numeric value associated to the give op.

Definition at line 30 of file SplitReduction.cpp.

References mlir::Operation::getContext(), mlir::Operation::getResult(), mlir::Value::getType(), getZero(), max(), and min().

Referenced by mlir::linalg::splitReduction(), and mlir::linalg::splitReductionByScaling().

◆ insertParallelDim()

static AffineMap insertParallelDim ( LinalgOp  op,
OpOperand opOperand,
unsigned  reductionDimPos,
int64_t  size 
)
static

◆ scaleReductionDim()

static AffineMap scaleReductionDim ( LinalgOp  op,
OpOperand opOperand,
unsigned  reductionDimPos,
int64_t  reductionRatio 
)
static

Rewrite f(i, j, k, ...) into f(i, j, k * ratio + kk, ...) TODO: Additional pattern to rewrite f(i, j, k * ratio + kk, ...) into f(i, j, k, kk, ...) with a proper ExpandShapeOp.

This is probably better done as a transform to enable better vectorization.

Definition at line 272 of file SplitReduction.cpp.

References mlir::AffineMap::compose(), mlir::getAffineDimExpr(), mlir::AffineMap::getMultiDimIdentityMap(), mlir::AffineMap::replace(), and mlir::AffineMap::shiftDims().

Referenced by mlir::linalg::splitReductionByScaling().