Bug: Incorrect cross-rank GPU attribution during multinode merged trace analysis, indefinite hangs

Open
#581 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python, pytorch
Domain
data, performance

Research direction

Start with add_gpu_ops_to_tree and its _get_graph_gpu_events lookup, using the merged PyTorch trace behavior described in the issue as the reproduction target. Compare the proposed changes in PR #577 and verify that GPU kernels are attributed to the correct rank without duplicate ancestor propagation or indefinite processing.

Written by the indexing model from the issue text.

Description

Problem

Engineers on my team were unable to use TraceLens to process merged trace files from multi-node workload runs.

Investigation

When PyTorch profiles a single rank, each GPU kernel launch is assigned a correlation ID unique within that session. When traces from K ranks are merged into one file, each rank's correlation IDs restart from the same numeric range, causing collisions. add_gpu_ops_to_tree uses these correlation IDs to link CPU runtime events to their GPU kernels, and was vulnerable to these collisions in two ways.

First, _get_graph_gpu_events looked up GPU kernels by correlation ID alone, so in a merged trace every graph launch event claimed kernels from all K ranks sharing that ID, producing incorrect attribution.

Second, the per-kernel ancestor walk had no mechanism to deduplicate GPU events that appeared as children of multiple runtime parents, causing $O(K^2 \times N_{gpu})$ complexity during propagation.

Together, these are causing issues such as incorrect cross-rank GPU attribution and indefinite hangs when processing merged trace files from PyTorch profiling of multi-node workloads.

Status

I have a PR open (#577) with a description of my fixes to address the issues my team was facing. With these changes, a large multi-node merged PyTorch trace file that previously ran indefinitely now runs in 235.9 seconds. However, I would like to encourage some discussion about my observations so that we can arrive at the best solution.

Dominant language
Python
Stars
101
Forks
34
Avg merge
2d 1h
Merged PRs (30d)
78

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AMD-AGI/TraceLens

All issues in AMD-AGI/TraceLens

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.