这是indexloc提供的服务,不要输入任何密码
Skip to content

[XLA] Add stack trace breakdown to HloLiveRange::ToString for peak memory usage #94954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2025

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Jun 6, 2025

[XLA] Add stack trace breakdown to HloLiveRange::ToString for peak memory usage

This change enhances the HloLiveRange::ToString output with a hierarchical stack trace visualization of live buffers at the peak memory usage moment. The breakdown groups buffer sizes by call stack, making it easier to identify high-memory-use paths in nested computations.

Key additions:

  • Introduced FormatStackTraceBreakdown in a new file hlo_stack_trace.{h,cc} to encapsulate stack trace logic.
  • Refactored ToString to delegate stack tree formatting to this helper.
  • Added unit test hlo_stack_trace_test.cc to verify formatting, including nested computations and buffer attribution.

This improves interpretability of peak memory use, helping developers and memory profiling tools pinpoint memory-intensive subcomputations.

@copybara-service copybara-service bot force-pushed the exported_pr_768088548 branch 2 times, most recently from 113f9ff to 7bfd1e7 Compare June 10, 2025 07:28
@copybara-service copybara-service bot force-pushed the exported_pr_768088548 branch 3 times, most recently from f0f9320 to 5ef0ffe Compare June 16, 2025 11:25
@copybara-service copybara-service bot force-pushed the exported_pr_768088548 branch 3 times, most recently from 67a5b2c to a765b82 Compare June 27, 2025 15:07
@copybara-service copybara-service bot force-pushed the exported_pr_768088548 branch 5 times, most recently from 7127b19 to 5dedef2 Compare July 18, 2025 06:42
@copybara-service copybara-service bot force-pushed the exported_pr_768088548 branch 4 times, most recently from 667f369 to 532df3a Compare July 23, 2025 14:02
…memory usage

This change enhances the `HloLiveRange::ToString` output with a hierarchical stack trace visualization of live buffers at the peak memory usage moment. The breakdown groups buffer sizes by call stack, making it easier to identify high-memory-use paths in nested computations.

Key additions:

* Introduced `FormatStackTraceBreakdown` in a new file `hlo_stack_trace.{h,cc}` to encapsulate stack trace logic.
* Refactored `ToString` to delegate stack tree formatting to this helper.
* Added unit test `hlo_stack_trace_test.cc` to verify formatting, including nested computations and buffer attribution.

This improves interpretability of peak memory use, helping developers and memory profiling tools pinpoint memory-intensive subcomputations.

PiperOrigin-RevId: 786270002
@copybara-service copybara-service bot force-pushed the exported_pr_768088548 branch from 532df3a to 89e79b5 Compare July 23, 2025 14:24
@copybara-service copybara-service bot merged commit 89e79b5 into master Jul 23, 2025
@copybara-service copybara-service bot deleted the exported_pr_768088548 branch July 23, 2025 14:24
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