Commit Graph

9776 Commits

Author SHA1 Message Date
Basil Milanich
703df05529 Document known MEMORY2 limitation for graph-launched alloc nodes
CUpti_ActivityMemory3 has no graphId field, so matchGraphActivityToAPICall
cannot be applied. Graph-launched cudaGraphAddMemAllocNode emits multiple
MEMORY2 records sharing the launch correlationId; only the first is
tracked, subsequent ones fire a spurious matchError.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 15:30:27 -05:00
Basil Milanich
c8ebc6f21e Review fixes: correct stale comments, fix fetch() missing lock, tidy helper
- Fix wrong comments on graph launch tracker entries: they claimed
  correlation works "via CUPTI_ACTIVITY_KIND_GRAPH_TRACE", but that
  approach was rejected (GRAPH_TRACE suppresses per-kernel records).
  The actual mechanism is the shared correlationId across all nodes
  in one graph launch.
- Fix ConcurrentHashMap::fetch() missing its read lock — a pre-existing
  data race now exercised by the new graph correlation hot path.
- Cache PersistentState::Get().cudaGraphCurrentLaunch in a local ref
  inside matchGraphActivityToAPICall instead of calling Get() twice.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 14:00:01 -05:00
Basil Milanich
0b6e27934d ConcurrentHashMap: add insert_or_assign to replace erase+emplace
The cudaGraphCurrentLaunch cache update was acquiring the write lock
twice (once for erase, once for emplace). Wrapping
std::unordered_map::insert_or_assign under a single write lock lets
the caller do it in one operation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 13:48:53 -05:00
Basil Milanich
d9a1cc06c1 Fix repro build: add -arch=native to use correct GPU architecture
NVCC 13.1 defaults to a PTX version incompatible with the installed
driver (580.105.08), causing kernels to silently fail with "provided
PTX was compiled with an unsupported toolchain". Use -arch=native so
NVCC auto-detects the target GPU (H100, sm_90) at build time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 13:33:05 -05:00
Basil Milanich
f74dd21573 Refactor: extract matchGraphActivityToAPICall helper
The kernel, memcpy, and memset cases all had identical logic for
handling graph-launched activities. Extract it into a single helper
next to matchActivityToAPICall.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 13:08:39 -05:00
Basil Milanich
4ccaea9f08 Expand repro: multiple graphs, multiple kernels, interleaved launches
Tests:
- Two distinct graphs (different graphIds) on the same stream
- Graph A: kernel + memcpy + kernel (3 nodes)
- Graph B: scale + add + scale (3 nodes)
- 5 interleaved launches of each, stressing the graphId cache
- Expected 30 graph GPU zones total

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 11:54:08 -05:00
Basil Milanich
d36ca27041 Fix graph correlation: use shared correlationId, not GRAPH_TRACE
CUPTI discovery: all kernels launched by one cuGraphLaunch share the
same correlationId as the launch call itself. GRAPH_TRACE was the
wrong approach — enabling it suppresses per-kernel CONCURRENT_KERNEL
records entirely, replacing them with graph-level summaries.

New approach:
- Drop CUPTI_ACTIVITY_KIND_GRAPH_TRACE (it conflicts with CONCURRENT_KERNEL)
- Drop two-pass buffer processing (no longer needed)
- On the first kernel/memcpy/memset from a graph launch, matchActivityToAPICall
  succeeds (consuming the cuGraphLaunch entry) and the result is cached in
  cudaGraphCurrentLaunch[graphId]
- Subsequent operations from the same launch find the cached entry via graphId

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 11:36:14 -05:00
Basil Milanich
2e5b076175 Also track cudaGraphLaunch runtime API for graph correlation
The repro uses cudaGraphLaunch (runtime API) not cuGraphLaunch (driver
API). Add cudaGraphLaunch_v10000 and its _ptsz variant to
cbidRuntimeTrackers so that graphs launched via the runtime API also
get their CPU call site captured for GPU zone correlation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 11:18:20 -05:00
Basil Milanich
7bca9dcd90 Fix CUDA Graph GPU zones with proper cuGraphLaunch correlation
Replace the synthetic APICallInfo hack with proper correlation via
CUPTI_ACTIVITY_KIND_GRAPH_TRACE. When cuGraphLaunch fires an API
callback, its correlationId is stored in cudaCallSiteInfo. The
GRAPH_TRACE activity record carries the same correlationId plus the
graphId, which lets us build a graphId→APICallInfo map. Kernel/memcpy/
memset activities then look up this map via their graphId field.

