[Mlir-commits] [mlir] Refactor LoopFuseSiblingOp and support parallel fusion (PR #94391)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Jun 26 21:00:17 PDT 2024
================
@@ -113,3 +115,56 @@ LogicalResult detail::verifyLoopLikeOpInterface(Operation *op) {
return success();
}
+
+LoopLikeOpInterface mlir::createFused(LoopLikeOpInterface target,
+ LoopLikeOpInterface source,
+ RewriterBase &rewriter,
+ NewYieldValuesFn newYieldValuesFn,
+ FuseTerminatorFn fuseTerminatorFn) {
+ auto targetIterArgs = target.getRegionIterArgs();
+ std::optional<SmallVector<Value>> targetInductionVar =
+ target.getLoopInductionVars();
+ SmallVector<Value> targetYieldOperands(target.getYieldedValues());
+ auto sourceIterArgs = source.getRegionIterArgs();
+ std::optional<SmallVector<Value>> sourceInductionVar =
+ *source.getLoopInductionVars();
+ SmallVector<Value> sourceYieldOperands(source.getYieldedValues());
+ auto sourceRegion = source.getLoopRegions().front();
+
+ FailureOr<LoopLikeOpInterface> maybeFusedLoop =
+ target.replaceWithAdditionalYields(rewriter, source.getInits(),
+ /*replaceInitOperandUsesInLoop=*/false,
+ newYieldValuesFn);
----------------
srcarroll wrote:
@ftynse i can't find your original comment, i guess because i moved the code. but it was about expanding auto and checking for failures. i have done so here and below with `fusedLoop` and the optional induction vars
https://github.com/llvm/llvm-project/pull/94391
More information about the Mlir-commits
mailing list