Skip to content

Commit

Permalink
Insert clones prior to mutation and not where it originates.
Browse files Browse the repository at this point in the history
This dramatically reduces the lifetime of the clones.
Fixes #5291.
  • Loading branch information
benvanik committed Apr 2, 2021
1 parent 531c73e commit d5b34a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion iree/compiler/Dialect/Flow/IR/FlowOpFolders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ struct InsertImmutabilityPreservingStreamClones
if (!tiedOperandIndex.hasValue()) continue;
auto tiedOperand = tiedOp->getOperand(tiedOperandIndex.getValue());
if (hasUsersInStreamAfterUpdate(tiedOperand, tiedOp)) {
rewriter.setInsertionPointAfterValue(tiedOperand);
rewriter.setInsertionPoint(tiedOp);
auto clonedOperand = rewriter.createOrFold<TensorCloneOp>(
tiedOperand.getLoc(), tiedOperand);
SmallPtrSet<Operation *, 1> excludedOps;
Expand Down

0 comments on commit d5b34a8

Please sign in to comment.