Repository navigation
Conversation
This was referenced Oct 19, 2026
pianpwk
added a commit
that referenced
this pull request
Oct 19, 2026
Profiler.Config.always_on records every training step's GPU kernels with
Cuspy for the whole run, keeps the last num_steps steps in host memory, and
writes them as a Chrome trace every dump_freq steps to
profiling/always_on/iteration_N/rank{R}_trace.json.gz, so any recent step can
be looked at, not only a profiling window chosen up front.
torch's NodeTimerObserver records only each kernel's start, end, stream and
CUDA graph node -- no CPU events. At each step end the boundary is stamped in
CUPTI's record clock and the spans delivered so far are drained with a plain
(non-syncing) CUPTI flush and bucketed into their steps. Kernel names come from
each CUDA graph at instantiation, annotations from torch's CUDA graph
annotations, and lanes from torch's graph lane resolver where torch has one;
eager kernels are written unnamed. A dump skips the newest finished step,
whose kernels may still be running.
Kineto cannot initialize CUPTI while Cuspy holds it, so scheduled profiling
must use profiler.cuspy when always_on is set.
Overhead, steady-state steps 11-30, 5 interleaved runs each, no dumps:
- Llama3 8B FSDP2 x TP2 GraphTrainer on 4 GB300s (~3,900 kernels/step,
~0.58 s/step): median tps 14,119 -> 14,016 (-0.7%; -1.8% by mean, which one
slow run pulls down). The training-thread cost of each step's drain and
bucketing is ~1.5 ms (~0.3% of a step); the rest is CUPTI collection.
- Llama3 debugmodel on 1 GB300 (~600 kernels/step, ~7 ms/step): no
difference above run-to-run noise (+-10%); ~0.46 ms per step on the training
thread.
A dump runs on the training thread: writing 19 kept steps of the 8B run
(~74k kernels, 3.2 MB gzipped per rank) took 1.4 s.
Not included yet: dumps on demand or on failure, pftrace output, per-step
summaries, memcpy/memset spans, and names for eager kernels.
ghstack-source-id: ea130ed
Pull Request resolved: #5527
pianpwk
added a commit
that referenced
this pull request
Oct 19, 2026
Profiler.Config.always_on records every training step's GPU kernels with
Cuspy for the whole run, keeps the last num_steps steps in host memory, and
writes them as a Chrome trace every dump_freq steps to
profiling/always_on/iteration_N/rank{R}_trace.json.gz, so any recent step can
be looked at, not only a profiling window chosen up front.
torch's NodeTimerObserver records only each kernel's start, end, stream and
CUDA graph node -- no CPU events. At each step end the boundary is stamped in
CUPTI's record clock and the spans delivered so far are drained with a plain
(non-syncing) CUPTI flush and bucketed into their steps. Kernel names come from
each CUDA graph at instantiation, annotations from torch's CUDA graph
annotations, and lanes from torch's graph lane resolver where torch has one;
eager kernels are written unnamed. A dump skips the newest finished step,
whose kernels may still be running.
Kineto cannot initialize CUPTI while Cuspy holds it, so scheduled profiling
must use profiler.cuspy when always_on is set.
Overhead, steady-state steps 11-30, 5 interleaved runs each, no dumps:
- Llama3 8B FSDP2 x TP2 GraphTrainer on 4 GB300s (~3,900 kernels/step,
~0.58 s/step): median tps 14,119 -> 14,016 (-0.7%; -1.8% by mean, which one
slow run pulls down). The training-thread cost of each step's drain and
bucketing is ~1.5 ms (~0.3% of a step); the rest is CUPTI collection.
- Llama3 debugmodel on 1 GB300 (~600 kernels/step, ~7 ms/step): no
difference above run-to-run noise (+-10%); ~0.46 ms per step on the training
thread.
A dump runs on the training thread: writing 19 kept steps of the 8B run
(~74k kernels, 3.2 MB gzipped per rank) took 1.4 s.
Not included yet: dumps on demand or on failure, pftrace output, per-step
summaries, memcpy/memset spans, and names for eager kernels.
ghstack-source-id: ea130ed
Pull Request resolved: #5527
pianpwk
added a commit
that referenced
this pull request
Oct 19, 2026
Profiler.Config.always_on records every training step's GPU kernels with
Cuspy for the whole run, keeps the last num_steps steps in host memory, and
writes them as a Chrome trace every dump_freq steps to
profiling/always_on/iteration_N/rank{R}_trace.json.gz, so any recent step can
be looked at, not only a profiling window chosen up front.
torch's NodeTimerObserver records only each kernel's start, end, stream and
CUDA graph node -- no CPU events. At each step end the boundary is stamped in
CUPTI's record clock and the spans delivered so far are drained with a plain
(non-syncing) CUPTI flush and bucketed into their steps. Kernel names come from
each CUDA graph at instantiation, annotations from torch's CUDA graph
annotations, and lanes from torch's graph lane resolver where torch has one;
eager kernels are written unnamed. A dump skips the newest finished step,
whose kernels may still be running.
Kineto cannot initialize CUPTI while Cuspy holds it, so scheduled profiling
must use profiler.cuspy when always_on is set.
Overhead, steady-state steps 11-30, 5 interleaved runs each, no dumps:
- Llama3 8B FSDP2 x TP2 GraphTrainer on 4 GB300s (~3,900 kernels/step,
~0.58 s/step): median tps 14,119 -> 14,016 (-0.7%; -1.8% by mean, which one
slow run pulls down). The training-thread cost of each step's drain and
bucketing is ~1.5 ms (~0.3% of a step); the rest is CUPTI collection.
- Llama3 debugmodel on 1 GB300 (~600 kernels/step, ~7 ms/step): no
difference above run-to-run noise (+-10%); ~0.46 ms per step on the training
thread.
A dump runs on the training thread: writing 19 kept steps of the 8B run
(~74k kernels, 3.2 MB gzipped per rank) took 1.4 s.
Not included yet: dumps on demand or on failure, pftrace output, per-step
summaries, memcpy/memset spans, and names for eager kernels.
ghstack-source-id: 17fa6a0
Pull Request resolved: #5527
pianpwk
added a commit
that referenced
this pull request
Oct 19, 2026
Profiler.Config.always_on records every training step's GPU kernels with
Cuspy for the whole run, keeps the last num_steps steps in host memory, and
writes them as a Chrome trace every dump_freq steps to
profiling/always_on/iteration_N/rank{R}_trace.json.gz, so any recent step can
be looked at, not only a profiling window chosen up front.
torch's NodeTimerObserver records only each kernel's start, end, stream and
CUDA graph node -- no CPU events. At each step end the boundary is stamped in
CUPTI's record clock and the spans delivered so far are drained with a plain
(non-syncing) CUPTI flush and bucketed into their steps. Kernel names come from
each CUDA graph at instantiation, annotations from torch's CUDA graph
annotations, and lanes from torch's graph lane resolver where torch has one;
eager kernels are written unnamed. A dump skips the newest finished step,
whose kernels may still be running.
Kineto cannot initialize CUPTI while Cuspy holds it, so scheduled profiling
must use profiler.cuspy when always_on is set.
Overhead, steady-state steps 11-30, 5 interleaved runs each, no dumps:
- Llama3 8B FSDP2 x TP2 GraphTrainer on 4 GB300s (~3,900 kernels/step,
~0.58 s/step): median tps 14,119 -> 14,016 (-0.7%; -1.8% by mean, which one
slow run pulls down). The training-thread cost of each step's drain and
bucketing is ~1.5 ms (~0.3% of a step); the rest is CUPTI collection.
- Llama3 debugmodel on 1 GB300 (~600 kernels/step, ~7 ms/step): no
difference above run-to-run noise (+-10%); ~0.46 ms per step on the training
thread.
A dump runs on the training thread: writing 19 kept steps of the 8B run
(~74k kernels, 3.2 MB gzipped per rank) took 1.4 s.
Not included yet: dumps on demand or on failure, pftrace output, per-step
summaries, memcpy/memset spans, and names for eager kernels.
ghstack-source-id: 2fa3955
Pull Request resolved: #5527
pianpwk
added a commit
that referenced
this pull request
Oct 20, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.15.0) (oldest at bottom): * #5527 * #5526 * #5136 * __->__ #5525 Profiler.Config.cuspy switches CUDA activity collection from Kineto to Cuspy (PM sampling, environment counters, sync events, graph dependencies, event-node ids, and optional Perfetto protobuf output). Profiler startup raises a ValueError if torch or libcupti lacks Cuspy support. With CUDA graphs on, kernels replayed from graphs do not carry annotations in the Cuspy trace yet; the next PR in the stack captures graphs with a CUPTI annotation config to fix that.
pianpwk
added a commit
that referenced
this pull request
Oct 20, 2026
Profiler.Config.always_on records every training step's GPU kernels with
Cuspy for the whole run, keeps the last num_steps steps in host memory, and
writes them as a Chrome trace every dump_freq steps to
profiling/always_on/iteration_N/rank{R}_trace.json.gz, so any recent step can
be looked at, not only a profiling window chosen up front.
torch's NodeTimerObserver records only each kernel's start, end, stream and
CUDA graph node -- no CPU events. At each step end the boundary is stamped in
CUPTI's record clock and the spans delivered so far are drained with a plain
(non-syncing) CUPTI flush and bucketed into their steps. Kernel names come from
each CUDA graph at instantiation, annotations from torch's CUDA graph
annotations, and lanes from torch's graph lane resolver where torch has one;
eager kernels are written unnamed. A dump skips the newest finished step,
whose kernels may still be running.
Kineto cannot initialize CUPTI while Cuspy holds it, so scheduled profiling
must use profiler.cuspy when always_on is set.
Overhead, steady-state steps 11-30, 5 interleaved runs each, no dumps:
- Llama3 8B FSDP2 x TP2 GraphTrainer on 4 GB300s (~3,900 kernels/step,
~0.58 s/step): median tps 14,119 -> 14,016 (-0.7%; -1.8% by mean, which one
slow run pulls down). The training-thread cost of each step's drain and
bucketing is ~1.5 ms (~0.3% of a step); the rest is CUPTI collection.
- Llama3 debugmodel on 1 GB300 (~600 kernels/step, ~7 ms/step): no
difference above run-to-run noise (+-10%); ~0.46 ms per step on the training
thread.
A dump runs on the training thread: writing 19 kept steps of the 8B run
(~74k kernels, 3.2 MB gzipped per rank) took 1.4 s.
Not included yet: dumps on demand or on failure, pftrace output, per-step
summaries, memcpy/memset spans, and names for eager kernels.
ghstack-source-id: 44a0616
Pull Request resolved: #5527
pianpwk
added a commit
that referenced
this pull request
Oct 20, 2026
Profiler.Config.always_on records every training step's GPU kernels with
Cuspy for the whole run, keeps the last num_steps steps in host memory, and
writes them as a Chrome trace every dump_freq steps to
profiling/always_on/iteration_N/rank{R}_trace.json.gz, so any recent step can
be looked at, not only a profiling window chosen up front.
torch's NodeTimerObserver records only each kernel's start, end, stream and
CUDA graph node -- no CPU events. At each step end the boundary is stamped in
CUPTI's record clock and the spans delivered so far are drained with a plain
(non-syncing) CUPTI flush and bucketed into their steps. Kernel names come from
each CUDA graph at instantiation, annotations from torch's CUDA graph
annotations, and lanes from torch's graph lane resolver where torch has one;
eager kernels are written unnamed. A dump skips the newest finished step,
whose kernels may still be running.
Kineto cannot initialize CUPTI while Cuspy holds it, so scheduled profiling
must use profiler.cuspy when always_on is set.
Overhead, steady-state steps 11-30, 5 interleaved runs each, no dumps:
- Llama3 8B FSDP2 x TP2 GraphTrainer on 4 GB300s (~3,900 kernels/step,
~0.58 s/step): median tps 14,119 -> 14,016 (-0.7%; -1.8% by mean, which one
slow run pulls down). The training-thread cost of each step's drain and
bucketing is ~1.5 ms (~0.3% of a step); the rest is CUPTI collection.
- Llama3 debugmodel on 1 GB300 (~600 kernels/step, ~7 ms/step): no
difference above run-to-run noise (+-10%); ~0.46 ms per step on the training
thread.
A dump runs on the training thread: writing 19 kept steps of the 8B run
(~74k kernels, 3.2 MB gzipped per rank) took 1.4 s.
Not included yet: dumps on demand or on failure, pftrace output, per-step
summaries, memcpy/memset spans, and names for eager kernels.
ghstack-source-id: 1569cab
Pull Request resolved: #5527
pianpwk
added a commit
that referenced
this pull request
Oct 20, 2026
) Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.15.0) (oldest at bottom): * #5527 * #5526 * __->__ #5136 When Cuspy profiling is enabled, capture the forward-backward and optimizer CUDA graphs with an annotation config (backend="cupti") so kernels replayed from graphs keep their mark_kernels metadata in the Cuspy trace. The CUDA graph wrappers take an annotation_config that is passed through to torch.cuda.graph; it stays None, preserving current behavior, unless profiler.cuspy is set. key_by="auto" keys annotations to the capture graph, which Cuspy resolves through CUPTI's sourceGraphNodeId. Cuspy resolves graph event-record nodes only by exec-graph id, so enable_event_node_ids keys by the exec graph instead. This starts Cuspy's CUPTI subscription at the first capture and holds it for the rest of the run, so other CUPTI tools (Nsight Systems, dynolog) can't attach to that process.
This branch has not been deployed
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.
Stack from ghstack (oldest at bottom):
Profiler.Config.always_on records every training step's GPU kernels with
Cuspy for the whole run, keeps the last num_steps steps in host memory, and
writes them as a Chrome trace every dump_freq steps to
profiling/always_on/iteration_N/rank{R}_trace.json.gz, so any recent step can
be looked at, not only a profiling window chosen up front.
torch's NodeTimerObserver records only each kernel's start, end, stream and
CUDA graph node -- no CPU events. At each step end the boundary is stamped in
CUPTI's record clock and the spans delivered so far are drained with a plain
(non-syncing) CUPTI flush and bucketed into their steps. Kernel names come from
each CUDA graph at instantiation, annotations from torch's CUDA graph
annotations, and lanes from torch's graph lane resolver where torch has one;
eager kernels are written unnamed. A dump skips the newest finished step,
whose kernels may still be running.
Kineto cannot initialize CUPTI while Cuspy holds it, so scheduled profiling
must use profiler.cuspy when always_on is set.
Overhead, steady-state steps 11-30, 5 interleaved runs each, no dumps:
~0.58 s/step): median tps 14,119 -> 14,016 (-0.7%; -1.8% by mean, which one
slow run pulls down). The training-thread cost of each step's drain and
bucketing is ~1.5 ms (~0.3% of a step); the rest is CUPTI collection.
difference above run-to-run noise (+-10%); ~0.46 ms per step on the training
thread.
A dump runs on the training thread: writing 19 kept steps of the 8B run
(~74k kernels, 3.2 MB gzipped per rank) took 1.4 s.
Not included yet: dumps on demand or on failure, pftrace output, per-step
summaries, memcpy/memset spans, and names for eager kernels.