Key changes:
- Add cuGraphLaunch/cuGraphLaunch_ptsz to cbidDriverTrackers so the
  API callback machinery captures the CPU call site
- Enable CUPTI_ACTIVITY_KIND_GRAPH_TRACE and handle it in
  DoProcessDeviceEvent to populate cudaGraphCurrentLaunch[graphId]
- Add cudaGraphCurrentLaunch map to PersistentState
- Two-pass buffer processing in OnBufferCompleted so GRAPH_TRACE
  records (which complete last on GPU) are processed before the
  kernel/memcpy/memset records that depend on them
- Replace graphId=0 fallback in kernel/memcpy/memset with proper
  cudaGraphCurrentLaunch lookup; fall through to matchError if
  the graphId is not found
- Update repro to include TracyCUDA headers and properly test
  GPU zone correlation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 11:03:58 -05:00
Basil Milanich
6c6999bf01 Add CUDA Graph GPU zone repro
Minimal reproducer showing that CUDA Graph-launched kernels produce
0 GPU zones in Tracy. The repro creates a simple graph (2 kernels +
1 memcpy), launches it 10 times, and expects ~30 GPU zones. Without
the fallback patch, all activity records are dropped by matchError().

Tested on NVIDIA H100, CUDA 13.1.
2026-03-24 09:37:50 -05:00
Basil Milanich
aa657d5438 Fix missing GPU zones for CUDA Graph-launched kernels
When kernels are launched via CUDA Graphs (cuGraphLaunch), CUPTI delivers
CONCURRENT_KERNEL, MEMCPY, and MEMSET activity records but no
corresponding API callback fires for the individual operations. This
means matchActivityToAPICall() always fails, and every GPU activity
record is silently dropped by matchError().

Fix this by falling back to a synthetic APICallInfo using the GPU
timestamps from the activity record when no API correlation exists.
This produces correct GPU zones with kernel names and timing — just
without the CPU-to-GPU launch correlation arrow.

