MLIR  20.0.0git
Classes | Macros | Functions
LoopUtils.cpp File Reference
#include "mlir/Dialect/Affine/LoopUtils.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>

Go to the source code of this file.

Classes

struct  StrideInfo
 

Macros

#define DEBUG_TYPE   "loop-utils"
 

Functions

static void getCleanupLoopLowerBound (AffineForOp forOp, unsigned unrollFactor, AffineMap &cleanupLbMap, SmallVectorImpl< Value > &cleanupLbOperands)
 Computes the cleanup loop lower bound of the loop being unrolled with the specified unroll factor; this bound will also be upper bound of the main part of the unrolled loop. More...
 
static void replaceIterArgsAndYieldResults (AffineForOp forOp)
 Helper to replace uses of loop carried values (iter_args) and loop yield values while promoting single iteration affine.for ops. More...
 
static AffineForOp generateShiftedLoop (AffineMap lbMap, AffineMap ubMap, const std::vector< std::pair< uint64_t, ArrayRef< Operation * >>> &opGroupQueue, unsigned offset, AffineForOp srcForOp, OpBuilder b)
 Generates an affine.for op with the specified lower and upper bounds while generating the right IV remappings to realize shifts for operations in its body. More...
 
static LogicalResult checkIfHyperRectangular (MutableArrayRef< AffineForOp > input)
 Checks whether a loop nest is hyper-rectangular or not. More...
 
template<typename t >
static LogicalResult performPreTilingChecks (MutableArrayRef< AffineForOp > input, ArrayRef< t > tileSizes)
 Check if the input nest is supported for tiling and whether tiling would be legal or not. More...
 
static void moveLoopBodyImpl (AffineForOp src, AffineForOp dest, Block::iterator loc)
 Move the loop body of AffineForOp 'src' from 'src' into the specified location in destination's body, ignoring the terminator. More...
 
static void moveLoopBody (AffineForOp src, AffineForOp dest)
 Move the loop body of AffineForOp 'src' from 'src' to the start of dest body. More...
 
static void constructTiledLoopNest (MutableArrayRef< AffineForOp > origLoops, AffineForOp rootAffineForOp, unsigned width, MutableArrayRef< AffineForOp > tiledLoops)
 Constructs tiled loop nest, without setting the loop bounds and move the body of the original loop nest to the tiled loop nest. More...
 
static void setIntraTileBoundsParametric (OpBuilder &b, AffineForOp origLoop, AffineForOp newInterTileLoop, AffineForOp newIntraTileLoop, Value tileSize)
 Set lower and upper bounds of intra-tile loops for parametric tiling. More...
 
static void setInterTileBoundsParametric (OpBuilder &b, AffineForOp origLoop, AffineForOp newLoop, Value tileSize)
 Set lower and upper bounds of inter-tile loops for parametric tiling. More...
 
static void constructParametricallyTiledIndexSetHyperRect (MutableArrayRef< AffineForOp > origLoops, MutableArrayRef< AffineForOp > newLoops, ArrayRef< Value > tileSizes)
 Constructs and sets new loop bounds after tiling for the case of hyper-rectangular index sets, where the bounds of one dimension do not depend on other dimensions and tiling parameters are captured from SSA values. More...
 
static void constructTiledIndexSetHyperRect (MutableArrayRef< AffineForOp > origLoops, MutableArrayRef< AffineForOp > newLoops, ArrayRef< unsigned > tileSizes)
 Constructs and sets new loop bounds after tiling for the case of hyper-rectangular index sets, where the bounds of one dimension do not depend on other dimensions. More...
 
static void generateUnrolledLoop (Block *loopBodyBlock, Value forOpIV, uint64_t unrollFactor, function_ref< Value(unsigned, Value, OpBuilder)> ivRemapFn, function_ref< void(unsigned, Operation *, OpBuilder)> annotateFn, ValueRange iterArgs, ValueRange yieldedValues)
 Generates unrolled copies of AffineForOp 'loopBodyBlock', with associated 'forOpIV' by 'unrollFactor', calling 'ivRemapFn' to remap 'forOpIV' for each unrolled body. More...
 
static LogicalResult generateCleanupLoopForUnroll (AffineForOp forOp, uint64_t unrollFactor)
 Helper to generate cleanup loop for unroll or unroll-and-jam when the trip count is not a multiple of unrollFactor. More...
 
static bool areInnerBoundsInvariant (AffineForOp forOp)
 Check if all control operands of all loops are defined outside of forOp and return false if not. More...
 
static bool checkLoopInterchangeDependences (const std::vector< SmallVector< DependenceComponent, 2 >> &depCompsVec, ArrayRef< AffineForOp > loops, ArrayRef< unsigned > loopPermMap)
 
static void augmentMapAndBounds (OpBuilder &b, Value iv, AffineMap *map, SmallVector< Value, 4 > *operands, int64_t offset=0)
 
static SmallVector< AffineForOp, 8 > stripmineSink (AffineForOp forOp, uint64_t factor, ArrayRef< AffineForOp > targets)
 
template<typename SizeType >
static AffineForOp stripmineSink (AffineForOp forOp, SizeType factor, AffineForOp target)
 
static void findHighestBlockForPlacement (const MemRefRegion &region, Block &block, Block::iterator &begin, Block::iterator &end, Block **copyPlacementBlock, Block::iterator *copyInPlacementStart, Block::iterator *copyOutPlacementStart)
 Given a memref region, determine the lowest depth at which transfers can be placed for it, and return the corresponding block, start and end positions in the block for placing incoming (read) and outgoing (write) copies respectively. More...
 
static void getMultiLevelStrides (const MemRefRegion &region, ArrayRef< int64_t > bufferShape, SmallVectorImpl< StrideInfo > *strideInfos)
 Returns striding information for a copy/transfer of this region with potentially multiple striding levels from outermost to innermost. More...
 
static AffineForOp generatePointWiseCopy (Location loc, Value memref, Value fastMemRef, ArrayRef< AffineMap > lbMaps, ArrayRef< Value > lbOperands, ArrayRef< AffineMap > ubMaps, ArrayRef< Value > ubOperands, ArrayRef< AffineExpr > fastBufOffsets, bool isCopyOut, OpBuilder b)
 Generates a point-wise copy from/to ‘memref’ to/from ‘fastMemRef’ and returns the outermost AffineForOp of the copy loop nest. More...
 
static InFlightDiagnostic LLVM_ATTRIBUTE_UNUSED emitRemarkForBlock (Block &block)
 
static LogicalResult generateCopy (const MemRefRegion &region, Block *block, Block::iterator begin, Block::iterator end, Block *copyPlacementBlock, Block::iterator copyInPlacementStart, Block::iterator copyOutPlacementStart, const AffineCopyOptions &copyOptions, DenseMap< Value, Value > &fastBufferMap, DenseSet< Operation * > &copyNests, uint64_t *sizeInBytes, Block::iterator *nBegin, Block::iterator *nEnd)
 Creates a buffer in the faster memory space for the specified memref region; generates a copy from the lower memory space to this one, and replaces all loads/stores in the block range [‘begin’, ‘end’) of ‘block’ to load/store from that buffer. More...
 
static bool getFullMemRefAsRegion (Operation *op, unsigned numParamLoopIVs, MemRefRegion *region)
 Construct the memref region to just include the entire memref. More...
 
static void gatherLoopsInBlock (Block *block, unsigned currLoopDepth, std::vector< SmallVector< AffineForOp, 2 >> &depthToLoops)
 Gathers all AffineForOps in 'block' at 'currLoopDepth' in 'depthToLoops'. More...
 
static AffineIfOp createSeparationCondition (MutableArrayRef< AffineForOp > loops, OpBuilder b)
 Creates an AffineIfOp that encodes the conditional to choose between the constant trip count version and an unknown trip count version of this nest of loops. More...
 
static LogicalResult createFullTiles (MutableArrayRef< AffineForOp > inputNest, SmallVectorImpl< AffineForOp > &fullTileLoops, OpBuilder b)
 Create the full tile loop nest (along with its body). More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "loop-utils"

Definition at line 31 of file LoopUtils.cpp.

Function Documentation

◆ areInnerBoundsInvariant()

static bool areInnerBoundsInvariant ( AffineForOp  forOp)
static

Check if all control operands of all loops are defined outside of forOp and return false if not.

Definition at line 1081 of file LoopUtils.cpp.

References mlir::WalkResult::advance().

Referenced by mlir::affine::loopUnrollJamByFactor().

◆ augmentMapAndBounds()

static void augmentMapAndBounds ( OpBuilder b,
Value  iv,
AffineMap map,
SmallVector< Value, 4 > *  operands,
int64_t  offset = 0 
)
static

◆ checkIfHyperRectangular()

static LogicalResult checkIfHyperRectangular ( MutableArrayRef< AffineForOp >  input)
static

