Repository navigation
[profiler] Drop enable_event_node_ids: torch's CuspyConfig removed it - #6390
Conversation
PyTorch nightly removed CuspyConfig.enable_event_node_ids (pytorch/pytorch#206322): Cuspy now reads CUPTI's native graph fields for event-record nodes, and their spans come with enable_cuda_sync_events. Passing the kwarg fails every CPU unit test run (TypeError in test_cuspy_activity_config), so drop the field; annotations always key by the capture graph (key_by=auto).
|
@claude review |
There was a problem hiding this comment.
Verdict: Approve -- upstream removed CuspyConfig.enable_event_node_ids, so the torchtitan knob has nothing left to control. Deleting it, rather than gating on the torch version, is the right fix.
What this PR does. It removes CuspyTraceProfiler.Config.enable_event_node_ids and stops passing it to torch.profiler.CuspyConfig. Graph annotations are now always keyed by the capture graph (key_by="auto"). The "exec" keying existed only so Cuspy could resolve event-record nodes by exec-graph id, which upstream no longer does. Tests and the observability README are updated to match.
Example.
# Before, on a nightly that includes pytorch/pytorch#206322:
CuspyTraceProfiler.Config() # any Cuspy run
# -> profile_activities() calls CuspyConfig(..., enable_event_node_ids=False)
# -> TypeError: unexpected keyword argument 'enable_event_node_ids'
# (seen as test_cuspy_activity_config failing on unrelated PRs)
# After:
CuspyTraceProfiler.Config(enable_cuda_sync_events=True)
# -> CuspyConfig(enable_cuda_sync_events=True, enable_environment_counters=False,
# enable_graph_dependencies=False); annotations use key_by="auto"Details
- Callsites:
enable_event_node_idsandkey_by="exec"have no other references in the repo (checkedtorchtitan/,torchtitan_recipes/,tests/,scripts/,.claude/,.github/). Nothing is left stale. test_cuspy_activity_confignow usesenable_graph_dependenciesas its pass-through probe. It still builds a realCuspyConfig, so a future upstream field removal will still fail there. The deletedtest_trainer.pycase covered only the removed"exec"branch, so dropping it loses no coverage.- On torch nightlies that still have the field, it defaults upstream, so behavior there matches the old
enable_event_node_ids=Falsedefault. - No numerics, metric-key, or main-path impact: this is profiler-only config.
Not verified: on a GPU with the new nightly, that CUDA-graphed NCCL event-record nodes show up under enable_cuda_sync_events and resolve with key_by="auto". This depends on CUPTI/driver 13.5+, per the upstream PR. A maintainer still needs to review.
…again #5792 and #6390 merged 10 minutes apart and conflict at the meaning level: #5792 calls get_cuspy_cuda_graph_annotation_config(enable_event_node_ids=True), and #6390 removed that kwarg. Kernel spans look annotations up by exec-graph node id, so pass key_by explicitly: "auto" for the Cuspy trace, "exec" for kernel spans.
…again (#6395) ## Summary (human-written) <!-- Write this yourself, not with an AI tool. 2-5 sentences: the problem, why this approach, and what you checked yourself. --> ## Why #5792 and #6390 merged 10 minutes apart and conflict at the meaning level; git merged them cleanly. #5792 added a kernel-spans call `get_cuspy_cuda_graph_annotation_config(enable_event_node_ids=True, ...)`. #6390, branched before #5792 landed, removed that kwarg. So `main` (a71e607) fails: ``` lint: ERROR Unexpected keyword argument `enable_event_node_ids` in function `torchtitan.distributed.accelerator_graph.get_cuspy_cuda_graph_annotation_config` --> torchtitan/observability/profiler.py:541:21 test: tests/unit_tests/cpu/test_trainer.py::test_training_engine_configures_gradient_accumulation_accelerator_graph (kernel_spans case) TypeError, same kwarg ``` The lint failure shows up on every open PR, since pyrefly checks the whole project. Dropping the kwarg at the call would not be enough. In #5792's helper, `enable_event_node_ids=True` also meant `key_by="exec"`, and kernel spans need that for a reason of their own: `KernelSpanRecorder._record_graph_nodes` looks annotations up by the exec graph's node ids (`tools_id`), the ids CUPTI reports for replayed kernels. With `key_by="auto"`, annotations are keyed by capture-graph ids wherever CUPTI supports `sourceGraphNodeId`, so the lookup would silently find nothing. ## What changed - `get_cuspy_cuda_graph_annotation_config` takes a required `key_by: Literal["auto", "exec"]`. - `CuspyTraceProfiler` passes `"auto"`, as after #6390. Kernel spans pass `"exec"`, as before #6390. **Example.** ``` before #6390 main today this PR Cuspy trace only auto auto auto kernel spans (+ trace) exec TypeError exec ``` ## Testing - `pytest tests/unit_tests/cpu/test_trainer.py tests/unit_tests/cpu/observability`: 210 passed, 1 skipped. This includes the kernel-spans case of `test_training_engine_configures_gradient_accumulation_accelerator_graph`, which expects `key_by: "exec"` and is unchanged. - Pyrefly reports no errors in the touched files.
Port the Cuspy configuration and golden-loss updates from pytorch#6390 and pytorch#6398. Use the GPT-OSS attention backend split from pytorch#6400 so varlen LSE backward runs on FA4 hardware. Select both Gloo and NCCL for the Muon CPU-offload test mesh.
Summary (human-written)
Why
PyTorch nightly removed
torch.profiler.CuspyConfig.enable_event_node_ids(pytorch/pytorch#206322). Cuspy now reads CUPTI's native CUDA graph fields for event-record nodes, and their spans come withenable_cuda_sync_events. torchtitan still passes the kwarg, so every CPU unit test run against the new nightly fails:It shows up on unrelated PRs from about 10:00 UTC on 2026-11-25, e.g. #6385 and
shuhuayu/k3-dm-stack-05.What changed
CuspyTraceProfiler.Config.enable_event_node_idsis removed, and is no longer passed toCuspyConfig.get_cuspy_cuda_graph_annotation_configalways keys annotations by the capture graph (key_by="auto"). The exec-graph keying existed only because Cuspy used to resolve event-record nodes by exec-graph id.User-facing changes
CuspyTraceProfiler.Config(enable_event_node_ids=True)enable_cuda_sync_events=TrueTesting
pytest tests/unit_tests/cpu/observability/test_profiler.py tests/unit_tests/cpu/test_trainer.py: 63 passed, on torch 2.16.0.dev20261030, which still has the field. The new code passes no kwarg the new nightly lacks.key_by="auto"relies on upstream's native graph fields (CUPTI and driver 13.5+, per the upstream PR).