Tested on NVIDIA H100 with CUDA 13.1: before this fix, 0 GPU zones
appeared for CUDA Graph workloads; after, all kernel and memcpy zones
are visible in the Tracy timeline.
2026-03-24 09:24:23 -05:00
Bartosz Taudul
e1143fd985 Try to remove excess frames from reconstructed callstack. 2026-03-24 01:14:38 +01:00
Bartosz Taudul
fb9912db5c Merge pull request #1315 from slomp/slomp/d3d12-opsie
D3D12 opsie
2026-03-23 23:45:51 +01:00
Marcos Slomp
a59ff2dcbb Update TracyD3D12.hpp
opsie
2026-03-23 15:43:36 -07:00
Bartosz Taudul
e792752104 Ignore completely non-local samples. 2026-03-22 17:04:31 +01:00
Bartosz Taudul
3c283187c3 Extract functionality for counting local frames in a callstack. 2026-03-22 17:00:15 +01:00
Bartosz Taudul
1967f2c79b Do proper frame matching instead of relying just on callstack size. 2026-03-22 16:51:55 +01:00
Bartosz Taudul
f5df9f9c24 Remove dead code. 2026-03-21 23:36:15 +01:00
Bartosz Taudul
5040412813 Simplify search for max-local call stack root. 2026-03-21 22:35:25 +01:00
Bartosz Taudul
9326227bcd Display reconstructed callstack in zone info window. 2026-03-21 01:48:00 +01:00
Bartosz Taudul
b52af15504 Change DrawCallstackTable interface to accept data + size pair. 2026-03-21 01:47:26 +01:00
Bartosz Taudul
e1381d1beb Draw reconstructed callstack trace in zone tooltips. 2026-03-21 01:27:12 +01:00
Bartosz Taudul
c4f42b1bc9 Basic heuristics for reconstruction of zone callstack from sample data. 2026-03-21 01:26:40 +01:00
Bartosz Taudul
d0222ef7d9 Worker::GetZoneEnd() can be const. 2026-03-19 19:53:58 +01:00
Bartosz Taudul
87781fd75c Merge pull request #1312 from YaLTeR/patch-1
Add missing cstdint include
2026-03-19 18:18:50 +01:00
Ivan Molodetskikh
16af373a7e Add missing cstdint include
Fixes build on new gcc on Fedora 44.
2026-03-19 17:57:57 +03:00
Amy
e9314add15 clang visibility for TRACY_API (#1310) 2026-03-18 23:59:33 +01:00
Bartosz Taudul
145efd63c9 Change GetCallstackJson interface to data ptr + size. 2026-03-18 00:52:34 +01:00
Bartosz Taudul
0905e203e3 Add DrawCallstackCalls( data, size, ... ) interface. 2026-03-18 00:42:21 +01:00
Bartosz Taudul
4fbbfb410d Merge pull request #1307 from slomp/slomp/d3d12-callstack-patch
Fix callstack and transient zones in D3D12
2026-03-17 21:20:08 +01:00
Marcos Slomp
36aaa19ae9 instrumenting relevant events of D3D12 2026-03-17 13:14:15 -07:00
Marcos Slomp
8b1e413db5 fix handling of D3D12 callstacks and/or transient zones 2026-03-17 13:13:24 -07:00
Bartosz Taudul
54f778c204 Display ellipsis in single-line callstack printout, when frames remain. 2026-03-17 02:29:12 +01:00
Bartosz Taudul
3876d33a15 Display callstacks in zone tooltips. 2026-03-17 01:32:24 +01:00
Bartosz Taudul
94e5ff2cfb Add inline callstack display to zone info window. 2026-03-17 01:00:21 +01:00
Bartosz Taudul
79d165190a Improve parent zones display. 2026-03-17 00:07:47 +01:00
Bartosz Taudul
83b7d3a267 Simplify "zone trace" into "parent zones". 2026-03-16 01:44:57 +01:00
Bartosz Taudul
a51efcc974 Proper CMake setup for TRACY_CALLSTACK. 2026-03-15 22:17:26 +01:00
Bartosz Taudul
1476afb992 Do not force enable CMake configure on open in VS Code. 2026-03-15 22:17:18 +01:00
Bartosz Taudul
80b8e8284e Allow attaching zone histogram to llm. 2026-03-11 00:42:53 +01:00
Bartosz Taudul
8f9392cae7 Merge pull request #1304 from slomp/slomp/windows-opsie
Windows x64 vs ARM opsie
2026-03-09 21:35:48 +01:00
Marcos Slomp
01bd20c30a Windows x64 vs ARM opsie 2026-03-09 13:24:08 -07:00
Bartosz Taudul
b0dd2b291d Make a separate fast model optional. 2026-03-08 14:42:18 +01:00
Bartosz Taudul
9f432d5fa2 Cosmetics. 2026-03-08 13:20:15 +01:00
Bartosz Taudul
2f90aac0ac Force enable thinking for chat model, force disable for fast model. 2026-03-08 13:16:14 +01:00
Bartosz Taudul
869ad0a02d Include news, locations, videos from brave search results. 2026-03-07 22:33:32 +01:00
Bartosz Taudul
928de7ae6c Use common functionality for gathering brave search results. 2026-03-07 22:33:32 +01:00
Bartosz Taudul
feb07e476a Merge pull request #1289 from slomp/slomp/windows-on-arm
Support for Windows on ARM
2026-03-06 23:55:02 +01:00
Bartosz Taudul
460944ef42 Cosmetics. 2026-03-06 23:53:13 +01:00
Bartosz Taudul
f1bc3ef4c7 Merge pull request #1300 from slomp/slomp/c-api-get-time
Adding C API for Profiler::GetTime()
2026-03-06 12:18:05 +01:00