Checks whether a loop nest is hyper-rectangular or not.

Definition at line 356 of file LoopUtils.cpp.

References mlir::affine::getIndexSet(), and mlir::presburger::IntegerRelation::isHyperRectangular().

Referenced by performPreTilingChecks().

◆ checkLoopInterchangeDependences()

static bool checkLoopInterchangeDependences ( const std::vector< SmallVector< DependenceComponent, 2 >> &  depCompsVec,
ArrayRef< AffineForOp >  loops,
ArrayRef< unsigned >  loopPermMap 
)
static

◆ constructParametricallyTiledIndexSetHyperRect()

static void constructParametricallyTiledIndexSetHyperRect ( MutableArrayRef< AffineForOp >  origLoops,
MutableArrayRef< AffineForOp >  newLoops,
ArrayRef< Value tileSizes 
)
static

Constructs and sets new loop bounds after tiling for the case of hyper-rectangular index sets, where the bounds of one dimension do not depend on other dimensions and tiling parameters are captured from SSA values.

Bounds of each dimension can thus be treated independently, and deriving the new bounds is much simpler and faster than for the case of tiling arbitrary polyhedral shapes.

Definition at line 655 of file LoopUtils.cpp.

References setInterTileBoundsParametric(), and setIntraTileBoundsParametric().

Referenced by mlir::affine::tilePerfectlyNestedParametric().

◆ constructTiledIndexSetHyperRect()

static void constructTiledIndexSetHyperRect ( MutableArrayRef< AffineForOp >  origLoops,
MutableArrayRef< AffineForOp >  newLoops,
ArrayRef< unsigned >  tileSizes 
)
static

Constructs and sets new loop bounds after tiling for the case of hyper-rectangular index sets, where the bounds of one dimension do not depend on other dimensions.

Bounds of each dimension can thus be treated independently, and deriving the new bounds is much simpler and faster than for the case of tiling arbitrary polyhedral shapes.

Definition at line 683 of file LoopUtils.cpp.

References mlir::AffineMap::get(), mlir::Builder::getAffineDimExpr(), mlir::affine::getConstantTripCount(), mlir::Builder::getContext(), mlir::Builder::getDimIdentityMap(), mlir::affine::getLargestDivisorOfTripCount(), mlir::affine::AffineBound::getMap(), mlir::AffineMap::getNumDims(), mlir::affine::AffineBound::getNumOperands(), mlir::AffineMap::getNumResults(), mlir::AffineMap::getNumSymbols(), mlir::affine::AffineBound::getOperand(), mlir::AffineMap::getResults(), and mlir::Builder::getSingleDimShiftAffineMap().

Referenced by mlir::affine::tilePerfectlyNested().

◆ constructTiledLoopNest()

static void constructTiledLoopNest ( MutableArrayRef< AffineForOp >  origLoops,
AffineForOp  rootAffineForOp,
unsigned  width,
MutableArrayRef< AffineForOp >  tiledLoops 
)
static

Constructs tiled loop nest, without setting the loop bounds and move the body of the original loop nest to the tiled loop nest.

Definition at line 418 of file LoopUtils.cpp.

References mlir::OpBuilder::create(), mlir::Operation::getBlock(), mlir::Block::getOperations(), and moveLoopBody().

Referenced by mlir::affine::tilePerfectlyNested(), and mlir::affine::tilePerfectlyNestedParametric().

◆ createFullTiles()

static LogicalResult createFullTiles ( MutableArrayRef< AffineForOp >  inputNest,
SmallVectorImpl< AffineForOp > &  fullTileLoops,
OpBuilder  b 
)
static

◆ createSeparationCondition()

static AffineIfOp createSeparationCondition ( MutableArrayRef< AffineForOp >  loops,
OpBuilder  b 
)
static

◆ emitRemarkForBlock()

static InFlightDiagnostic LLVM_ATTRIBUTE_UNUSED emitRemarkForBlock ( Block block)
static

Definition at line 1912 of file LoopUtils.cpp.

References mlir::Operation::emitRemark(), and mlir::Block::getParentOp().

Referenced by generateCopy().

◆ findHighestBlockForPlacement()

static void findHighestBlockForPlacement ( const MemRefRegion region,
Block block,
Block::iterator begin,
Block::iterator end,
Block **  copyPlacementBlock,
Block::iterator copyInPlacementStart,
Block::iterator copyOutPlacementStart 
)
static

