Skip to content

Commit

Permalink
PR #19195: [nfc] Use flat_hash_map::insert instead of find and assign.
Browse files Browse the repository at this point in the history
Imported from GitHub PR #19195

Addressing comment added in #18959
Copybara import of the project:

--
f399d89 by Shraiysh Vaishay <[email protected]>:

[nfc] Use flat_hash_map::insert instead of find and assign.

Addressing comment added in #18959

Merging this change closes #19195

COPYBARA_INTEGRATE_REVIEW=#19195 from shraiysh:nfc-p2p-fix f399d89
PiperOrigin-RevId: 694577367
  • Loading branch information
shraiysh authored and Google-ML-Automation committed Nov 8, 2024
1 parent 982aebd commit ddcd348
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions xla/service/gpu/transforms/pipelined_p2p_rewriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -669,11 +669,9 @@ absl::StatusOr<bool> ProcessComputation(
}
// After processing all the operations, if nothing set the flag
// collective_in_computation[computation] to true, then there must be no
// collective in this computation.
if (collective_in_computation.find(computation) ==
collective_in_computation.end()) {
collective_in_computation[computation] = false;
}
// collective in this computation. `insert` is a no-op if the key already
// exists in the `flat_hash_map`.
collective_in_computation.insert({computation, false});
return changed;
}
} // namespace
Expand Down

0 comments on commit ddcd348

Please sign in to comment.