15 #ifndef MLIR_DIALECT_AFFINE_LOOPFUSIONUTILS_H 16 #define MLIR_DIALECT_AFFINE_LOOPFUSIONUTILS_H 20 #include "llvm/ADT/DenseMap.h" 21 #include "llvm/ADT/SmallVector.h" 25 struct ComputationSliceState;
79 "Sibling fusion strategy requires a specific memref");
91 assert(strategy ==
Sibling &&
"Memref is only valid for sibling fusion");
113 canFuseLoops(AffineForOp srcForOp, AffineForOp dstForOp,
unsigned dstLoopDepth,
121 void fuseLoops(AffineForOp srcForOp, AffineForOp dstForOp,
123 bool isInnermostSiblingInsertionFusion =
false);
160 int64_t *computeCost);
170 #endif // MLIR_DIALECT_AFFINE_LOOPFUSIONUTILS_H
Include the generated interface declarations.
FusionStrategy(StrategyEnum strategy)
Construct a generic or producer-consumer fusion strategy.
DenseMap< Operation *, uint64_t > opCountMap
Map from AffineForOp to count of operations in its loop body.
Value getSiblingFusionMemRef() const
Returns the memref attached to this sibling fusion strategy.
LoopNestStats aggregates various per-loop statistics (eg.
void fuseLoops(AffineForOp srcForOp, AffineForOp dstForOp, const ComputationSliceState &srcSlice, bool isInnermostSiblingInsertionFusion=false)
Fuses 'srcForOp' into 'dstForOp' with destination loop block insertion point and source slice loop bo...
FusionResult(ResultEnum v)
DenseMap< Operation *, SmallVector< AffineForOp, 2 > > loopMap
Map from AffineForOp to immediate child AffineForOps in its loop body.
StrategyEnum getStrategy() const
Returns the fusion strategy.
bool getFusionComputeCost(AffineForOp srcForOp, LoopNestStats &srcStats, AffineForOp dstForOp, LoopNestStats &dstStats, const ComputationSliceState &slice, int64_t *computeCost)
Computes and returns in 'computeCost', the total compute cost of fusing the 'slice' of the loop nest ...
ComputationSliceState aggregates loop IVs, loop bound AffineMaps and their associated operands for a ...
bool getLoopNestStats(AffineForOp forOp, LoopNestStats *stats)
Collect loop nest statistics (eg.
void gatherProducerConsumerMemrefs(ArrayRef< Operation *> srcOps, ArrayRef< Operation *> dstOps, DenseSet< Value > &producerConsumerMemrefs)
Returns in 'producerConsumerMemrefs' the memrefs involved in a producer-consumer dependence between w...
FusionStrategy(Value memref)
Construct a sibling fusion strategy targeting 'memref'.
DenseMap< Operation *, uint64_t > tripCountMap
Map from AffineForOp to its constant trip count.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Describes the fusion strategy to be used in the Affine loop fusion utilities.
enum mlir::FusionResult::ResultEnum value
FusionResult canFuseLoops(AffineForOp srcForOp, AffineForOp dstForOp, unsigned dstLoopDepth, ComputationSliceState *srcSlice, FusionStrategy fusionStrategy=FusionStrategy::Generic)
Checks the feasibility of fusing the loop nest rooted at 'srcForOp' into the loop nest rooted at 'dst...
int64_t getComputeCost(AffineForOp forOp, LoopNestStats &stats)
Computes the total cost of the loop nest rooted at 'forOp' using 'stats'.