Given a memref region, determine the lowest depth at which transfers can be placed for it, and return the corresponding block, start and end positions in the block for placing incoming (read) and outgoing (write) copies respectively.

The lowest depth depends on whether the region being accessed is hoistable with respect to one or more immediately surrounding loops.

Definition at line 1760 of file LoopUtils.cpp.

References mlir::Block::begin(), mlir::affine::getAffineForIVs(), and mlir::affine::MemRefRegion::getConstraints().

Referenced by mlir::affine::affineDataCopyGenerate().

◆ gatherLoopsInBlock()

static void gatherLoopsInBlock ( Block block,
unsigned  currLoopDepth,
std::vector< SmallVector< AffineForOp, 2 >> &  depthToLoops 
)
static

Gathers all AffineForOps in 'block' at 'currLoopDepth' in 'depthToLoops'.

Definition at line 2489 of file LoopUtils.cpp.

Referenced by mlir::affine::gatherLoops().

◆ generateCleanupLoopForUnroll()

static LogicalResult generateCleanupLoopForUnroll ( AffineForOp  forOp,
uint64_t  unrollFactor 
)
static

Helper to generate cleanup loop for unroll or unroll-and-jam when the trip count is not a multiple of unrollFactor.

Definition at line 968 of file LoopUtils.cpp.

References mlir::OpBuilder::clone(), getCleanupLoopLowerBound(), and mlir::affine::promoteIfSingleIteration().

Referenced by mlir::affine::loopUnrollByFactor(), and mlir::affine::loopUnrollJamByFactor().

◆ generateCopy()

static LogicalResult generateCopy ( const MemRefRegion region,
Block block,
Block::iterator  begin,
Block::iterator  end,
Block copyPlacementBlock,
Block::iterator  copyInPlacementStart,
Block::iterator  copyOutPlacementStart,
const AffineCopyOptions copyOptions,
DenseMap< Value, Value > &  fastBufferMap,
DenseSet< Operation * > &  copyNests,
uint64_t *  sizeInBytes,
Block::iterator nBegin,
Block::iterator nEnd 
)
static

Creates a buffer in the faster memory space for the specified memref region; generates a copy from the lower memory space to this one, and replaces all loads/stores in the block range [‘begin’, ‘end’) of ‘block’ to load/store from that buffer.

Returns failure if copies could not be generated due to yet unimplemented cases. copyInPlacementStart and copyOutPlacementStart in copyPlacementBlock specify the insertion points where the incoming copies and outgoing copies, respectively, should be inserted (the insertion happens right before the insertion point). Since begin can itself be invalidated due to the memref rewriting done from this method, the output argument nBegin is set to its replacement (set to begin if no invalidation happens). Since outgoing copies could have been inserted at end, the output argument nEnd is set to the new end. sizeInBytes is set to the size of the fast buffer allocated.

Definition at line 1929 of file LoopUtils.cpp.

References mlir::Block::begin(), mlir::OpBuilder::create(), mlir::detail::divideCeil(), emitRemarkForBlock(), mlir::affine::AffineCopyOptions::fastMemorySpace, mlir::affine::fullyComposeAffineMapAndOperands(), mlir::affine::AffineCopyOptions::generateDma, generatePointWiseCopy(), mlir::AffineMap::get(), mlir::get(), mlir::Builder::getAffineDimExpr(), mlir::affine::MemRefRegion::getConstantBoundingSizeAndShape(), mlir::affine::MemRefRegion::getConstraints(), mlir::Builder::getContext(), mlir::affine::getIntOrFloatMemRefSizeInBytes(), mlir::affine::MemRefRegion::getLowerAndUpperBound(), mlir::Builder::getMultiDimIdentityMap(), getMultiLevelStrides(), mlir::presburger::IntegerRelation::getNumCols(), mlir::presburger::IntegerRelation::getNumDimVars(), mlir::presburger::IntegerRelation::getNumSymbolVars(), mlir::presburger::IntegerRelation::getNumVars(), mlir::Op< ConcreteType, Traits >::getOperation(), mlir::Block::getParent(), mlir::Region::getParentOfType(), mlir::FlatLinearValueConstraints::getValues(), mlir::affine::MemRefRegion::isWrite(), mlir::affine::MemRefRegion::loc, mlir::affine::MemRefRegion::memref, mlir::affine::replaceAllMemRefUsesWith(), and mlir::affine::AffineCopyOptions::tagMemorySpace.

Referenced by mlir::affine::affineDataCopyGenerate(), and mlir::affine::generateCopyForMemRegion().

