Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions mlir/include/mlir/Transforms/LoopFusionUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ struct FusionStrategy {
None, // Generic fusion. No assumtions are made.
ProducerConsumer, // Producer-consumer fusion from AffineLoopFusion pass.
Sibling // Sibling fusion from AffineLoopFusion pass.
} strategy;
} value;

Value memref;
FusionStrategy(StrategyEnum strategy, Value memref)
: strategy(strategy), memref(memref) {}
FusionStrategy(StrategyEnum value) : value(value) {}
};

/// Checks the feasibility of fusing the loop nest rooted at 'srcForOp' into the
Expand All @@ -65,10 +63,10 @@ struct FusionStrategy {
/// NOTE: This function is not feature complete and should only be used in
/// testing.
/// TODO: Update comments when this function is fully implemented.
FusionResult
canFuseLoops(AffineForOp srcForOp, AffineForOp dstForOp, unsigned dstLoopDepth,
ComputationSliceState *srcSlice,
FusionStrategy fusionStrategy = {FusionStrategy::None, Value()});
FusionResult canFuseLoops(AffineForOp srcForOp, AffineForOp dstForOp,
unsigned dstLoopDepth,
ComputationSliceState *srcSlice,
FusionStrategy fusionStrategy = FusionStrategy::None);

/// Fuses 'srcForOp' into 'dstForOp' with destination loop block insertion point
/// and source slice loop bounds specified in 'srcSlice'.
Expand Down Expand Up @@ -112,6 +110,11 @@ bool getFusionComputeCost(AffineForOp srcForOp, LoopNestStats &srcStats,
const ComputationSliceState &slice,
int64_t *computeCost);

// TODO.
void gatherProducerConsumerMemrefs(ArrayRef<Operation *> srcOps,
ArrayRef<Operation *> dstOps,
DenseSet<Value> &producerConsumerMemrefs);

} // end namespace mlir

#endif // MLIR_TRANSFORMS_LOOP_FUSION_UTILS_H
Loading