Skip to content

[Bugfix] Key CUDA graph dedup signatures on kernel function identity - #37657

Merged
cctry merged 1 commit into
sgl-project:mainfrom
cctry:cuda-graph-dedup-kernel-identity
Sep 2, 2026
Merged

cctry merged 1 commit into
sgl-project:mainfrom
cctry:cuda-graph-dedup-kernel-identity

Conversation

@cctry

@cctry cctry commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

cudaGraphExecUpdate keeps the exec's originally instantiated values for launch attributes that cuGraphKernelNodeGetAttribute cannot read back (e.g. CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION) and reports success instead of cudaGraphExecUpdateErrorAttributesChanged. We root-caused a deterministic hang on GB300 to this: updating an exec from a cuBLASLt kernel captured with preferred cluster (4,1,1) to a variant without fallback-cluster support launches it under 4-CTA clusters and deadlocks in an mbarrier wait.

The dedup registry keys exec groups on kernel name + geometry + queryable attributes, but names are not identities: JIT compilers (triton, torch.compile) can emit different kernels with identical names from different modules, so an exec-update could still cross functions whose capture-only attributes differ.

Modifications

Add the kernel/function handles to kernel_node_payload so only launches of the same loaded function share a graph exec. One-line diff; dedup coverage is unchanged for real workloads since repeated captures of the same kernel reuse the same handles.

Checklist

Verified on GB300: same-kernel captures still produce equal signatures (dedup preserved); two modules loaded from identical PTX (same name/geometry, different functions) now produce different signatures.


CI States

Latest PR Test (Base): ❌ Run #33684248365
Latest PR Test (Extra): ❌ Run #33684248154
Latest PR Test (AMD ROCm 7.2): ❌ Run #33684248469

@cctry
cctry force-pushed the cuda-graph-dedup-kernel-identity branch from 0ff4af1 to 8acd2be Compare September 2, 2026 21:03
Kernel names are not identities: JIT compilers can emit different
kernels with identical names from different modules, and
cudaGraphExecUpdate keeps the exec's original values for launch
attributes it cannot diff (e.g. preferred cluster dimension), reporting
success instead of cudaGraphExecUpdateErrorAttributesChanged. On GB300
a stale preferred cluster (4,1,1) deadlocks the updated kernel in an
mbarrier wait. Include the kernel/function handles in the dedup
signature so only same-function launches share an exec.
@cctry
cctry force-pushed the cuda-graph-dedup-kernel-identity branch from 8acd2be to 8e708cb Compare September 2, 2026 21:16
@cctry
cctry marked this pull request as ready for review September 2, 2026 21:20
@cctry
cctry merged commit ad6e830 into sgl-project:main Sep 2, 2026
107 of 123 checks passed
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…-prefill-graph(-split/-tiny/-max-prefix), --p-deep-split-from

Picks der 27B-Linie in Reihenfolge (alle Schalter Default aus, P-Env/argv ohne Flag
byte-gleich): upstream-Ports bac77bc (sgl-project#37657) eb6d7d6 (sgl-project#34184) dc9fbf9
(sgl-project#32219 Teil) als Voraussetzung des Prefill-Graphen; 5fd4e77 5d8612b 02e218f
d24a17d 6b24aa6 3e093fe (P-Host-Overlap, #PGAP, P-NOSYNC); d32ddcb fb7ea2b
37ea1db 3e6ce57 (P-Prefill-Graph); 735db6a (+ 4e03821 als reine Verschiebung
durch die Auflösung erledigt) f49f2fd 51e39d4 dc128e3 18639ea.

Konfliktauflösungen:
- scheduler_pp_mixin: NF H49 PP-HOST-PERIOD und 27B P-HOST-OVERLAP komponiert (die im
  Inventar genannte Doppel-Instrumentierung): H49 note_launch/note_no_batch/note_sync
  bleiben, der d2h-Wait steht zusätzlich im #PGAP-Span, deferred publish + Lead-Bound
  nach dem Launch wie 27B. Beide Instrumente getrennt schaltbar (H49-Env / --p-host-overlap).
- unified_radix_cache: Chunk-Publish unter H2-sync_trace UND #PGAP-Span.
- launcher common_flags: p_chunked_prefill_tokens() = Graph-Bucket oder
  P_CHUNKED_PREFILL_TOKENS (NF-Env, Default = Konstante; 27B byte-gleich).
- argv_p: NF p_micro_batch_flags + 27B p_prefill_graph_flags() vor extra/H25-Strip.
- solve_p_cut: prefill_graph_pool_mib neben NF sgl-project#114 activation_reserve.
- --d-replayssm-spec der 27B-Hunks nicht doppelt registriert (NF-Form bleibt).

Tests (test27b.sh): 20 portierte Testdateien 204 passed, 2 skipped;
test_weg2_vision_prefill_graph_seam_0924 nicht gelaufen (Boot aktiv, incg-Schlange),
nachzufahren. dup_defs_gate: 0 neu.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant