Skip to content

Commit

Permalink
[xla-auto-sharding] Fix potential dangling pointer (reference) bug.
Browse files Browse the repository at this point in the history
Note:
- The scaled request object is allocated on the stack when `ScaleRequest` is called, but then it goes out of scope.
- This change should be equally performant due to return value optimization.
PiperOrigin-RevId: 705277876
  • Loading branch information
Matthew Fahrbach authored and Google-ML-Automation committed Dec 12, 2024
1 parent 4b68998 commit b6a3dbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xla/hlo/experimental/auto_sharding/auto_sharding_solver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ void AddMemoryTerms(
absl::StatusOr<AutoShardingSolverOutput> FormulateAndSolveMIPFromSolverRequest(
const AutoShardingSolverRequest& unscaled_request) {
const absl::Time start_time = absl::Now();
const AutoShardingSolverRequest& request = ScaleRequest(unscaled_request);
const AutoShardingSolverRequest request = ScaleRequest(unscaled_request);
const size_t num_edges = request.edges_size();
const int num_workers = 32;
// SAT or SCIP
Expand Down

0 comments on commit b6a3dbb

Please sign in to comment.