Skip to content

Commit

Permalink
Fix a bug in the insert_explicit_reshards pass on OSS tests.
Browse files Browse the repository at this point in the history
It fails with the following error:
error: reference to local binding 'index' declared in enclosing function
PiperOrigin-RevId: 689874436
  • Loading branch information
Google-ML-Automation authored and copybara-github committed Oct 25, 2024
1 parent c048282 commit 2045c18
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ void insertExplicitReshards(Operation* op, const ShardingProjection& projection,
}
auto reshardOp =
rewriter.create<ReshardOp>(value.getLoc(), value, newTensorSharding);
rewriter.modifyOpInPlace(op, [&]() { op->setOperand(index, reshardOp); });
rewriter.modifyOpInPlace(
op, [index, op, &reshardOp]() { op->setOperand(index, reshardOp); });
}

rewriter.setInsertionPointAfter(op);
Expand Down

0 comments on commit 2045c18

Please sign in to comment.