13 #ifndef MLIR_DIALECT_AFFINE_UTILS_H 14 #define MLIR_DIALECT_AFFINE_UTILS_H 22 class AffineParallelOp;
25 class PostDominanceInfo;
223 Operation *postDomOpFilter =
nullptr,
bool allowNonDereferencingOps =
false,
224 bool replaceInDeallocOp =
false);
236 bool allowNonDereferencingOps =
false);
249 unsigned numSymbolicOperands);
324 #endif // MLIR_DIALECT_AFFINE_UTILS_H Include the generated interface declarations.
Optional< SmallVector< Value, 8 > > expandAffineMap(OpBuilder &builder, Location loc, AffineMap affineMap, ValueRange operands)
Create a sequence of operations that implement the affineMap applied to the given operands (as it it ...
Operation is a basic unit of execution within MLIR.
void vectorizeAffineLoops(Operation *parentOp, llvm::DenseSet< Operation *, DenseMapInfo< Operation *>> &loops, ArrayRef< int64_t > vectorSizes, ArrayRef< int64_t > fastestVaryingPattern, const ReductionLoopMap &reductionLoops=ReductionLoopMap())
Vectorizes affine loops in 'loops' using the n-D vectorization factors in 'vectorSizes'.
A class for computing basic dominance information.
LogicalResult normalizeMemRef(memref::AllocOp *op)
Rewrites the memref defined by this alloc op to have an identity layout map and updates all its index...
DenseMap< Operation *, SmallVector< LoopReduction, 2 > > ReductionLoopMap
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
This class represents an efficient way to signal success or failure.
This class provides support for representing a failure result, or a valid value of type T...
Holds parameters to perform n-D vectorization on a single loop nest.
FailureOr< SmallVector< Value > > delinearizeIndex(OpBuilder &b, Location loc, Value linearIndex, ArrayRef< Value > basis)
Generate the IR to delinearize linearIndex given the basis and return the multi-index.
AffineExpr substWithMin(AffineExpr e, AffineExpr dim, AffineExpr min, AffineExpr max, bool positivePath=true)
Traverse e and return an AffineExpr where all occurrences of dim have been replaced by either: ...
Base type for affine expression.
DenseMap< Operation *, unsigned > loopToVectorDim
A multi-dimensional affine map Affine map's are immutable like Type's, and they are uniqued...
LogicalResult hoistAffineIfOp(AffineIfOp ifOp, bool *folded=nullptr)
Hoists out affine.if/else to as high as possible, i.e., past all invariant affine.fors/parallel's.
static Value min(ImplicitLocOpBuilder &builder, Value value, Value bound)
LogicalResult normalizeAffineFor(AffineForOp op)
Normalize an affine.for op.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
MemRefType normalizeMemRefType(MemRefType memrefType, OpBuilder builder, unsigned numSymbolicOperands)
Uses the old memref type map layout and computes the new memref type to have a new shape and a layout...
LogicalResult affineParallelize(AffineForOp forOp, ArrayRef< LoopReduction > parallelReductions={})
Replaces a parallel affine.for op with a 1-d affine.parallel op.
LogicalResult vectorizeAffineLoopNest(std::vector< SmallVector< AffineForOp, 2 >> &loops, const VectorizationStrategy &strategy)
External utility to vectorize affine loops from a single loop nest using an n-D vectorization strateg...
DivModValue getDivMod(OpBuilder &b, Location loc, Value lhs, Value rhs)
Create IR to calculate (div lhs, rhs) and (mod lhs, rhs).
SmallVector< int64_t, 8 > vectorSizes
Operation * createComposedAffineApplyOp(OpBuilder &builder, Location loc, ArrayRef< Value > operands, ArrayRef< Operation *> affineApplyOps, SmallVectorImpl< Value > *results)
Creates and inserts into 'builder' a new AffineApplyOp, with the number of its results equal to the n...
void createAffineComputationSlice(Operation *opInst, SmallVectorImpl< AffineApplyOp > *sliceOps)
Given an operation, inserts one or more single result affine apply operations, results of which are e...
void normalizeAffineParallel(AffineParallelOp op)
Normalize a affine.parallel op so that lower bounds are 0 and steps are 1.
void affineScalarReplace(func::FuncOp f, DominanceInfo &domInfo, PostDominanceInfo &postDomInfo)
Replace affine store and load accesses by scalars by forwarding stores to loads and eliminate invaria...
Holds the result of (div a, b) and (mod a, b).
Value expandAffineExpr(OpBuilder &builder, Location loc, AffineExpr expr, ValueRange dimValues, ValueRange symbolValues)
Emit code that computes the given affine expression using standard arithmetic operations applied to t...
This class helps build Operations.
This class provides an abstraction over the different types of ranges over Values.
ReductionLoopMap reductionLoops
A class for computing basic postdominance information.
static Value max(ImplicitLocOpBuilder &builder, Value value, Value bound)
LogicalResult replaceAllMemRefUsesWith(Value oldMemRef, Value newMemRef, ArrayRef< Value > extraIndices={}, AffineMap indexRemap=AffineMap(), ArrayRef< Value > extraOperands={}, ArrayRef< Value > symbolOperands={}, Operation *domOpFilter=nullptr, Operation *postDomOpFilter=nullptr, bool allowNonDereferencingOps=false, bool replaceInDeallocOp=false)
Replaces all "dereferencing" uses of oldMemRef with newMemRef while optionally remapping the old memr...