◆ generatePointWiseCopy()

static AffineForOp generatePointWiseCopy ( Location  loc,
Value  memref,
Value  fastMemRef,
ArrayRef< AffineMap lbMaps,
ArrayRef< Value lbOperands,
ArrayRef< AffineMap ubMaps,
ArrayRef< Value ubOperands,
ArrayRef< AffineExpr fastBufOffsets,
bool  isCopyOut,
OpBuilder  b 
)
static

Generates a point-wise copy from/to ‘memref’ to/from ‘fastMemRef’ and returns the outermost AffineForOp of the copy loop nest.

lbMaps and ubMaps along with lbOperands and ubOperands hold the lower and upper bound information for the copy loop nest. fastBufOffsets contain the expressions to be subtracted out from the respective copy loop iterators in order to index the fast buffer. If ‘copyOut’ is true, generates a copy-out; otherwise a copy-in. Builder b should be set to the point the copy nest is inserted. The copy-in nest is generated as follows as an example for a 2-d region: for x = ... for y = ... fast_buf[x - offset_x][y - offset_y] = memref[x][y]

Definition at line 1840 of file LoopUtils.cpp.

References mlir::OpBuilder::atBlockTerminator(), mlir::affine::canonicalizeMapAndOperands(), mlir::OpBuilder::create(), mlir::affine::createCanonicalizedAffineForOp(), mlir::affine::fullyComposeAffineMapAndOperands(), mlir::AffineMap::get(), mlir::Builder::getAffineDimExpr(), mlir::Builder::getContext(), mlir::AffineMap::getNumInputs(), mlir::Value::getType(), and mlir::simplifyAffineMap().

Referenced by generateCopy().

◆ generateShiftedLoop()

static AffineForOp generateShiftedLoop ( AffineMap  lbMap,
AffineMap  ubMap,
const std::vector< std::pair< uint64_t, ArrayRef< Operation * >>> &  opGroupQueue,
unsigned  offset,
AffineForOp  srcForOp,
OpBuilder  b 
)
static

Generates an affine.for op with the specified lower and upper bounds while generating the right IV remappings to realize shifts for operations in its body.

The operations that go into the loop body are specified in opGroupQueue starting from the specified offset, and in that order. The first element of the pair specifies the shift applied to that group of operations; the shift is multiplied by the loop step before being applied. Returns nullptr if the generated loop simplifies to a single iteration one.

Definition at line 169 of file LoopUtils.cpp.

References mlir::OpBuilder::atBlockTerminator(), mlir::OpBuilder::create(), mlir::AffineMap::getNumInputs(), mlir::IRMapping::map(), and mlir::affine::promoteIfSingleIteration().

Referenced by mlir::affine::affineForOpBodySkew().

◆ generateUnrolledLoop()

static void generateUnrolledLoop ( Block loopBodyBlock,
Value  forOpIV,
uint64_t  unrollFactor,
function_ref< Value(unsigned, Value, OpBuilder)>  ivRemapFn,
function_ref< void(unsigned, Operation *, OpBuilder)>  annotateFn,
ValueRange  iterArgs,
ValueRange  yieldedValues 
)
static

Generates unrolled copies of AffineForOp 'loopBodyBlock', with associated 'forOpIV' by 'unrollFactor', calling 'ivRemapFn' to remap 'forOpIV' for each unrolled body.

If specified, annotates the Ops in each unrolled iteration using annotateFn.

Definition at line 908 of file LoopUtils.cpp.

References mlir::OpBuilder::atBlockTerminator(), mlir::Block::begin(), mlir::Operation::clone(), mlir::Block::end(), mlir::Operation::getBlock(), mlir::Block::getTerminator(), mlir::IRMapping::lookup(), mlir::IRMapping::map(), mlir::Operation::setOperands(), and mlir::Value::use_empty().

Referenced by mlir::affine::loopUnrollByFactor().

◆ getCleanupLoopLowerBound()

static void getCleanupLoopLowerBound ( AffineForOp  forOp,
unsigned  unrollFactor,
AffineMap cleanupLbMap,
SmallVectorImpl< Value > &  cleanupLbOperands 
)
static

Computes the cleanup loop lower bound of the loop being unrolled with the specified unroll factor; this bound will also be upper bound of the main part of the unrolled loop.

Computes the bound as an AffineMap with its operands or a null map when the trip count can't be expressed as an affine expression.

Definition at line 44 of file LoopUtils.cpp.

