You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[RFC] Feature: Automated Compute-Communication Overlap Diagnostic in Profiler #2408
In large-scale training (e.g., Llama 3.1 70B/405B), achieving high Model FLOPs Utilization (MFU) requires a perfect orchestration of compute and communication overlap. In FSDP2/3D parallel setups, identifying "Communication Bubbles"---where the main compute stream stalls while waiting for all_gather or reduce_scatter kernels---is currently a manual, labor-intensive process.
Engineers must download multi-gigabyte .json trace files and visually inspect CUDA streams in the Chrome Trace Viewer to see if NCCL operations are effectively "hidden" under GEMM kernels.
2. Proposed Feature
I propose adding a lightweight OverlapAnalyzer utility that automatically quantifies this overlap. This tool hooks into the on_trace_ready callback of the PyTorch profiler and outputs a high-level diagnostic summary directly to the logs.
Key Metrics:
Total Compute Time: Sum of CUDA time for math-heavy kernels (GEMM, cuBLAS, aten).
Total NCCL Time: Sum of CUDA time for communication kernels (all_gather, reduce_scatter).
Overlap Efficiency %: A heuristic calculating how much of the network latency was successfully overlapped with computation.
3. Design & API Contract
To maintain torchtitan's "clean-room" philosophy and minimize overhead, I suggest the following implementation details:
Location: House the core logic in torchtitan/experiments/overlap_analysis/ or as a utility in torchtitan/components/profiler_utils.py.
Config Toggle: Add an experimental flag to the [profiling] section of the .toml config:
Ini, TOML
[profiling]
enable_profiling = true
enable_overlap_analysis = true # New experimental flag
No "Hot-Path" Impact: The analysis only runs inside the on_trace_ready callback, meaning it has zero impact on actual training performance steps.
Alternative (Very Low Risk) I can house this in torchtitan/experiments/overlap_analysis to keep it decoupled from the core trainer
4. Expected Impact
This provides an immediate "Network Health" signal. For example, if a user sees an Efficiency of < 50%, it's a clear signal to investigate their interconnect (NVLink vs. PCIe) or adjust their sharding strategy, without needing to open a single trace file.
The OverlapAnalyzer is very lightweight — approximately 80 lines of Python (including docstrings and constants). It is entirely decoupled from the training loop (running only in the on_trace_ready callback) and adds zero overhead to the critical path. It effectively acts as a post-processing utility for the existing Kineto trace.
While torch.profiler is the upstream home, landing this there would require making it generic for all workloads (CV, RecSys, etc.), which likely incurs a long RFC/review cycle.
Since this metric (Communication/Compute Overlap) is the primary KPI for 3D-Parallel LLM training, I believe it fits better in torchtitan (the application layer) where we can make opinionated assumptions about FSDP/NCCL patterns. We can treat torchtitan as an incubator; if the metric proves universally useful, we can look at upstreaming it to Core PyTorch in the future.
Does that sound reasonable? If so, I can put up a draft PR so you can gauge the complexity directly
I've just submitted a PR (#2418) that implements this as an experimental component. It includes a standalone analyzer that parses the on_trace_ready callback. Looking forward to the team's feedback!
@pbpatre People have started to try adding Claude skills to read trace and memory profiling. I'm thinking to add the same skills for TorchTitan. Of course, you have to do this offline. But I found (from other people's experience) that this approach is useful as one can interact with Claude to understand the performance gaps, not just hardcoded rules only.
@fegin Offline analysis of traces with claude is extremly useful and even I have used it recently. +1 to having such an integration. That said, a lot of users might not bother to do it unless they are prompted by a metric that their GPU utlization is low. This metrics tries to give that signal as a single metric of overlap efficiency/GPU unutilized. Once users see a low enough number here they can start analyzing the traces to figure where is the model spending wasteful time.
What do you think?
People have started to try adding Claude skills to read trace and memory profiling.
+1, I found Claude reading profiling trace super fast and useful; and you can ask followup questions! would love to see how other people are using; and having a skill in Torchtitan.
Once users see a low enough number here they can start analyzing the traces to figure where is the model spending wasteful time.
I like this idea! Giving users a number on compute-comm overlap without any extra steps sounds great!
Activity
tianyu-l commentedon Feb 20, 2026
How much code does it have? Also do you think
torch.profileris better place to put this tool?pbpatre commentedon Feb 21, 2026
Thanks for taking a look
Since this metric (Communication/Compute Overlap) is the primary KPI for 3D-Parallel LLM training, I believe it fits better in torchtitan (the application layer) where we can make opinionated assumptions about FSDP/NCCL patterns. We can treat torchtitan as an incubator; if the metric proves universally useful, we can look at upstreaming it to Core PyTorch in the future.
Does that sound reasonable? If so, I can put up a draft PR so you can gauge the complexity directly
pbpatre commentedon Feb 21, 2026
I've just submitted a PR (#2418) that implements this as an experimental component. It includes a standalone analyzer that parses the on_trace_ready callback. Looking forward to the team's feedback!
fegin commentedon Feb 23, 2026
@pbpatre People have started to try adding Claude skills to read trace and memory profiling. I'm thinking to add the same skills for TorchTitan. Of course, you have to do this offline. But I found (from other people's experience) that this approach is useful as one can interact with Claude to understand the performance gaps, not just hardcoded rules only.
Would like to hear your opinion too.
pbpatre commentedon Feb 24, 2026
@fegin Offline analysis of traces with claude is extremly useful and even I have used it recently. +1 to having such an integration. That said, a lot of users might not bother to do it unless they are prompted by a metric that their GPU utlization is low. This metrics tries to give that signal as a single metric of overlap efficiency/GPU unutilized. Once users see a low enough number here they can start analyzing the traces to figure where is the model spending wasteful time.
What do you think?
acisseJZhong commentedon Feb 26, 2026
+1, I found Claude reading profiling trace super fast and useful; and you can ask followup questions! would love to see how other people are using; and having a skill in Torchtitan.
I like this idea! Giving users a number on compute-comm overlap without any extra steps sounds great!
Feature/rfc 2408 compute comms overlap (#3020)