Add callbacks for driver cuGraphLaunch#21
Merged
Conversation
parcagpu subscribed CUPTI callbacks for eager launches (cuLaunchKernel) and runtime graph launches (cudaGraphLaunch), but not the driver-API cuGraphLaunch / cuGraphLaunch_ptsz. C++ runtimes like TensorRT-LLM replay CUDA graphs through the driver API, so the cuda_correlation USDT never fired in graph mode and no GPU samples were produced, while eager launches kept working (confirmed on a 4xB200 TRT-LLM node). Fix: enable the two driver graph-launch cbids in CuptiProfiler::initialize (with symmetric teardown). Not setGraphCallbacks(), which also subscribes capture cbids that would emit correlation events for non-executing capture calls. Tests: the mock harness dispatched callbacks unconditionally, hiding the missing subscription. mock_cupti now records the subscribed (domain,cbid) set and the harness only dispatches subscribed callbacks. test-pc-mock-graph (new make target) asserts driver cuGraphLaunch correlation events fire; graph_repro.cu / graph-repro-real.sh add a real-GPU reproducer. Verified the guard goes red without the fix and green with it.
d698a08 to
633dc6b
Compare
brancz
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
parcagpu subscribed to CUPTI callbacks for eager kernel launches (
cuLaunchKernel) and runtime graph launches (cudaGraphLaunch), but not the driver-API graph launch (cuGraphLaunch/cuGraphLaunch_ptsz).setLaunchCallbackscovers only kernel-launch cbids andsetRuntimeCallbacksonly the runtime domain, so the driver graph-launch cbid was never enabled.C++ runtimes such as TensorRT-LLM replay CUDA graphs through the driver API. On those workloads the
cuda_correlationUSDT never fired for graph launches, noCUDA_KERNELframe was pushed, and the GPU sample pipeline produced nothing in graph mode — while eager launches kept working. This was confirmed on a 4×B200 TRT-LLM node: a trace_pipe capture in graph mode contained zeroFRAME_MARKER_CUDA_KERNELframes.Fix
Enable only the two driver graph-launch cbids in
CuptiProfiler::initialize(with symmetric teardown). Deliberately notsetGraphCallbacks(), which also subscribes the capture (cuStreamBegin/EndCapture) and graph-resource cbids — those would makecallbackHandleremit correlation events for non-executing capture calls that never receive kernel timing. The existingisGraphLaunchhandler already had all the logic to process these callbacks; it just never received them.Test coverage
The mock harness previously dispatched the shim's callback unconditionally, so a missing subscription was invisible to tests. Changes:
mock_cupti.c:cuptiEnableCallbacknow records the subscribed(domain, cbid)set.test_cupti_prof.c: callbacks are dispatched only if subscribed, mirroring real CUPTI gating.test-pc-mock-graph.sh: asserts drivercuGraphLaunchcorrelation events fire (signed cbid -514/-515). The workload splits graph launches 50/50 runtime/driver, so the runtime half emits regardless — only this check catches the regression. Wired to a newmake test-pc-mock-graphtarget.graph_repro.cu/graph-repro-real.sh: real-GPU reproducer that replays a captured graph via drivercuGraphLaunchand verifies correlation events fire.Verified the mock guard goes red without the fix and green with it.