References mlir::affine::canonicalizeMapAndOperands(), mlir::OpBuilder::create(), mlir::affine::fullyComposeAffineMapAndOperands(), mlir::AffineMap::get(), mlir::Builder::getAffineDimExpr(), mlir::Builder::getContext(), mlir::AffineMap::getNumDims(), mlir::AffineMap::getNumResults(), mlir::AffineMap::getNumSymbols(), mlir::AffineMap::getResult(), mlir::affine::getTripCountMapAndOperands(), and mlir::simplifyAffineMap().

Referenced by generateCleanupLoopForUnroll().

◆ getFullMemRefAsRegion()

static bool getFullMemRefAsRegion ( Operation op,
unsigned  numParamLoopIVs,
MemRefRegion region 
)
static

Construct the memref region to just include the entire memref.

Returns false dynamic shaped memref's for now. numParamLoopIVs is the number of enclosing loop IVs of op (starting from the outermost) that the region is parametric on.

Definition at line 2222 of file LoopUtils.cpp.

References mlir::affine::extractForInductionVars(), mlir::affine::getAffineForIVs(), mlir::affine::MemRefRegion::getConstraints(), mlir::Value::getType(), mlir::affine::MemRefRegion::memref, and mlir::affine::MemRefRegion::setWrite().

Referenced by mlir::affine::affineDataCopyGenerate().

◆ getMultiLevelStrides()

static void getMultiLevelStrides ( const MemRefRegion region,
ArrayRef< int64_t >  bufferShape,
SmallVectorImpl< StrideInfo > *  strideInfos 
)
static

Returns striding information for a copy/transfer of this region with potentially multiple striding levels from outermost to innermost.

For an n-dimensional region, there can be at most n-1 levels of striding successively nested.

Definition at line 1804 of file LoopUtils.cpp.

References mlir::Value::getType(), and mlir::affine::MemRefRegion::memref.

Referenced by generateCopy().

◆ moveLoopBody()

static void moveLoopBody ( AffineForOp  src,
AffineForOp  dest 
)
static

Move the loop body of AffineForOp 'src' from 'src' to the start of dest body.

Definition at line 412 of file LoopUtils.cpp.

References moveLoopBodyImpl().

Referenced by constructTiledLoopNest().

◆ moveLoopBodyImpl()

static void moveLoopBodyImpl ( AffineForOp  src,
AffineForOp  dest,
Block::iterator  loc 
)
static

Move the loop body of AffineForOp 'src' from 'src' into the specified location in destination's body, ignoring the terminator.

Definition at line 403 of file LoopUtils.cpp.

Referenced by moveLoopBody().

◆ performPreTilingChecks()

template<typename t >
static LogicalResult performPreTilingChecks ( MutableArrayRef< AffineForOp >  input,
ArrayRef< t >  tileSizes 
)
static

Check if the input nest is supported for tiling and whether tiling would be legal or not.

Definition at line 377 of file LoopUtils.cpp.

References checkIfHyperRectangular(), and mlir::affine::isPerfectlyNested().

Referenced by mlir::affine::tilePerfectlyNested(), and mlir::affine::tilePerfectlyNestedParametric().

◆ replaceIterArgsAndYieldResults()

static void replaceIterArgsAndYieldResults ( AffineForOp  forOp)
static

Helper to replace uses of loop carried values (iter_args) and loop yield values while promoting single iteration affine.for ops.

Definition at line 102 of file LoopUtils.cpp.

Referenced by mlir::affine::promoteIfSingleIteration().

◆ setInterTileBoundsParametric()

static void setInterTileBoundsParametric ( OpBuilder b,
AffineForOp  origLoop,
AffineForOp  newLoop,
Value  tileSize 
)
static

◆ setIntraTileBoundsParametric()

static void setIntraTileBoundsParametric ( OpBuilder b,
AffineForOp  origLoop,
AffineForOp  newInterTileLoop,
AffineForOp  newIntraTileLoop,
Value  tileSize 
)
static

◆ stripmineSink() [1/2]

template<typename SizeType >
static AffineForOp stripmineSink ( AffineForOp  forOp,
SizeType  factor,
AffineForOp  target 
)
static

Definition at line 1571 of file LoopUtils.cpp.

References stripmineSink().

◆ stripmineSink() [2/2]

static SmallVector<AffineForOp, 8> stripmineSink ( AffineForOp  forOp,
uint64_t  factor,
ArrayRef< AffineForOp >  targets 
)
static