Skip to content

Optimize xla::HloDataflowAnalysis::OptimizePhiValues.#117454

Merged
copybara-service[bot] merged 1 commit into
masterfrom
exported_pr_909054043
May 2, 2026
Merged

Optimize xla::HloDataflowAnalysis::OptimizePhiValues.#117454
copybara-service[bot] merged 1 commit into
masterfrom
exported_pr_909054043

Conversation

@copybara-service
Copy link
Copy Markdown

Optimize xla::HloDataflowAnalysis::OptimizePhiValues.

  • auto values = value_set->values(); was doing a whole vector copy!
    E.g. check out https://godbolt.org/z/YfMbrY9hY.
  • Reserve new_values vector because we are adding exactly values.size() elements.
  • Use the HloValueSet's constructor (involves one sorting) instead of repeated AddValue calls (involve N std::lower_bound calls, N vector::insert calls).

@copybara-service copybara-service Bot force-pushed the exported_pr_909054043 branch 2 times, most recently from fb977b7 to 6b59bc6 Compare May 2, 2026 07:26
- `auto values = value_set->values();` was doing a whole `vector` copy!
  E.g. check out https://godbolt.org/z/YfMbrY9hY.
- Reserve `new_values` vector because we are adding exactly `values.size()` elements.
- Use the `HloValueSet`'s constructor (involves one sorting) instead of repeated `AddValue` calls (involve N `std::lower_bound` calls, N `vector::insert` calls).

PiperOrigin-RevId: 909097719
@copybara-service copybara-service Bot force-pushed the exported_pr_909054043 branch from 6b59bc6 to 8f0f1ed Compare May 2, 2026 07:50
@copybara-service copybara-service Bot merged commit 8f0f1ed into master May 2, 2026
@copybara-service copybara-service Bot deleted the exported_pr_909054043 branch May 2, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant