Files
tracy/examples/CUDAGraphRepro
Basil Milanich 12dc23f67e Add graphId recycle investigation test
Tests whether CUPTI recycles graphId values after cudaGraphExecDestroy,
which would be the only scenario where the graphLaunchCache in TracyCUDA
could serve stale entries for a non-matching exec handle.

Result (H100, CUDA 12, CUPTI): graphId is a monotonically increasing
counter that is never recycled. 22 create/instantiate/launch/destroy
cycles produced unique IDs ranging from 2 to 65 (incrementing by 3 per
cycle — one unit per node created during graph construction).

This confirms that the stale-cache concern raised in code review is not
a real risk in practice: two distinct exec handles always have distinct
graphIds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 09:34:51 -05:00
..
2026-03-24 09:37:50 -05:00

Tracy CUDA Graph GPU Zone Repro

Demonstrates that unpatched Tracy fails to show GPU zones for kernels launched via CUDA Graphs (cudaGraphLaunch).

Root cause

When kernels are launched through CUDA Graphs, CUPTI delivers CONCURRENT_KERNEL and MEMCPY activity records but no corresponding API callback fires for the individual kernel launches. Tracy's matchActivityToAPICall() always fails, and matchError() silently drops every GPU zone.

Build and run

make
./repro

What to expect

Tracy version GPU zones shown
Unpatched 0
Patched (cuda-graph-gpu-zones.patch) ~30 (10 launches x 3 ops)

The graph structure

Each graph launch contains:

  1. vector_add kernel (c = a + b)
  2. Device-to-device memcpy
  3. vector_add kernel (c = a + c)

The graph is launched 10 times, so 30 GPU operations total.