Skip to content

[Triton/Gluon] Move fast_launch to utils and key what Triton specializes on - #8061

Merged
valarLip merged 12 commits into
mainfrom
lingzha/shared-triton-fast-launch
Nov 24, 2026
Merged

valarLip merged 12 commits into
mainfrom
lingzha/shared-triton-fast-launch

Conversation

@ZLkanyo009

@ZLkanyo009 ZLkanyo009 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

This PR makes AITER's KDA launch cache a shared fast_launch helper for Triton and Gluon callers. It also fixes cache keys and guards that could reuse a specialization for different argument types or skip Triton hooks. ROCm/ATOM#3431 uses this helper for its prefill wrappers and remains a draft until this PR lands.

A cache miss previously called Triton's binder once for the normal launch and again to build the saved launch entry. The entry-construction change at cdf8131f removes that second call: parameter names and defaults are fixed at construction, and the entry reads the last real launch's hook arguments. The cached hit path is unchanged.

Technical details

  • Move fast_launch from the KDA kernel directory to aiter/ops/triton/utils/fast_launch.py. KDA and the gfx950/gfx1250 Gluon K1/K2 callers import the shared helper.
  • Exact keys include the device, Triton compile knobs, argument layout, non-tensor types/values, tensor dtype, 16-byte alignment and the 2 GiB storage bit. Wrapped kernels also key tensor shape and strides by default.
  • by_specialization=True is restricted to plain JIT kernels. It keys runtime scalars by Triton's specialization classes; constexprs and launch options remain keyed by type/value. This lets changing prefill sizes share a compiled entry.
  • key_shapes=False omits tensor shape/stride keys only where heuristics do not read them. KDA's heuristics only test for None; its autotune keys contain ints, bools and tensor dtypes. A heuristic may read dtype or 16-byte alignment. Full data pointers, storage offsets and tensor values are not keyed.
  • Launches with active hooks, torch.compile tracing, a config pre-hook, tuple/unhashable arguments or interpreted kernels use the ordinary path. The fpsan knob is read only on Triton builds that have it. An out-of-range integer fails that call without disabling future caching.
  • Each entry keeps the compiled launcher, parameter names, omitted arguments and the names after positional arguments. Defaults come from jit.signature; heuristic/autotune choices come from the last real pre-run hook. Omitted argument values are kept by identity. There is no second binder or device-cache lookup in _capture.
  • The driver getters and per-layout argument pickers are bound once. Device/stream values are read per launch. Cached globals are checked by identity, with Triton's equality check after a rebind; an in-place global change, including a Gluon layout list field, is not detected on a hit.

The separate launch cache in fusions/attn_res.py is outside this PR. Existing limits also remain: a heuristic overriding a caller-supplied keyword sees the caller value on a hit; extra positional *args are flattened on a hit; reinterpret arguments are keyed by identity; pre-run hooks are shared between threads.

Test plan

  • The helper tests compare equal keys with Triton's own binder/cache key for the listed argument variants, key modes and buffer-ops settings. The check fails when Triton distinguishes two tested variants that this key merges; it does not prove coverage of every future specialization.
  • Exercise actual launches and cache hits, omitted defaults and empty varargs, positional/mixed/keyword calls, shape/stride heuristics, specialization, hooks, globals, scalar overflow, interpreted kernels, torch.compile and CUDA graphs.
  • Check all four KDA launchers' config assumptions and run the KDA numerical tests and downstream ATOM wrapper tests on AMD Triton 3.8.0 and upstream 3.7.1.
  • At cdf8131f, compare saved names, frozen-value identities, remaining parameter names and hit argument identities against the previous binder calculation after real launches. Add local signature probes for defaults, keyword-only parameters, do_not_specialize, specialization, heuristics/two-config autotune, *args, and recorded Gluon K1/K2 wrapper calls.
  • Measure warm-JIT/autotuner cache misses before/after, clearing only the wrapper cache; use paired processes on the same pinned core and same-file controls. Report thread CPU time separately from kernel latency.

Omitted-argument regression validation

Revision: a2dc96f08c421d226c337829811f436323ba89bb (review 5992833462 follow-up). This revision adds four committed GPU cases and corrects four comments; the production module's AST is unchanged from cdf8131f.

Two independent kernels cover omitted BLOCK: tl.constexpr = 64 and runtime SCALE=2.0, with and without empty *rest, in exact and by_specialization modes. Each uses a bypassed ordinary launch as its reference, launches with only (x, out, n), records one capture, poisons the output with NaNs, and requires the second launch to have an empty recording and match both the reference and 2*x exactly. A TypeError from the ordinary varargs launch skips only that varargs case; ordinary-default coverage remains enabled.

Local MI308X/gfx942 validation on 2026-11-20, 20:11:59–20:13:05 UTC:

Check AMD Triton 3.8.0 Upstream Triton 3.7.1
New omitted-argument cases 4 passed 2 passed, 2 skipped
Entire utils + KDA test_fast_launch.py files 83 passed, 1 skipped 80 passed, 4 skipped

The AMD full-suite skip needs a second GPU. Upstream also skips the absent fpsan knob and the two ordinary-varargs cases. The default-only cases pass on both builds.

Three temporary, process-local mutants of the exact reviewer expressions were run against the four committed cases on AMD:

Mutation Result
kw.get(n, default) → kw.get(n) 4 failures: the cached hit gives the grid BLOCK=None
kw.get(n, default) → kw[n] 4 failures: entry capture raises KeyError for BLOCK or rest
() if p.kind is p.VAR_POSITIONAL else p.default → p.default 2 empty-rest failures on the cached hit: the real AMD launcher rejects inspect.Parameter.empty as a sequence; the 2 ordinary-default cases pass

These are real test-call failures, with no setup/collection errors or mutant skips. The mutants only patch the individual test process; no product/overlay mutation remains. This coverage is separate from the local old-binder oracle and historical mutation sweeps below.

Black 26.10.1, Ruff 0.16.0, AST parsing and diff-check pass. No performance, serving, GSM8K, flash_kda or downstream ATOM rerun was needed for this test/comment change. Their earlier measurements retain the original revisions below. As of 2026-11-24 08:52 UTC, head a2dc96f08c421d226c337829811f436323ba89bb reports 37 successful and 17 skipped checks, with none failed or pending; Aiter Test and Triton Test completed successfully. The skipped downstream ATOM/SGLang/vLLM checks do not establish downstream coverage. Human re-review remains pending.

Entry-construction validation at cdf8131

Revision: cdf8131f7306bcc994953c4b6590e8503f05be3b. On MI308X/gfx942:

Check AMD Triton 3.8.0 Upstream Triton 3.7.1
utils + KDA fast_launch + flash_kda tests 166 passed, 11 skipped 165 passed, 12 skipped
Downstream ATOM fast_launch wrapper tests 163 passed 163 passed
Local extended signature probes 40 passed 40 passed
Binder identity comparisons during the main suite 218 captures 218 captures
Binder identity comparisons during extended probes 48 captures 42 captures

The main suite's capture counts are 47 axpy, 1 counted-global, 54 KDA prepare, 9 KDA scan, 105 KDA segment and 2 offset launches per version. Extended probes include 24 Gluon captures per version: K1, K2 AB and K2 C for both gfx950/gfx1250, shape-key option on/off and two pointer configurations. These use the actual wrapper arguments and JIT pre-run hooks, then stop before compilation; they do not execute gfx950/gfx1250 kernels on MI308X.

AMD's extended probes also run keyword-only numerical calls and check four varargs captures. On the 3.7.1 wheel, direct JIT compilation of the keyword-only constexpr probe fails with BLOCK is not defined, so only its binding is checked. The same wheel rejects the tested empty/extra-varargs calls before compilation; direct JIT and fast_launch both raise TypeError and leave no wrapper entry. These are baseline wheel limits.

At cdf8131f, three temporary in-memory binding mutants were checked on AMD 3.8.0: ignoring hook values fails 3 cases; dropping defaults fails 10; losing the empty-varargs default fails 2. Each fails the independent old-binder comparison, with no source or overlay mutation left behind. This is separate from the historical 40-guard mutation sweep below, which was not repeated at cdf8131f or in this follow-up.

At cdf8131f, a local GPU-unavailable-after-collection simulation collected 56 helper tests: 1 passed and 55 skipped on each Triton version. The interpreter case is the one passing test. These counts apply only to that 56-case revision; the simulation was not rerun after adding the four omitted-argument cases. It does not establish that the package imports on a physically GPU-free host, because package collection itself asks the Triton driver for a target.

At cdf8131f, Black 26.10.1, Ruff 0.16.0 and diff-check passed. No new serving/GSM8K run was made: that revision changes host-side entry construction and documentation; real KDA and ATOM kernel-wrapper regression suites cover the affected launch path. The end-to-end measurements below retain their original revision labels.

Paired miss and hit measurement at cdf8131

Comparison: 36ddc4daa → cdf8131f7306bcc994953c4b6590e8503f05be3b, AMD Triton 3.8.0, MI308X/gfx942. Times are host thread CPU microseconds per call (time.thread_time_ns), not GPU execution time or end-to-end latency. Each pair uses two processes sharing one pinned CPU core; cores 20/21 and the starting version alternate. This project had no other benchmark/test workload during the run; unrelated host/GPU jobs remained, so the same-file controls quantify observed drift.

Misses use real KDA prepare/segment launches and recorded call-site arguments. Only the wrapper cache is cleared; JIT/autotuner caches are warm. There are 8 pairs per row, with each process reporting the median of 15 rounds × 300 calls.

Miss comparison First median, µs Second median, µs Paired delta median, µs Paired delta range, µs
prepare old → new 99.039 73.642 −26.002 [−28.971, −24.692]
prepare old → old control 99.433 99.359 +0.326 [−3.403, +1.774]
prepare new → new control 73.427 73.576 +0.509 [−1.262, +2.098]
segment old → new 123.075 90.906 −31.810 [−33.384, −29.625]
segment old → old control 124.504 123.176 −1.313 [−2.675, +1.427]
segment new → new control 90.615 90.249 −0.396 [−2.160, +1.002]

The version columns are separate medians; the delta is the median of the per-pair differences, so it need not equal the subtraction of the two column medians. Relative to the old column median, the paired delta is −26.3% for prepare and −25.8% for segment. No new comparison against main is claimed.

Hits use the real JIT definitions, wrapper arguments and global-dependency metadata, with a stub compiled entry, driver and no-op launcher. There are 4 pairs per row, each process reporting the median of 15 rounds × 5000 calls.

Hit comparison First median, µs Second median, µs Paired delta median, µs Paired delta range, µs
prepare old → new 12.699 12.764 +0.059 [−0.159, +0.153]
segment old → new 18.036 18.079 +0.006 [−0.168, +0.175]
Gluon K1 gfx950 old → new 14.241 14.104 −0.079 [−0.141, +0.041]
Gluon K1 gfx1250 old → new 14.316 14.192 −0.126 [−0.235, +0.048]
prepare new → new control 12.640 12.671 +0.034 [−0.158, +0.176]
segment new → new control 18.168 18.218 −0.013 [−0.280, +0.254]

The hit source path is unchanged; these small differences overlap the observed controls and do not establish a hit-path improvement. Every pair completed successfully. The diagnostic binding oracle was disabled during all timings.

Historical validation (before cdf8131)

All runs were on one MI308X (gfx942). This branch was installed as a symlink overlay over the image's aiter; the kimi_delta_attn and utils files of the image are the same as on main. Triton is AMD's 3.8.0 build unless stated.

  • op_tests/triton_tests/utils/test_fast_launch.py at 36ddc4daa: 56 passed. On the upstream Triton 3.7.1 wheel: 55 passed, 1 skipped (the fpsan knob case). The 4 tests added at d0ec01df6 fail on 7324631fc's fast_launch.py; the two globals tests added at a68d79af0 fail on d0ec01df6's. The 144-state hook test also passes on a68d79af0's fast_launch.py, so the inlined checks dispatch as before. The former GPU-unavailable skip count was stale; the 56-case simulation at cdf8131f is reported above. (On a host with no GPU at all, op_tests/triton_tests/__init__.py fails to import, as on main: mla_decode_ref.py asks the Triton driver for its target.) At 1b63b6344 the 3.7.1 wheel gave 40 failed, 1 passed.

  • kimi_delta_attn test_fast_launch.py + test_flash_kda.py at 36ddc4daa: 110 passed and 11 skipped on both Triton builds (106 and 11 with the image's aiter; the 4 new cases are the launcher checks). The skips are the Gluon K2 / pass C routes, which gfx942 does not use, and the two-GPU test. On the 3.7.1 wheel, kimi_delta_attn test_fast_launch.py: 23 passed, 1 skipped (19 and 1 with the image's aiter; at 1b63b6344: 19 failed). I did not run the gfx950 / gfx1250 Gluon files; their only change is the import line.

  • CI at 1b63b6344 (MI35X, AMD Triton 3.8.0): utils/test_fast_launch.py 41 passed, kimi_delta_attn test_fast_launch.py 19 passed and 1 skipped (Triton shard 3).

  • Mutation check at 36ddc4daa, 40 mutants of fast_launch.py. The first 17 remove the type, the knobs, the == 1 case, the int width, the alignment bit, the storage bit, the launch-enter hook check, the globals check, the config pre_hook check, the wrapped-kernel shape key and the tuple check; they move the is_compiling() check to the end of the hook condition or remove it; they read the stream once instead of on each call; they read the fpsan knob on every build; and they drop both launch-hook checks or count an empty chain as a hook. The next 9 remove the alignment or storage bit in the by_specialization loop or the type in the exact loop. They look up the layout without the keyword names, or shift the names after the positional arguments by one. They key a constexpr tensor by identity, either by dropping the check or by skipping it after the first launch. They drop the constexpr types, or bind a stale stream getter. 3 more ignore key_shapes, raise TypeError again for an out-of-range int, or do not turn the cache off for an interpreted kernel. 5 run the full globals comparison on every hit, treat a rebind as a change without the comparison, never compare after a rebind, never refresh the objects seen, or drop the keyword arguments from a keyword-only callable grid. The last 6 test the exit hook with type(h) is HookChain, drop the exit-hook, stages-hook or pre-run-hook check, drop the stride from the wrapped-kernel key, or collect no autotuner in __init__. On the 3.7.1 wheel all 40 fail at least one test. On AMD's 3.8.0, 39 fail; the unconditional fpsan read passes there, because that build has the knob. The 9 mutants of flash_kda.py all fail test_no_config_choice_reads_a_shape alone on both builds; 4 of them (a heuristic on shape[0] > 1, numel() > 8, dim() == 2 or shape[0] <= 64) passed the version of that test at a68d79af0.

  • [Sgl Atom][Native][perf] cut Qwen4Exp prefill host overhead: HC, GDN, output-gate, QSA and q/k-norm Triton wrappers on aiter's fast_launch ATOM#3431 at 943dae39f on 36ddc4daa: its 163 wrapper tests pass on both Triton builds, with no change on the ATOM side.

  • ruff 0.16.0 and black are clean.

  • Host time, µs per launch (median of 7 × 16 calls, 3 runs), measured at 7c54c82f4:

    µs
    kernel[grid](...) 20.4–21.6
    fast_launch before this PR, keywords 12.3–12.9
    this PR, exact, keywords 14.3–15.2
    this PR, exact, positional 12.5–13.4
    this PR, by_specialization, positional 13.5–14.5

    The new guards and knob reads cost about 2 µs. About 0.4 µs of this is the two env-backed knobs, which Triton also reads on each call.

Historical hit-path host overhead

ROCm/ATOM#3431 replaces ATOM's CachedLauncher with fast_launch(kernel, by_specialization=True) for 20 prefill kernels. That is about 600 launches per forward. A host-time hook measured this in service (the hook adds 1.1–1.5 µs per call to both). At 6cccc0974, a hit cost 4.3–4.8 µs more per launch than CachedLauncher: 33.5–34.4 vs 29.3–29.6 µs. That is about +2.5–2.9 ms per forward. 7324631fc removes most of this.

Host time per call, µs (median of 3000 calls, mean of 3 interleaved rounds, one MI308X, one pinned CPU core), measured on 7324631fc. The 7 wrappers are HC combine_norm / gated_mean, scaled_silu, sigmoid_rmsnorm_quant, fused_qk_norm, fused_gdn_gating and l2norm_fwd, at the shapes of one 2112-token prefill at TP2. The ATOM trees are local merges of the ATOM PR branches: one before review, with CachedLauncher, and one after review, with ROCm/ATOM#3429 at fa5ebfe15 and #3431 at 943dae39f. Both use the same aiter build, which has this branch at 6cccc0974 and other open aiter PRs. Only fast_launch.py is replaced for the last column.

sum of the 7 wrappers CachedLauncher 6cccc0974 7324631fc
hot loop (each wrapper alone) 154.3 169.7 159.2
interleaved (the wrappers in turn, closer to a forward) 191.5 209.6 194.0

A rerun on d0ec01df6 with the same setup and the same aiter build (another GPU and session): CachedLauncher 154.0 / 191.3, 7324631fc 161.0 / 197.7, d0ec01df6 159.0 / 193.5 (hot / interleaved). The ATOM wrappers use by_specialization, whose path d0ec01df6 does not change. On a68d79af0 (same setup, GPU 1): CachedLauncher 155.6 / 195.6, d0ec01df6 159.6 / 198.7, a68d79af0 158.8 / 198.4. On 36ddc4daa (same setup, GPU 1, 3 rounds): CachedLauncher 153.3 / 192.7, a68d79af0 158.5 / 200.2, 36ddc4daa 157.6 / 193.5. These kernels read no globals.

At 7324631fc, the measured hit was about 0.7 µs (hot) and 0.4 µs (interleaved) slower than CachedLauncher, down from 2.2 and 2.6 µs. The likely remainder is the keyword launch options (num_warps=...). CachedLauncher bound them when it was built, and fast_launch reads them on each call. Not measured one by one.

Historical KDA and Gluon K1 hit

Host time of one hit, µs, measured at 36ddc4daa against the fast_launch on main (e89e5b6cc) and against a68d79af0. The kernels are the real ones: the Gluon K1 k1_prepare_gluon of gfx950 and of gfx1250 (a plain @gluon.jit with 15 / 14 layout globals), called with the keyword arguments its gluon_k1_prepare passes, and the four flash_kda Triton launchers, called with the keyword arguments and grid recorded from one flash_kda_fwd call (varlen, segmented, 2112 tokens). The first call stores an entry with a no-op launcher, so only the key and the hit path are timed, and the kernel's used_global_vals is filled as a compile does. The driver is a stub. Each pair of versions runs as two processes, one version each, time-sharing one pinned core; the core (two cores) and the launch order alternate over 8 runs, and each process reports the median of 15 rounds of 5000 calls in its own thread CPU time (wall time would hold the other process's slices). The table gives the medians over the 8 runs. Same-file controls (main against main, 36ddc4daa against itself) are within −0.12 to +0.07 µs.

launch main, µs a68d79af0 − main 36ddc4daa − main 36ddc4daa − a68d79af0
Gluon K1 gfx950 13.1–13.3 +1.11 (+8.3%) +1.05 (+7.9%) −0.07
Gluon K1 gfx1250 13.1 +1.25 (+9.5%) +1.13 (+8.6%) −0.22
prepare 12.4 +0.33 (+2.7%) −0.02
segment (pass C) 17.8–17.9 +0.24 (+1.3%) −0.07
seg_scan 6.4–6.5 +0.88 (+13.6%) +0.74 (+11.4%) −0.22
seg_scan_prefetch 6.4–6.5 +0.89 (+13.8%) +0.82 (+12.7%) −0.13

The inlined hook checks save up to 0.22 µs in that measured revision. The rest of the fixed per-hit work is reads that the key or the guards need: torch.compiler.is_compiling() (about 90 ns), the env-backed amd.use_buffer_ops knob (about 180 ns; Triton reads it on each launch too), and the 5 attribute reads of the hook checks (about 25 ns each). For Gluon K1, the identity check over 14–15 globals costs about 0.8 µs (at a68d79af0); the equality check it replaced cost about 8.5 µs.

Host time of one miss, µs, on the GPU: the kda_prepare and kda_segment launchers with the keyword arguments and grid recorded from one flash_kda_fwd call that launches everything. Each timed call empties the wrapper's cache first, so it is a miss that compiles nothing (Triton's and the autotuner's caches are warm), as in a prefill with a new T. Same method as above (8 runs, 15 rounds of 300 calls, thread CPU time); same-file controls are within −0.27 to +0.30 µs.

launch main, µs a68d79af0 − main 36ddc4daa − main 36ddc4daa − a68d79af0
kda_prepare 93.8–94.3 +8.2 (+8.8%) +5.4 (+5.7%) −2.6
kda_segment 117.1–117.6 +7.5 (+6.4%) +6.2 (+5.3%) −3.5

Most of the rest is the tuple scan: with it removed, a miss measured +3.3 µs (prepare) and +4.2 µs (segment) against main, in process. The scan costs about 55 ns per argument, mostly in isinstance on the non-tensor ones. Folding it into _key would put that check on every hit, so it stays on the miss path.

At 7324631fc, keying every tensor's shape and strides made a prepare hit +7.5–7.8 µs (+59–61%); d0ec01df6 took that out with key_shapes=False.

End to end, measured on 7324631fc; not rerun on d0ec01df6, a68d79af0 or 36ddc4daa. Their changes to the by_specialization path that the ATOM wrappers take are the hook checks of 36ddc4daa, which the 7-wrapper microbench above covers. TTFT was measured under the issue protocol (cold 8192 c=1, then warm 8192/6080 and 10240/7104 at c=1 and c=4; round 0 dropped), without a profiler, on MI308X at TP2. Each stack ran alone, and each configuration was started twice in palindromic order. The values are pooled medians in ms.

SGLang CachedLauncher 6cccc0974 7324631fc new − old new − CachedLauncher
8192/6080 c=1 151.8 154.1 153.0 −1.2 +1.1
8192/6080 c=4 507.6 512.3 508.4 −3.9 +0.8
10240/7104 c=1 199.3 203.0 200.9 −2.1 +1.6
10240/7104 c=4 776.8 793.3 780.8 −12.5 +4.1
cold 8192 c=1 443.0 444.0 442.7 −1.3 −0.3

Native cannot be quantified from these runs. Each configuration was started four times. In this session, the old head did not reproduce its earlier regression against CachedLauncher: it measured −2.5 / +1.6 / −0.8 ms at 8192/6080 c=1, 10240/7104 c=1 and cold 8192, where earlier runs gave +7.4 / +12.3 / +8.0 ms. So the saving against 6cccc0974 cannot be measured here. What can be said is that the new head is not slower than CachedLauncher: it measured −1.4 / −4.1 / −1.5 ms.

GSM8K on 7324631fc (limit 200, 5-shot), flexible / strict and MTP accept rate:

  • SGLang 0.985 / 0.985 and 0.717;
  • Native 0.985 / 0.985 and 0.718.

Earlier runs at 6cccc0974 gave SGLang 0.990 / 0.985 and 0.721, Native 0.985 / 0.985 and 0.721. The SGLang difference is one question out of 200. The kernels and their arguments are the same; only the host lookup differs.

Suggested squash message

Use the PR title and this body when squashing. Existing commits have not been rewritten.

Move fast_launch to the shared Triton utilities and update its KDA and
Gluon callers. Key compile knobs, argument types, tensor specialization
and wrapped-kernel shape/stride data. Support positional calls and an
explicit specialization mode for plain JIT kernels.

Preserve Triton's side effects by taking the ordinary path for hooks,
compile tracing, config pre-hooks and interpreted or uncacheable calls.
Keep per-call device/stream values and check rebound globals. Document
that in-place global changes are not detected on cached hits.

Build cached entry names and defaults once from the JIT signature, and
read the last real launch's hook values for omitted arguments. Remove
the second binder call without changing cached-hit argument assembly.

The earlier hook-check study at 36ddc4daa measured up to 0.22 us saved
per hit versus a68d79af0. The miss comparison at cdf8131f and its
same-file controls are reported separately in the PR description; they are not
end-to-end latency claims.

Add committed GPU coverage for omitted BLOCK/SCALE defaults and empty
varargs in both key modes, requiring a real cached hit and exact
agreement with a bypassed launch. The three requested binding mutants
are caught by these cases on AMD Triton 3.8.0 (4, 4 and 2 failures).

Current helper/KDA fast_launch files on MI308X: 83 pass/1 skip on
AMD Triton 3.8.0, 80/4 on upstream 3.7.1. Among the new cases, only
ordinary-varargs cases may skip when their plain launch raises
TypeError; defaults still run.
The broader suites and local binder oracle at cdf8131f, and historical
40-guard mutation results at 36ddc4daa, retain their revision labels
in the PR description.

PR Self-Review

Reviewed revision

a2dc96f

Behavior and intent

fast_launch moves from _triton_kernels/kimi_delta_attn/ to utils/, so ATOM and other callers use one launcher instead of a copy. Its key now holds what Triton keys on: the knobs, the type of each argument, and the shapes for a kernel under @triton.heuristics / @triton.autotune (the KDA launchers opt out with key_shapes=False, since their heuristics read no shape). Launches that need Triton's side effects take the ordinary path: hooks, torch.compile tracing, rebound globals, config pre-hooks, tuple arguments and interpreted kernels. A hit checks globals by identity, so a global changed in place is not caught on a hit. Before, a cached launch could run a kernel compiled for other arguments, or skip a hook. The earlier 7324631fc microbench placed a hit 0.4–0.7 µs above ATOM's old CachedLauncher, down from 2.2–2.6 µs at 6cccc0974. Those figures remain historical; the paired hit check at cdf8131f is separate. The entry-construction change at cdf8131f builds omitted arguments from signature defaults and actual hook values without a second binder call.

Validation and unverified scope

At a2dc96f08c421d226c337829811f436323ba89bb, the committed omitted-argument cases pass 4/4 on AMD Triton 3.8.0 and 2/4 on upstream 3.7.1, with only its 2 ordinary-varargs cases skipped. The full helper/KDA fast_launch files pass 83/1 skipped and 80/4 skipped respectively. The exact three requested mutants cause 4/4/2 real test failures on AMD. Production AST is unchanged from cdf8131f.

At cdf8131f7306bcc994953c4b6590e8503f05be3b, local MI308X/gfx942 results are 166 passed/11 skipped (AMD Triton 3.8.0) and 165 passed/12 skipped (upstream 3.7.1) for the combined helper/KDA suites, plus 163 ATOM wrapper tests on each. The cdf8131f entry-construction section lists its binding oracle/probe counts and three local-oracle binding mutants. The historical 40-guard sweep was at 36ddc4daa: all 40 fail on 3.7.1, 39 on AMD 3.8.0, where the unconditional fpsan-read mutant survives because the knob exists. It was not rerun here.

The paired miss/hit A/B at cdf8131f uses host thread CPU time, paired pinned-core runs and same-file controls. Historical probe timings belong to 7c54c82f4; the earlier wrapper and hit/miss tables belong to their stated heads. End-to-end TTFT/GSM8K remains at 7324631fc. No gfx950/gfx1250 Gluon kernel ran on this MI308X: only their wrapper/JIT argument captures and stub-launch hit timings were checked. Triton 3.6/3.9 and pytorch-triton-rocm remain unverified. Current-head CI has completed (see the omitted-argument regression section); skipped downstream checks remain unverified. Human re-review remains pending.

PR-specific question

The new helper suite checks observable launch behavior and compares cache keys against Triton's binder for the tested variants. The historical guard mutations at 36ddc4daa fail on the 3.7.1 wheel (40/40) and AMD 3.8.0 (39/40); the unconditional fpsan read survives only on the build that has that knob. The 144-state hook test also passes on the earlier a68d79af0, because that refactor must preserve dispatch; it fails the incorrect hook-check mutants. The stride test catches a missing stride key, and the KDA heuristic test catches four shape/property readers missed by its earlier version.

The current follow-up adds committed numerical cache-hit coverage for omitted signature defaults and empty varargs, and checks the three exact mutants requested in review 5992833462. It does not rely on the earlier local binder oracle to cover this path.

The entry-construction revision at cdf8131f preserved the existing suite and used a separate local oracle that reconstructs each saved entry with the previous real binder, including object identity. Its three binding mutants fail by losing the chosen hook value, a default, or the empty-varargs default. The probe and its unsupported-wheel checks are reported separately from committed CI tests. Before this PR, the existing KDA tests used fast_launch through flash_kda_fwd with keyword arguments and exact keys; they did not cover the helper's full hook/key/call-layout behavior.

Changed op tests

  • op_tests/triton_tests/utils/test_fast_launch.py (new): the tests of the shared helper. It compares the key with Triton's own cache key for many argument variants, and it checks each knob and guard, hits and misses in both key modes and with key_shapes=False, torch.compile tracing, tuple arguments and CUDA-graph replay. It uses small probe kernels. The latest four cases cover omitted BLOCK/SCALE defaults and empty varargs in both key modes, requiring a real hit and exact output against a bypassed launch after poisoning the output. It uses triton.autotune and triton.heuristics with one config only, to check how the helper treats a wrapped kernel; it does not tune.
  • op_tests/triton_tests/kimi_delta_attn/test_fast_launch.py: the import path changes, and the check that an entry holds no tensor reads the entry's fields by name and now covers every field. Its tensor-lifetime explanation now correctly refers to the pre-run hook. A new parametrized test checks, for the four flash_kda launchers, what lets them pass key_shapes=False: no heuristic reads any property of an argument (each runs on object() and on None for every argument), and no autotuner prunes or models configs. It stays the end-to-end test of the flash_kda launch cache.
  • op_tests/triton_tests/kimi_delta_attn/test_flash_kda.py: only the import path changes.

cc @valarLip

ZLkanyo009 and others added 2 commits November 16, 2026 20:37
fast_launch skips Triton's per-call dispatch for any kernel, and other
code (ATOM's Qwen3.8 HC launches) needs it too. Move it to
aiter/ops/triton/utils/fast_launch.py unchanged and update its callers:
flash_kda and the gfx950 / gfx1250 Gluon K1 and K2 kernels.

Co-authored-by: Cursor <[email protected]>
… for hooks

Add to the key the knobs that enter Triton's compile options or
specialization, the type of every non-tensor argument (True, 1 and 1.0
were one key), and the shape and strides of tensors for kernels under
autotune / heuristics. Take the ordinary path for launch, pre-run and
stages-inspection hooks and under torch.compile, recompile-check
changed globals as Triton does, and do not cache a config with a
pre_hook. Accept positional arguments.

Add by_specialization=True: a plain kernel keys its non-constexpr ints
by Triton's classes (1, multiple of 16, i32 / i64 / u64) and its floats
and bools by type, so a caller whose sizes change on every call does
not miss on each size.

op_tests/triton_tests/utils/test_fast_launch.py checks that equal keys
imply equal Triton cache keys (from Triton's own binder) and each guard.

Co-authored-by: Cursor <[email protected]>
@ZLkanyo009
ZLkanyo009 requested a review from a team November 16, 2026 20:38
@ZLkanyo009 ZLkanyo009 self-assigned this Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 8061 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@github-actions github-actions Bot changed the title [Triton] Move fast_launch to utils and key what Triton specializes on [Triton/Gluon] Move fast_launch to utils and key what Triton specializes on Nov 16, 2026
@aiter-bot

aiter-bot commented Nov 16, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision a2dc96f08c42 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

`fast_launch` moves from `_triton_kernels/kimi_delta_attn/` to `utils/`, so ATOM and other callers use one launcher instead of a copy. Its key now holds what Triton keys on: the knobs, the type of each argument, and the shapes for a kernel under `@triton.heuristics` / `@triton.autotune` (the KDA launchers opt out with `key_shapes=False`, since their heuristics read no shape). Launches that need Triton's side effects take the ordinary path: hooks, torch.compile tracing, rebound globals, config pre-hooks, tuple arguments and interpreted kernels. A hit checks globals by identity, so a global changed in place is not caught on a hit. Before, a cached launch could run a kernel compiled for other arguments, or skip a hook. The earlier `7324631fc` microbench placed a hit 0.4–0.7 µs above ATOM's old `CachedLauncher`, down from 2.2–2.6 µs at `6cccc0974`. Those figures remain historical; the paired hit check at `cdf8131f` is separate. The entry-construction change at `cdf8131f` builds omitted arguments from signature defaults and actual hook values without a second binder call.

Validation and unverified scope

At `a2dc96f08c421d226c337829811f436323ba89bb`, the committed omitted-argument cases pass 4/4 on AMD Triton 3.8.0 and 2/4 on upstream 3.7.1, with only its 2 ordinary-varargs cases skipped. The full helper/KDA fast_launch files pass 83/1 skipped and 80/4 skipped respectively. The exact three requested mutants cause 4/4/2 real test failures on AMD. Production AST is unchanged from `cdf8131f`.

At `cdf8131f7306bcc994953c4b6590e8503f05be3b`, local MI308X/gfx942 results are 166 passed/11 skipped (AMD Triton 3.8.0) and 165 passed/12 skipped (upstream 3.7.1) for the combined helper/KDA suites, plus 163 ATOM wrapper tests on each. The `cdf8131f` entry-construction section lists its binding oracle/probe counts and three local-oracle binding mutants. The historical 40-guard sweep was at `36ddc4daa`: all 40 fail on 3.7.1, 39 on AMD 3.8.0, where the unconditional fpsan-read mutant survives because the knob exists. It was not rerun here.

The paired miss/hit A/B at `cdf8131f` uses host thread CPU time, paired pinned-core runs and same-file controls. Historical probe timings belong to `7c54c82f4`; the earlier wrapper and hit/miss tables belong to their stated heads. End-to-end TTFT/GSM8K remains at `7324631fc`. No gfx950/gfx1250 Gluon kernel ran on this MI308X: only their wrapper/JIT argument captures and stub-launch hit timings were checked. Triton 3.6/3.9 and pytorch-triton-rocm remain unverified. Current-head CI has completed (see the omitted-argument regression section); skipped downstream checks remain unverified. Human re-review remains pending.

PR-specific question

The new helper suite checks observable launch behavior and compares cache keys against Triton's binder for the tested variants. The historical guard mutations at `36ddc4daa` fail on the 3.7.1 wheel (40/40) and AMD 3.8.0 (39/40); the unconditional fpsan read survives only on the build that has that knob. The 144-state hook test also passes on the earlier `a68d79af0`, because that refactor must preserve dispatch; it fails the incorrect hook-check mutants. The stride test catches a missing stride key, and the KDA heuristic test catches four shape/property readers missed by its earlier version.

The current follow-up adds committed numerical cache-hit coverage for omitted signature defaults and empty varargs, and checks the three exact mutants requested in review 5992833462. It does not rely on the earlier local binder oracle to cover this path.

The entry-construction revision at `cdf8131f` preserved the existing suite and used a separate local oracle that reconstructs each saved entry with the previous real binder, including object identity. Its three binding mutants fail by losing the chosen hook value, a default, or the empty-varargs default. The probe and its unsupported-wheel checks are reported separately from committed CI tests. Before this PR, the existing KDA tests used fast_launch through flash_kda_fwd with keyword arguments and exact keys; they did not cover the helper's full hook/key/call-layout behavior.

Changed op tests

- `op_tests/triton_tests/utils/test_fast_launch.py` (new): the tests of the shared helper. It compares the key with Triton's own cache key for many argument variants, and it checks each knob and guard, hits and misses in both key modes and with `key_shapes=False`, torch.compile tracing, tuple arguments and CUDA-graph replay. It uses small probe kernels. The latest four cases cover omitted BLOCK/SCALE defaults and empty varargs in both key modes, requiring a real hit and exact output against a bypassed launch after poisoning the output. It uses `triton.autotune` and `triton.heuristics` with one config only, to check how the helper treats a wrapped kernel; it does not tune.
- `op_tests/triton_tests/kimi_delta_attn/test_fast_launch.py`: the import path changes, and the check that an entry holds no tensor reads the entry's fields by name and now covers every field. Its tensor-lifetime explanation now correctly refers to the pre-run hook. A new parametrized test checks, for the four flash_kda launchers, what lets them pass `key_shapes=False`: no heuristic reads any property of an argument (each runs on `object()` and on `None` for every argument), and no autotuner prunes or models configs. It stays the end-to-end test of the flash_kda launch cache.
- `op_tests/triton_tests/kimi_delta_attn/test_flash_kda.py`: only the import path changes.

cc @valarLip

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two critical issues remain: reading an unavailable optional Triton knob can raise AttributeError before dispatch, and tuple cache-key collisions can reuse an incompatible compiled kernel.

2 open issues
What changed in this PR

Moves fast_launch into shared Triton utilities so KDA and downstream callers can reuse one launcher, while strengthening cache keys and preserving dispatch side effects.

Changes:

  • Adds positional arguments and an opt-in specialization-based cache mode.
  • Adds cache guards for hooks, tracing, changed globals, and autotune pre-hooks.
  • Updates KDA imports, documents the shared helper, and adds launcher tests.
File Description
op_tests/​triton_tests/​utils/​test_fast_launch.py Adds cache-key, hook, launch, and graph-replay tests.
op_tests/​triton_tests/​kimi_delta_attn/​test_flash_kda.py Updates the shared launcher import.
op_tests/​triton_tests/​kimi_delta_attn/​test_fast_launch.py Updates the shared launcher import.
aiter/​ops/​triton/​utils/​fast_launch.py Adds the shared launcher with stronger keys and guards.
aiter/​ops/​triton/​README.md Lists the shared launcher utility.
aiter/​ops/​triton/​_triton_kernels/​kimi_delta_attn/​flash_kda.py Uses the shared launcher path.
aiter/​ops/​triton/​_triton_kernels/​kimi_delta_attn/​fast_launch.py Removes the old KDA-local launcher module.
aiter/​ops/​triton/​_gluon_kernels/​gfx950/​kimi_delta_attn/​flash_kda_k2.py Updates the gfx950 K2 launcher import.
aiter/​ops/​triton/​_gluon_kernels/​gfx950/​kimi_delta_attn/​flash_kda_k1.py Updates the gfx950 K1 launcher import.
aiter/​ops/​triton/​_gluon_kernels/​gfx1250/​kimi_delta_attn/​flash_kda_k2.py Updates the gfx1250 K2 launcher import.
aiter/​ops/​triton/​_gluon_kernels/​gfx1250/​kimi_delta_attn/​flash_kda_k1.py Updates the gfx1250 K1 launcher import.

Review effort: Balanced

Comment thread aiter/ops/triton/utils/fast_launch.py Resolved
Comment thread aiter/ops/triton/utils/fast_launch.py Resolved
@zufayu
zufayu requested review from a team, Boss2002n and Dewei-Wang-sh November 17, 2026 01:04
ZLkanyo009 added a commit to ROCm/ATOM that referenced this pull request Nov 17, 2026
…d launcher"

This reverts commit c142f87, together
with the launcher-only lines 39463e7 added to atom/utils/triton_launch.py
and tests/test_triton_launch.py. The HC launches go back to kernel[grid].

The cached launcher moves into aiter's fast_launch (ROCm/aiter#8061);
the HC launches will switch to it in a separate PR after that lands.

Co-authored-by: Cursor <[email protected]>
ZLkanyo009 added a commit to ROCm/ATOM that referenced this pull request Nov 17, 2026
Per the review on #3429, ATOM no longer carries its own Triton dispatch
bypass: the 13 prefill wrappers (GDN l2norm / causal conv1d + metadata /
gating, output-gate quant, QSA helpers, scorers and sparse attention,
q/k norm) wrap their kernels with
`aiter.ops.triton.utils.fast_launch.fast_launch(kernel,
by_specialization=True)` (ROCm/aiter#8061) and pass the launch options per
call, so the per-option launcher tables go away. Launches its key cannot
describe take Triton's ordinary path inside fast_launch.

atom/utils/triton_launch.py and its tests are removed; the key-vs-Triton
guard tests live in aiter. tests/test_fast_launch_wrappers.py keeps the GPU
checks: each wrapper bitwise against plain `kernel[grid]`
(`fast_launch.bypassed()`), a repeat run without a miss, and CUDA-graph
replay.

Co-authored-by: Cursor <[email protected]>
ZLkanyo009 added a commit to ROCm/ATOM that referenced this pull request Nov 17, 2026
…unch

Moved here from #3429, which dropped its HC launcher until ROCm/aiter#8061
lands: `hc_combine_norm` (single- and multi-row), `scaled_silu`,
`hc_gated_mean` and `hc_gated_mean_quant` wrap their kernels with
`fast_launch(kernel, by_specialization=True)`.

tests/test_fast_launch_wrappers.py: the HC launches bitwise against the
launches written out as plain `kernel[grid]`, against the same wrappers on
Triton's ordinary path with a repeat run that never misses, and replayed in
a CUDA graph.

Co-authored-by: Cursor <[email protected]>
…ny state

Under torch.compile(fullgraph=True), Dynamo traces the launch function.
It read the kernel's pre_run_hooks (through _plain) before asking
torch.compiler.is_compiling(), and Dynamo cannot branch on that list:
"Data-dependent branching" on GetAttrVariable(TritonKernelVariable(),
pre_run_hooks). Check is_compiling() first, so a traced launch goes to
kernel[grid] before the wrapper touches its hooks, cache or flags.

Found when ROCm/ATOM#3431 wrapped kernels that Qwen3-Next reaches under
@support_torch_compile.

Test: launches under torch.compile(fullgraph=True) with the eager and
inductor backends, both key modes and all three call styles, with an
entry already cached, are bit-equal to eager and record no miss. They fail
with the check back in its old place or removed.

Co-authored-by: Cursor <[email protected]>
@ZLkanyo009

ZLkanyo009 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Fix for a torch.compile problem found while wiring ROCm/ATOM#3431 onto fast_launch: new commit 1b63b63 on top (no amend, no rebase, no force push).

Problem. On 7c54c82, a fast_launch kernel called inside torch.compile(fullgraph=True) fails with Unsupported: Data-dependent branching on GetAttrVariable(TritonKernelVariable(), pre_run_hooks). Dynamo traces launch, which read self._jit.pre_run_hooks (through _plain()) before checking torch.compiler.is_compiling(), and Dynamo cannot branch on that list. In #3431 this showed up with the shared ops (fused_qk_norm / DualRMSNorm, l2norm_fwd, causal_conv1d_fn, fused_gdn_gating), which Qwen3-Next reaches under @support_torch_compile.

Fix. launch checks torch.compiler.is_compiling() first and returns kernel[grid](...) before it reads any hook, flag or cache state. The check is removed from _plain(). Nothing else in launch runs under tracing any more.

Tests (MI308X, one GPU, Triton 3.8, torch 2.10):

  • New test_fullgraph_compile_takes_the_ordinary_path: torch.compile(fullgraph=True) with the eager and inductor backends × by_specialization off / on × positional / keyword / callable-grid launches, with an entry already cached from an eager launch. The output is bit-equal to the eager launch, and no cache miss is recorded. That makes 12 cases. Against the 7c54c82 file they fail with the same Data-dependent branching error.
  • The old case that monkeypatched is_compiling and checked _plain() is replaced by these. test_fast_launch.py: 41 passed.
  • Mutation check: the earlier 11 guard mutants, plus the is_compiling() check moved back into _plain() and the check removed. All 13 are caught (the last two fail 12 tests each).
  • KDA test_fast_launch.py + test_flash_kda.py: 106 passed, 11 skipped, same as before.
  • ruff 0.16.0 and black are clean.

cc @valarLip

…builds that have it

aiter accepts triton>=3.6.0, and upstream Triton 3.6, 3.7 and 3.8 have no
compilation.fpsan_homomorphic_casts knob (AMD's 3.8.0 build and upstream
3.9 have it). On those builds _key raised AttributeError, so every launch
through fast_launch failed, the flash_kda ones included. JITFunction.run
puts the knob in the compile options only on the builds that have it, so
decide once at import whether it exists and key it only then.

The test oracle mirrors run the same way, and the knob-change case for
TRITON_FPSAN_HOMOMORPHIC_CASTS skips on a build without the knob.

Test, one MI308X:
- upstream Triton 3.7.1 wheel: utils/test_fast_launch.py 40 failed /
  1 passed before, 40 passed / 1 skipped after; kimi_delta_attn
  test_fast_launch.py 19 failed before, 19 passed / 1 skipped after, as
  with the image's aiter before this PR.
- AMD Triton 3.8.0: utils/test_fast_launch.py 41 passed, as before.

Limit: aiter CI installs AMD's 3.8.0, which has the knob, so CI does not
run the path without it.
…nary path

Triton specializes each item of a tuple argument ((2,) is i32, (2.0,) is
fp32), but the key holds a tuple by its value and (2,) == (2.0,). So a
launch with (2.0,) reused the kernel compiled for (2,), and its launcher
raised "TypeError: 'float' object cannot be interpreted as an integer"
where the ordinary path compiles a second kernel. No caller passes a tuple
today, so do not cache a launch with a tuple argument: like an argument
that cannot be hashed, it keeps the wrapper on the ordinary path. The check
runs on a miss only, so a cached launch costs the same as before.

Test: (2,) then (2.0,) through one wrapper, in both key modes, gives
x * 2 each time and leaves no entry. Without the check both cases fail.
utils/test_fast_launch.py: 43 passed (AMD Triton 3.8.0), 42 passed and
1 skipped (upstream Triton 3.7.1), one MI308X.
…in by type

Self-review of this PR:
- The module docstring still gave flash_kda as the reason for the file.
  fast_launch is a shared helper in utils/ now, so say why in general terms
  and leave the kernel out.
- _hooked found a HookChain by probing for a "calls" attribute. Triton has
  HookChain in every supported version (3.6 to 3.9), so check the type:
  a chain runs when it has a hook, and anything else runs when it is not
  None. The result is the same as before for None, an empty chain, a chain
  with a hook and a plain callable.

Test, one MI308X: utils/test_fast_launch.py 43 passed (AMD Triton 3.8.0),
42 passed and 1 skipped (upstream Triton 3.7.1). Mutants: _hooked always
False fails 1 test, an empty chain counted as a hook fails 4.
@ZLkanyo009

Copy link
Copy Markdown
Contributor Author

1b63b6344..6cccc0974: 3 new commits, no amend, rebase or force push. They answer the two findings of the Copilot review on 7c54c82f4, plus one item from my own review. The description is updated to this head, with the PR Self-Review section.

Finding Commit Verification
1. knobs.compilation.fpsan_homomorphic_casts is not on every supported Triton a4f4f4b86 upstream Triton 3.7.1 wheel: utils/test_fast_launch.py 40 failed → 42 passed, 1 skipped; kimi_delta_attn test_fast_launch.py 19 failed → 19 passed, 1 skipped
2. (2,) and (2.0,) get the same key caf08ab24 new test; it fails without the check
Self-review: KDA in the shared docstring, getattr probe in _hooked 6cccc0974 same results; 2 new mutants are caught

1. The fpsan knob. Confirmed. Upstream Triton 3.6.0, 3.7.x and 3.8.0 have no compilation.fpsan_homomorphic_casts. AMD's 3.8.0 build and upstream 3.9.0 have it, and only there does JITFunction.run put it in the compile options. aiter accepts triton>=3.6.0. torch 2.10's ROCm wheel pins triton 3.6.0+rocm7.2.4 (git 4ed88892), and its knobs.py has no such knob either; the CI image has that build until the job installs AMD's 3.8.0. So at 1b63b6344, every launch through fast_launch raised AttributeError in _key on those builds, the flash_kda launches included. aiter main does not read this knob, so this PR caused the failure. a4f4f4b86 decides once at import whether the knob exists ("fpsan_homomorphic_casts" in knobs.compilation.knob_descriptors) and keys it only then. I did not use a getattr on each call: the set of knobs does not change after import, and a missing attribute would build an exception on each launch. The test oracle mirrors run in the same way, and the knob-change case skips on a build without the knob.

2. Tuple arguments. Confirmed. Triton specializes each item of a tuple: (2,) is i32, (2.0,) is fp32 and (1,) is constexpr 1. The key holds the tuple by its value, and (2,) == (2.0,). A launch with (2.0,) after (2,) used the i32 kernel, and its launcher raised TypeError: 'float' object cannot be interpreted as an integer. The ordinary path compiles a second kernel. No caller passes a tuple: the KDA launches and the 20 launchers of ROCm/ATOM#3431 pass tensors and scalars. So caf08ab24 takes the second option of the review: a launch with a tuple argument goes through kernel[grid], and the wrapper stays on the ordinary path, as for an argument that cannot be hashed. The check runs only on a miss, so a cached launch costs the same as before. The new test_a_tuple_argument_takes_the_ordinary_path launches (2,) and then (2.0,) in both key modes; each result is x * 2, and no entry is left.

Self-review against the maintainer guidelines (6cccc0974).

  • The module docstring still gave the flash_kda pipeline as the reason for the file. The helper is shared in utils/ now, so the docstring gives the reason in general terms.
  • _hooked found a HookChain with getattr(hook, "calls", None). HookChain is in Triton 3.6 to 3.9, so _hooked checks the type now. The result is the same for None, an empty chain, a chain with a hook and a plain callable.
  • Checked and not changed: the test location (utils/ helper → triton_tests/utils/) and pytest follow op_tests/triton_tests/README.md; no standalone benchmark is added; no importer of the old path is left on the branch or on current main, and main has not changed the files of this PR.

Tests, one MI308X (gfx942), with this branch as a symlink overlay over the image's aiter, and AMD Triton 3.8.0 unless stated:

  • op_tests/triton_tests/utils/test_fast_launch.py: 43 passed. On the upstream Triton 3.7.1 wheel: 42 passed, 1 skipped (the fpsan knob case). At 1b63b6344, the 3.7.1 wheel gave 40 failed, 1 passed.
  • kimi_delta_attn test_fast_launch.py + test_flash_kda.py: 106 passed, 11 skipped, as before. On the 3.7.1 wheel, kimi_delta_attn test_fast_launch.py: 19 passed, 1 skipped, as with the image's aiter (at 1b63b6344: 19 failed).
  • Mutation check, 17 mutants: the earlier 13, plus no tuple check, the fpsan knob read on every build, _hooked always false, and an empty chain counted as a hook. All 17 fail a test on the 3.7.1 wheel. On AMD's 3.8.0, 16 fail; the unconditional fpsan read passes there, because that build has the knob.
  • [Sgl Atom][Native][perf] cut Qwen4Exp prefill host overhead: HC, GDN, output-gate, QSA and q/k-norm Triton wrappers on aiter's fast_launch ATOM#3431 at 943dae39f on this head: 163 wrapper tests pass on both Triton builds.
  • ruff 0.16.0 and black are clean.

Not covered. aiter CI installs AMD's 3.8.0, so CI does not run a Triton build without the fpsan knob. I ran that path by hand on the 3.7.1 wheel only, not on 3.6.0 or on pytorch-triton-rocm. The gfx950 / gfx1250 Gluon files did not run here; this round does not change them.

Note for the merge. The three earlier commits have Co-authored-by: Cursor trailers, and rule 29 of aiter/ops/triton/README.md asks to remove them before the merge. I do not rewrite pushed history, so please drop them from the squash message. The new commits have none.

Waiting for: CI on 6cccc0974, and a reviewer.

cc @valarLip

ATOM measured a fast_launch hit at about 4.5 us more host time per launch
than the CachedLauncher it replaces (33.5 vs 28.9 us in service), with
about 600 launches per forward. A hit did more Python work than the old
launcher. This commit cuts that work. The key holds the same facts, and
the conditions for taking the ordinary path stay the same.

- With by_specialization, each call-site layout (the number of positional
  arguments and the keyword names) gets two itemgetters, built once, that
  split the runtime arguments from the constexpr arguments. The constexpr
  values and their types go into the key as two tuples instead of two
  items per argument. A tensor passed for a constexpr is still keyed by
  dtype, alignment and storage size, not by identity; a set of
  constexpr type tuples already seen without a tensor keeps that check
  off the common path.
- An entry is a NamedTuple that already holds the launcher, the function
  handle, the packed metadata and the names after the positional
  arguments.
- The driver's device and stream getters are bound on the first launch.
  The device and the stream are still read on every launch.
- The global-value check runs only for a kernel that reads globals.

Tests: two cases for the new key code. A reordered keyword layout keys
each argument by its own parameter, and a tensor passed for a constexpr
does not end up in the key. The 1 / True / 1.0 case now runs in both key
modes. Two tests read entries by field name.

Test, one MI308X:
- utils/ and kimi_delta_attn/ test_fast_launch.py: 66 passed, 1 skipped
  (AMD Triton 3.8.0); 65 passed, 2 skipped (upstream Triton 3.7.1).
- 26 mutants of fast_launch.py, the earlier 17 and 9 for the new code:
  all fail a test. The exception is the fpsan knob read unconditionally,
  which only fails on 3.7.1, where the knob is missing.
- ATOM tests/test_fast_launch_wrappers.py (ROCm/ATOM#3431): 163 passed.
- Host time per call, hot loop, 7 ATOM wrappers: CachedLauncher 154.3 us,
  parent 169.7 us, this commit 159.2 us. Interleaved: 191.5, 209.6 and
  194.0 us.
@ZLkanyo009

Copy link
Copy Markdown
Contributor Author

6cccc0974..7324631fc: 1 new commit, no amend, rebase or force push.

Finding. ROCm/ATOM#3431 moves 20 prefill kernels from ATOM's CachedLauncher onto fast_launch(kernel, by_specialization=True). That is about 600 launches per forward. A host-time hook measured this in service. At 6cccc0974, a hit cost 4.3–4.8 µs more per launch than CachedLauncher (33.5–34.4 vs 29.3–29.6 µs), which is about +2.5–2.9 ms per forward. The extra work was Python on the hit path:

  • two appends and a runtime-flag lookup per argument in _key;
  • _runtime() rebuilt on each call;
  • two driver.active lookups;
  • the globals-check call for kernels that read no globals;
  • attribute reads on CompiledKernel.

Change (7324631fc). The key holds the same facts, and every condition for the ordinary path stays the same (hooks, torch.compile, changed globals, config pre_hook, unhashable and tuple arguments, the fpsan knob).

  • With by_specialization, each call-site layout (number of positional arguments, keyword names) gets two itemgetters, built once. They split the runtime arguments from the constexpr arguments. The constexpr values and their types go into the key as two tuples. A tensor passed for a constexpr is still keyed by dtype / alignment / storage bit, not by identity. Keying it by identity would keep it alive in the cache. A set of constexpr type tuples already seen without a tensor keeps that check off the common path.
  • The cache entry is a NamedTuple that holds the launcher, the function handle, the packed metadata and the names after the positional arguments.
  • The driver's device and stream getters are bound on the first launch. The device and the stream are still read on each launch, so CUDA-graph capture still sees its own stream.
  • The globals check runs only when the kernel read globals.
  • New tests: reordered keywords key each argument by its own parameter; a tensor for a constexpr is keyed as a tensor and not held by the key; the 1 / True / 1.0 case now runs in both key modes.

Verification (one MI308X, gfx942):

Host time per call, measured on 7324631fc: sum of 7 ATOM wrappers at one 2112-token prefill at TP2, µs, median of 3000 calls, mean of 3 interleaved rounds, one pinned core.

CachedLauncher 6cccc0974 7324631fc
hot loop 154.3 169.7 159.2
interleaved 191.5 209.6 194.0

Per launch, the gap to CachedLauncher drops from 2.2 / 2.6 µs to 0.7 / 0.4 µs.

End to end, the TTFT runs were not repeated on 7324631fc. They used prototypes with the same hit-path operations, on the post-review ATOM merge with this branch at 6cccc0974:

  • Native gap to CachedLauncher (8192/6080 c=1, 10240/7104 c=1, cold 8192): from +7.4 / +12.3 / +8.0 ms to +2.1 / +3.6 / +2.7 ms.
  • SGLang 8192/6080 c=1 / c=4: from +3.5 / +6.5 ms to +0.8 / +1.8 ms.
  • GSM8K: unchanged.

Details are in the "Hit-path host overhead" section of the description, which also lists how the last prototype differs from this commit.

cc @valarLip

@ZLkanyo009

Copy link
Copy Markdown
Contributor Author

The end-to-end numbers in the description were measured on prototypes of this change. They are now replaced with runs on 7324631fc itself. No code change.

Setup: MI308X at TP2, issue protocol, no profiler, one stack at a time, each configuration started twice. The ATOM tree is the post-review merge 700d662e6, with ROCm/ATOM#3429 fa5ebfe15 and #3431 943dae39f. Only fast_launch.py differs between old and new.

  • SGLang TTFT, 6cccc0974 → 7324631fc (ms):

    • 8192/6080 c=1: 154.1 → 153.0
    • 8192/6080 c=4: 512.3 → 508.4
    • 10240/7104 c=1: 203.0 → 200.9
    • 10240/7104 c=4: 793.3 → 780.8
    • cold 8192: 444.0 → 442.7

    That is 1.2–12.5 ms faster. Against the pre-review code with ATOM's own CachedLauncher, the new head is at +1.1 / +0.8 / +1.6 / +4.1 / −0.3 ms.

  • Native: not quantifiable from these runs. The old head did not reproduce its regression in this session. The new head is not slower than the pre-review code: −1.4 / −4.1 / −1.5 ms at 8192/6080 c=1, 10240/7104 c=1 and cold 8192.

  • GSM8K on 7324631fc (limit 200, 5-shot), flexible / strict and MTP accept rate: SGLang 0.985 / 0.985 and 0.717; Native 0.985 / 0.985 and 0.718.

cc @valarLip

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (4)

  1. Stop keying tensor shapes and strides on the KDA launches; this slows the default path by about 50% per cache hit. aiter/ops/triton/utils/fast_launch.py:284-286 (if wrapped: append(tuple(v.shape)); append(v.stride())). Trigger: every KDA prefill. All four launchers at _triton_kernels/kimi_delta_attn/flash_kda.py:1142-1145 wrap @triton.heuristics / @triton.autotune kernels, so they take this branch on every hit. A CPU in-process A/B with the real Heuristics(Autotuner(JITFunction)) and the prepare signature (14 tensors), with base-vs-base and head-vs-head controls under ±0.2 µs, measured on four cores: +6.7 to +10.2 µs per hit (+48 to +58%) over e89e5b6. Head without the shape key is equal to base. The KDA heuristics only test is not None, and the autotune keys are ints/bools (Triton's Autotuner.run keys on those values plus str(dtype)), so KDA gains no correctness from it. Your own table already shows 12.3–12.9 → 14.3–15.2 µs for exact keyword launches, and this path was not measured at head. Fix (verified on CPU): add fast_launch(kernel, key_shapes=True) and pass key_shapes=False at the four KDA sites, with a comment that their heuristics read no shape. test_a_heuristic_on_a_tensor_shape_is_keyed still passes under the default. Do not key only Autotuner.keys: a heuristics-only kernel then reuses a stale config. Also fix the docstring at :26-27, which says autotune can read shapes; only @triton.heuristics can.
  2. Correct the knob sentence in the module docstring. fast_launch.py:17-21 says the key holds "the knobs that enter Triton's compile options or specialization". knobs.runtime.override_arch and knobs.language fp-fusion enter HIPBackend.parse_options but are not keyed, by fast_launch or by Triton's in-process run() key. Say "the knobs JITFunction.run puts in its cache key".
  3. Make the knob oracle non-circular. op_tests/triton_tests/utils/test_fast_launch.py:76-88 hand-copies the kwargs run() injects, so a knob a later Triton adds to run() is missed by both the oracle and fast_launch, and test_key_follows_the_knobs_in_tritons_key stays green. Take the injected kwargs from a real launch through a pre_run_hook (they are injected before the hooks run) and assert the set is ⊆ {debug, instrumentation_mode, fpsan_homomorphic_casts}.
  4. Raise OverflowError in _wide_int_spec, not TypeError. fast_launch.py:119 with :203-208: under by_specialization, one runtime int outside [-263, 264) sets _disabled=True for good. Triton itself raises OverflowError for that one call only, so every later valid launch then loses the cache.

Pre-existing (not required for this PR): constexpr 0.0 and -0.0 share an entry (equal and same hash, though Triton's compute_cache_key keys them apart; same on main, no caller passes a float constexpr). Under TRITON_INTERPRET=1, fast_launch() raises AttributeError at fast_launch.py:160-162 (jit.fn on an InterpretedFunction), which breaks the import of flash_kda. Main has the same bug, but it now sits in a shared util. fusions/attn_res.py:72-91 keeps its own _LAUNCH_CACHE.


Reviewed at 7324631 (Deep; 2 hunters + independent pass B + 2 verifiers, CPU probes with Triton 3.9). Already fixed: Copilot fpsan knob (:77, :270); Copilot tuple key (:353-357).

@ZLkanyo009

Copy link
Copy Markdown
Contributor Author

@valarLip I addressed the four requested items in cdf8131f7306bcc994953c4b6590e8503f05be3b; the existing commit history is unchanged.

  1. The second binder call is removed. _names and _defaults are cached from jit.signature after the interpreter early return. _capture reads the last real pre-run hook's keyword values, with signature defaults (including the empty *args tuple) for omitted arguments. It no longer looks up device_caches[...][4]. The hit code is unchanged.

    An independent local oracle reconstructs the old binder entry after real launches and checks names, frozen-value identity, rest and hit-argument identity. It passed for 218 captures per Triton version in the main helper/KDA suite. Extended probes passed 40 cases per version: defaults, keyword-only, do_not_specialize, by_specialization, heuristics, two-config autotune, varargs and all recorded Gluon K1/K2 wrapper families with shape keys on/off. There were 48 successful identity captures on AMD 3.8.0 and 42 on upstream 3.7.1. The Gluon captures stop before foreign-architecture compilation; no gfx950/gfx1250 kernel ran on MI308X. The 3.7.1 wheel's keyword-only constexpr compile failure and tested varargs rejection reproduce with direct JIT and are reported in the body.

    Controlled before/after misses on AMD Triton 3.8.0 / MI308X, comparing 36ddc4daa with this revision:

    Launch Old median, µs New median, µs Paired delta median, µs Paired delta range, µs
    prepare 99.039 73.642 −26.002 (−26.3%) [−28.971, −24.692]
    segment 123.075 90.906 −31.810 (−25.8%) [−33.384, −29.625]

    Each comparison has 8 pairs sharing a pinned core, alternating cores/order, 15 rounds × 300 calls per process, warm JIT/autotuner caches, and only the wrapper cache cleared. These are thread CPU times, not GPU or end-to-end latency. The two columns are separate medians; the delta is the median of per-pair differences. Same-file control delta medians [per-pair ranges], in µs: prepare old:old +0.326 [−3.403,+1.774], new:new +0.509 [−1.262,+2.098]; segment old:old −1.313 [−2.675,+1.427], new:new −0.396 [−2.160,+1.002].

    The four stub-launch hit comparisons have paired delta medians from −0.126 to +0.059 µs; KDA new:new controls have ranges [−0.158,+0.176] and [−0.280,+0.254] µs. The body includes all 12 rows and the setup. This does not establish a hit-path improvement or a new comparison against main.

  2. The four comments are corrected. Both helper docstrings now explicitly allow dtype and 16-byte alignment readers; full pointers, storage offsets and values remain unsupported. The omitted-argument comment distinguishes fixed defaults from key-dependent autotuner/heuristic choices and notes that by_specialization allows neither wrapper. Both KDA autotune comments now include dtypes.

  3. The test wording and interpreter tensor are corrected. The hook comment describes whether a hook function runs; the key test and PR test plan only claim to catch distinctions among the tested variants. The interpreter tensor explicitly uses dtype=torch.float32, device="cpu".

  4. The intended squash body is in the PR description. It says “up to 0.22 us” for the historical hook-check result. The historical 40-mutant result is explicitly tied to 36ddc4daa: all 40 fail on the 3.7.1 wheel, and 39 on AMD 3.8.0, where the fpsan knob exists. That historical sweep was not rerun. Three new in-memory binding mutants separately fail the current oracle (3, 10 and 2 cases). I remeasured the skip count: after collection, with GPU availability disabled, the current helper file collects 56 tests and gives 1 passed / 55 skipped on each Triton version. I corrected the body to 55; neither the old 52 nor the suggested 54 matches this file. This is a local simulation, not a claim that package collection works on a physically GPU-free host.

Final-source regression on MI308X: combined helper/KDA tests 166 passed / 11 skipped on AMD Triton 3.8.0 and 165 passed / 12 skipped on upstream 3.7.1; downstream ATOM wrapper tests 163 passed on each. Black, Ruff and diff-check passed. No new serving/GSM8K result is claimed; the description keeps its old measurements tied to their original revisions.

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (3)

  1. Add a test for the new omitted-argument path in _capture. fast_launch.py:200-204 and :447-451 now fill omitted parameters from jit.signature defaults, and an empty *args from (). No committed test kernel has a defaulted parameter or *args, and every KDA and Gluon call site passes its defaults or gets them from a heuristic. So three mutants pass every test: kw.get(n) (a hit passes None), kw[n] (KeyError), and dropping the VAR_POSITIONAL branch (a hit passes inspect.Parameter.empty).
    • Add a GPU case in op_tests/triton_tests/utils/test_fast_launch.py with a kernel like k(x, out, n, *rest, BLOCK: tl.constexpr = 64, SCALE=2.0). Launch it as k[grid](x, out, n) twice. Assert that the second launch hits (recording() empty) and gives the same output as under fast_launch.bypassed().
    • Skip the *args part when the plain launch raises TypeError (the 3.7.1 wheel).
  2. Fix four comments that are no longer true.
    • fast_launch.py:179-180: nothing here uses "the argument binder" any more. Say "the JITFunction that owns the signature, the pre-run hooks and the globals the kernel reads."
    • fast_launch.py:161: frozen "(defaults, autotuner choices)" also holds heuristic choices. Say "(defaults, heuristic and autotuner choices)".
    • fast_launch.py:70-71: HIPBackend.is_within_2gb only checks storage size. The i32 range comes from Triton's int specialization. Say "2 GiB - 1: the largest storage HIPBackend.is_within_2gb allows buffer ops on; with _MIN_INT32, also the i32 range Triton specializes a non-constexpr int on."
    • kimi_delta_attn/test_fast_launch.py:150-152: the reason given is "The binder hands back every argument". Say "The pre-run hook sees every argument of the launch, which is the obvious thing to keep …".
  3. Fix the spacing in the suggested squash message. It has "AMD Triton3.8.0", "upstream3.7.1", "on3.7.1" and "onAMD3.8.0", and "AMD3.8.0" twice in the self-review. Also change "; it is not an end-to-end latency claim" to "; they are not end-to-end latency claims".

Not required (on main before this PR): seen[-1] picking the autotuner's final launch has no test with two or more configs.


Reviewed at cdf8131 (Deep; pass A: 2 hunters, perf A/B, ecc:review-pr, 2 verifiers, C2; independent pass B with its own hunters, 4 verifiers, C2 and perf). Item 1 from r51 is fixed. A miss is now 40 / 46 µs below main for prepare / segment, and 14–51 µs below main on seg_scan and Gluon K1/K2 (8 concurrent pairs on one pinned core, controls within ±2.3 µs). The hit is unchanged from 36ddc4d. The rebuilt entries match the old binder's by identity in 66 probed cases. The r51 comment, test and squash items are fixed. Our r51 "54 skips" was wrong; 55 is right. The :70-71 comment was there in earlier rounds and we missed it. CI: all required checks green; utils/test_fast_launch.py ran 56 tests, all passed (MI35X shard 4).

Cover default BLOCK/SCALE and empty varargs with real cache-hit GPU
launches in both key modes. Keep defaults tested on Triton versions
that reject ordinary varargs launches, and update stale comments.
@ZLkanyo009

Copy link
Copy Markdown
Contributor Author

Addressed review 5992833462 in a2dc96f08c421d226c337829811f436323ba89bb.

  • Added four GPU cases for omitted BLOCK=64, runtime SCALE=2.0, and empty *rest, in exact and by_specialization modes. Separate kernels keep defaults covered when upstream 3.7.1 rejects ordinary varargs launches. Each case compares a real second-launch cache hit (empty recording, output first poisoned with NaNs) against a bypassed ordinary launch and 2*x.
  • Corrected the four comments about signature/hooks, frozen heuristic choices, storage versus integer specialization limits, and the pre-run hook's launch arguments.
  • Fixed the suggested squash message's version spacing and plural latency-claims sentence. The description now separates this revision's committed coverage from the earlier binder oracle, mutation sweeps and performance measurements.

Local MI308X validation:

Check AMD Triton 3.8.0 Upstream Triton 3.7.1
New cases 4 passed 2 passed, 2 skipped
Complete utils + KDA test_fast_launch.py files 83 passed, 1 skipped 80 passed, 4 skipped

AMD skips only the second-GPU case. Upstream additionally skips its absent fpsan knob and the two empty-varargs cases after the ordinary launch raises TypeError; both default-only cases run and pass.

The exact kw.get(n), kw[n], and missing-VAR_POSITIONAL mutants cause 4, 4, and 2 failures respectively in the new committed cases on AMD. The last two failures are on the real cached launch: the AMD launcher rejects inspect.Parameter.empty as a sequence. Its ordinary-default cases still pass. These were temporary in-memory changes in isolated test processes, not the previous binder-oracle checks.

Black, Ruff, AST parsing and diff-check pass. The production module's AST is unchanged from cdf8131f; no performance or end-to-end rerun was made. New-head CI and re-review remain pending.

@ZLkanyo009
ZLkanyo009 requested review from a team and valarLip November 23, 2026 08:22

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM

Nothing left to change. All three items of my review at cdf8131f73 are fixed at a2dc96f08c:

  1. Omitted-argument test: op_tests/triton_tests/utils/test_fast_launch.py:66-79 adds _defaulted_kernel / _defaulted_varargs_kernel (BLOCK: tl.constexpr = 64, SCALE=2.0, empty *rest), and :386-415 checks a real second-launch hit against a bypassed launch and 2*x in both key modes, after it fills the output with NaN. Only the varargs case skips on a TypeError. CI (Triton Tests MI35X, shard 4) ran all four cases, and all passed. None skipped.
  2. Comments: fast_launch.py:70-71, :161 and :179-180, and kimi_delta_attn/test_fast_launch.py:150-152 now match the code. HIPBackend.is_within_2gb checks only the storage size (Triton 3.9 source). Each pre-run hook gets the launch's (*args, **kwargs).
  3. Squash text: the version spacing and the plural "they are not end-to-end latency claims" are fixed.

The production module changes only in comments since cdf8131f, so the hit and miss numbers from the last round still apply. Required CI is green, there are no open review threads, and the PR merges cleanly into current main with no remaining importer of the old kimi_delta_attn/fast_launch.py.


Reviewed at a2dc96f (Deep, delta re-review: hunter + independent pass B, CPU only, no findings). Already fixed: every item from the 11-19 and 11-20 rounds (shape key, globals identity check, miss cost, hook inlining, docstrings, tests, squash text).

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at a2dc96f.

@valarLip
valarLip merged commit 6b29fd7 into main Nov 24, 2026
77 checks passed
@valarLip
valarLip deleted the lingzha/shared-triton-fast-launch branch November 24, 2026 15:57
XiaobingSuper added a commit to ROCm/ATOM that referenced this pull request Nov 26, 2026
…iton's key

`aiter.ops.triton.utils.fast_launch` (ROCm/aiter#8061) keys a launch on
what Triton specializes on (with by_specialization=True, ints by their
1 / multiple-of-16 / width class), plus the device and the knobs Triton
keys on, and keeps the ordinary path for hooks and torch.compile. Wrap
the deferred decode-ids fill and the KV-indices expansion with it; the
call sites stay `kernel[grid](...)`. ATOM's own FastLaunch and its
stand-in tests go; the hip_copy test moves to its own file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cursor Bot pushed a commit that referenced this pull request Nov 26, 2026
fast_launch moved to aiter/ops/triton/utils in #8061; the #6498 import path
no longer exists on main (also fixes ruff I001).

Co-authored-by: Sealeen Zhang <[email protected]>
gbyu-amd added a commit that referenced this pull request Nov 30, 2026
….triton.utils

main moved fast_launch to aiter/ops/triton/utils/fast_launch.py (#8061). The
split-KV merge still imported it from the old kimi_delta_attn path under an
ImportError guard, so on main the import failed silently and every merge
launch went through Triton's full per-call dispatch. Import it from the new
module, without the guard.
XiaobingSuper added a commit to ROCm/ATOM that referenced this pull request Nov 30, 2026
…iton's key

`aiter.ops.triton.utils.fast_launch` (ROCm/aiter#8061) keys a launch on
what Triton specializes on (with by_specialization=True, ints by their
1 / multiple-of-16 / width class), plus the device and the knobs Triton
keys on, and keeps the ordinary path for hooks and torch.compile. Wrap
the deferred decode-ids fill and the KV-indices expansion with it; the
call sites stay `kernel[grid](...)`. ATOM's own FastLaunch and its
stand-in tests go; the hip_copy test moves to its own file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
XiaobingSuper added a commit to ROCm/ATOM that referenced this pull request Nov 30, 2026
… epoch is sealed at capture start

An aiter older than ROCm/aiter#8061 has no fast_launch; the two launches then
go through Triton's own dispatch instead of failing every import of
model_runner and the attention backends.

A publish no longer checks capture on the epoch's own stream, so the runner
checks once before each capture (decode and prefill recordings) that its
epoch is sealed (PublicationOwner.check_sealed).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
junna2016 added a commit to alibaba/rtp-llm that referenced this pull request Nov 30, 2026
Apply the tested ROCm/ATOM#3431 and ROCm/aiter#8061 backport in the shared ROCm package overlay for both disaggregated and colocated serving.
omuhamma added a commit that referenced this pull request Nov 30, 2026
Resolve the flash_kda.py conflicts: keep this branch's Gluon pipeline and use
main's _IS_GFX1250_FAMILY (gfx1250-strict) arch test. fast_launch now comes
from aiter/ops/triton/utils (main #8061), which replaces this branch's copy.
junna2016 added a commit to alibaba/rtp-llm that referenced this pull request Dec 1, 2026
Apply the tested ROCm/ATOM#3431 and ROCm/aiter#8061 backport in the shared ROCm package overlay for both disaggregated and colocated serving.
ZLkanyo009 added a commit to ROCm/ATOM that referenced this pull request Dec 3, 2026
…ctives on aiter custom all-gather / reduce-scatter, cached GPU arch lookup (#3429)

* perf(sglang/qwen4-exp): read the GPU arch once in the BF16 GEMM config hook

The gfx950 hipBLASLt bypass wraps aiter's get_GEMM_A16W16_config and asked
torch.cuda.get_device_properties(0) on every call, i.e. on every BF16 GEMM
(about 290 per Qwen3.8-Flash-Next prefill forward). The query costs about
8-11 us of host time per GEMM. The arch cannot change while the process
runs, so cache it.

Co-authored-by: Cursor <[email protected]>

* perf(qwen4-exp): run the sequence-parallel collectives on PyNccl

The token-sharded HC streams all-gather every sub-layer input and
reduce-scatter every sub-layer output: about 105 all-gathers and 92
reduce-scatters per 2112-token TP2 prefill forward, plus the QSA row
gather. They went through GroupCoordinator.all_gather/reduce_scatter_tensor
with use_custom=False, i.e. torch.distributed's ProcessGroupNCCL, which costs
43-82 us of host time per call (bookkeeping, a side stream and two events).

Issue them on the TP group's PyNccl communicator instead (aiter's
device_communicator.pynccl_comm): the same RCCL collective on the current
stream, 19-45 us per call including the output allocation. The result is
bitwise identical. Groups without a usable PyNccl communicator, and dtypes
it does not map, keep the torch.distributed path. Graph capture never
shards, so captured decode graphs are unchanged.

Co-authored-by: Cursor <[email protected]>

* perf(qwen4-exp): launch the HC Triton kernels through a cached launcher

kernel[grid](...) runs all of Triton's JITFunction.run on every call:
it re-derives each argument's specialization (on ROCm that calls back into
Python per tensor), formats the options into the cache key, checks the
kernel's globals and builds launch metadata before the launch itself. That
is 20-26 us of host time per launch, against about 6 us for the compiled
kernel's launcher, and a Qwen3.8-Flash-Next prefill forward makes about 290
HC launches (combine + norm, scaled SiLU, gated mean).

Add atom.utils.triton_launch.CachedLauncher: the first launch of each
specialization goes through kernel[grid], and the compiled kernel is kept
under a key built from what Triton's own key is built from (device, the
knobs in the compile options, per tensor dtype / 16-byte alignment / the
2 GiB buffer-ops range, per int ==1 / %16, constexpr types and values).
Later launches with that key call the launcher directly. Hooks, kernels
with checked globals or unmodelled parameters, torch.compile tracing,
callable grids and other argument kinds keep going through Triton.

A CPU test checks the key against Triton's binder so that a Triton upgrade
that changes what it specializes on fails it; GPU tests check the HC
wrappers bitwise against plain kernel[grid] launches (aligned and not,
prefill and small batches) and under CUDA graph capture.

Host time per HC launch: 25-34 us -> 18-22 us (hot, 1056-row SP shard).

Co-authored-by: Cursor <[email protected]>

* fix(qwen4-exp): read the TP group's PyNccl directly and skip it under simulated TP

Review on #3429: read group.device_communicator.pynccl_comm instead of
probing it with getattr, and drop the copied NCCL dtype table and its
branches (SP only sends BF16 streams, int32 QSA groups and BF16 sums).
Take PyNccl only when the TP group has as many devices as TP ranks, so
simulated TP keeps its patched, zero-padding collectives.

Co-authored-by: Cursor <[email protected]>

* docs(qwen4-exp): drop host-time figures, complete the launcher bypass list

Point the _live_gfx and CachedLauncher host-time notes at #3429 instead
of figures that will go stale, list non-int32 ints and non-scalar
constexprs among the launches CachedLauncher leaves to kernel[grid], and
say the key guard test only runs where Triton is installed.

Co-authored-by: Cursor <[email protected]>

* Revert "perf(qwen4-exp): launch the HC Triton kernels through a cached launcher"

This reverts commit c142f87, together
with the launcher-only lines 39463e7 added to atom/utils/triton_launch.py
and tests/test_triton_launch.py. The HC launches go back to kernel[grid].

The cached launcher moves into aiter's fast_launch (ROCm/aiter#8061);
the HC launches will switch to it in a separate PR after that lands.

Co-authored-by: Cursor <[email protected]>

* perf(qwen4-exp): run the SP collectives on the TP group's custom all-gather / reduce-scatter

GroupCoordinator.all_gather / reduce_scatter_tensor with use_custom=True,
instead of calling the group's PyNccl communicator directly. On MI308X TP2
(hidden 2560 bf16, 1024-12288 tokens) the custom kernels take 3-7% less
device time than PyNccl on all-gather and 7-12% less on reduce-scatter. A
reduce-scatter above 64 MiB (T > 13107) falls back to NCCL inside the group.

* fix(qwen4-exp): honor custom collective availability in sequence parallel

Bind one use_custom decision per SP object from ATOM_USE_CUSTOM_ALL_GATHER
and the enabled custom communicator, and pass it to gather and scatter.
This preserves the opt-out and uses the group's NCCL path when device or
custom communication is unavailable. Simulated TP keeps its group shims.

Cover enabled, opted-out, missing and disabled communicators in the SP
call tests, and exercise the real single-device simulated-TP zero fill.

Validation on MI308X: 55 related tests passed; real TP2 produced bitwise
PyNccl-equivalent output for 250 shape/configuration cases per rank, with
custom/NCCL call counts checked and SP disabled during graph capture.
Five in-memory gate/call mutations were caught. Black and Ruff pass.
Normal enabled computation is unchanged; serving/GSM8K was not rerun.

* fix(qwen4): check custom SP eligibility for every tensor

Use aiter eligibility queries on contiguous all-gather inputs and padded
reduce-scatter inputs so rejected tensors take the direct NCCL path.
Document the shared custom-collective opt-out and test size boundaries.

* Fix request intake and prefill test fixture defaults

---------

Co-authored-by: Cursor <[email protected]>
gbyu-amd added a commit that referenced this pull request Dec 3, 2026
…rfills the GPU (#7946 @ 88c4ddf, head 2026-11-13T18:08:12Z)

Applied as the diff 74a3010..88c4ddf (3 files) onto the rebased 1116 tree; PR state: draft, author gbyu-amd, base main.

(cherry picked from commit 572a65d)

Rebase onto main 12-03: imports fast_launch from aiter.ops.triton.utils.fast_launch; main's #8061 moved it there from _triton_kernels/kimi_delta_attn/.
gbyu-amd pushed a commit that referenced this pull request Dec 3, 2026
…7916 @ 7e2f22e, head 2026-11-16T05:44:05Z)

Applied as the diff 8bbce0d..7e2f22e (8 files) onto the rebased 1116 tree; PR state: open, author Liang-jianhao97, base main.

(cherry picked from commit becedb0)

Rebase onto main 12-03: main #8061 moved fast_launch from _triton_kernels/kimi_delta_attn/ to utils/fast_launch.py and already takes the ordinary path while a launch hook is set (this PR's _launch_hooks_idle). The old file stays deleted; this PR's other fast_launch change, falling back to the ordinary launch when CompiledKernel.run raises TypeError (launcher ABI changed), is ported into utils/fast_launch.py as a per-wrapper disable. kda_one_token.py and test_kda_one_token.py import utils.fast_launch. bench_kda.py keeps main's gating / recurrent case backends (#7990) and adds this PR's one_token / generic backends, --padded, and a shape check per family; --timing rotating takes both families.
gbyu-amd pushed a commit that referenced this pull request Dec 3, 2026
…-15T03:50:39Z)

Applied as the diff 33ae4ce..9c0c33e (5 files) onto the rebased 1116 tree; PR state: open, author Liang-jianhao97, base feat/gfx1250-kda-packed-writeback.

(cherry picked from commit abf0b0f)

Rebase onto main 12-03: imports fast_launch from aiter.ops.triton.utils.fast_launch; main's #8061 moved it there from _triton_kernels/kimi_delta_attn/.
gbyu-amd added a commit that referenced this pull request Dec 3, 2026
…ersistent split-KV

- carry_state (thd entry): the epilogue merges this launch's partial softmax
  into the caller's running (O, LSE) in place; a sequence with no keys in the
  launch keeps its rows. Chunked-context prefill then needs no
  merge_attn_states and no per-chunk O/LSE.
- Grid: the m-tile count is padded to an odd number so one m-tile's heads
  spread over all 8 XCDs. Bitwise identical output.
- Persistent split-KV launch (thd, batch <= 32; AITER_FMHA_A8W8_PERSISTENT=0
  restores the grid): #CU workgroups decode a (batch, m-tile, head, KV part)
  work list in-kernel; split parts are LSE-merged by fmha_ps_merge.py, and
  under carry_state the running state is folded into part 0 in the epilogue.

MI455X, Kimi-K3 MLA (96 heads, qk 192 / v 128), ms per layer-step
(new-token causal call + 25-28 context chunk calls):
  FMHA + merges, 3 steps:  25.08 / 20.69 / 24.35 -> 14.10 / 13.18 / 12.48
  FMHA only:               18.61 / 15.85 / 18.26 -> 13.76 / 13.23 / 12.36
  causal prefill without cache (odd grid): -6..-27%
Per call: 586x32768 552-600 -> 460-473 us, 195x32768 687 -> 234 us.
Accuracy: vs the previous kernel O max abs <= 8.4e-4, LSE <= 1.9e-6; vs an
fp32 reference rel-L2 2.2e-2 (unchanged, FP8 P).

(cherry picked from commit b84b19e)

Rebase onto main 12-03: imports fast_launch from aiter.ops.triton.utils.fast_launch; main's #8061 moved it there from _triton_kernels/kimi_delta_attn/.
ZLkanyo009 added a commit to ROCm/ATOM that referenced this pull request Dec 4, 2026
… output-gate, QSA and q/k-norm Triton wrappers on aiter's fast_launch

Use aiter's shared `fast_launch(kernel, by_specialization=True)` for twenty existing Triton kernel launchers in the Qwen HC/GDN/output-gate/QSA/qk-norm wrappers. Kernel arguments, launch options and grid values are preserved; repeated calls avoid Triton's full host dispatch path. The dependency is ROCm/aiter#8061, merged as `6b29fd7983ad0aa5543afa63c72e29976484a1e3`.

This PR remains Draft. Full question-paired model accuracy and remaining model acceptance are incomplete. The historical Native MTP3 TTFT grid at `b00a789573079` improves in 45/60 cells and regresses in 15; all 372 formal output pairs match. These results are not measurements of the main-synchronized implementation.

## Motivation


`kernel[grid](...)` runs all of Triton's `JITFunction.run` on every call: the binder, cache-key formatting, the globals check and the launch metadata. A c=1 Qwen3.8-Flash-Next prefill forward makes about 780 Triton launches this way. Counting the launches of one SGLang target forward (8192/6080, 2112 new tokens, TP2) in a profiler trace:

- 289 are hyper-connection (HC) launches;
- about 300 come from the GDN, output-gate, QSA and q/k-norm wrappers below;
- 180 are the FLA chunk kernels, which #3426 replaces with FlyDSL when MTP is on.

Native also runs the QSA scorer and sparse attention as Triton kernels. That gives it 337 such launches in the 2096-token step and 324 in the 16-token step.

## Changes

Each kernel has one module-level launcher. Wrappers pass the same arguments and per-call launch options; the shared API handles key selection and ordinary-Triton fallback. ATOM carries no local dispatcher or optional-import fallback.

- HC: the single/multi-row `hc_combine_norm`, `scaled_silu`, `hc_gated_mean` and `hc_gated_mean_quant` wrappers.
- GDN: `l2norm_fwd`, `causal_conv1d_fn`, `compute_causal_conv1d_metadata` and `fused_gdn_gating`. The convolution grid is the tuple its previous function returned, using the same fixed block sizes.
- Output gates: `sigmoid_rmsnorm_quant`, `sigmoid_mul_quant` and `sigmoid_mul`. `sigmoid_mul` and `scaled_silu` share the `_gated_pointwise_kernel` launcher.
- QSA helpers: mRoPE, cache writes, group compression, selected-block expansion and compressed-slot mapping; both Triton scorers and sparse attention.
- `fused_qk_norm` / `DualRMSNorm`, retaining the existing warp choice.

`tests/test_fast_launch_wrappers.py` compares each wrapper with the same kernel on ordinary Triton via `fast_launch.bypassed()`, checks first compilation and repeat hits, and exercises graph capture/replay for decode wrappers. It covers prefill/SP/tail sizes, input alignment, convolution state layouts, fresh/resumed state, both scorers, split-K attention, output-gate layouts and the 1024/8192-row switches. This is a GPU test file; CPU CI skips it without the GPU stack.

## Main synchronization and validation

The feature is synchronized with main `ed0e6f6ed3d539e2ead77ffeca290652266df7e7`. Its own diff is seven production modules plus the original wrapper test. Main's TP-row refactor, GDN replay flush arguments, norm implementations and HC geometry support are preserved. Removing the original launcher substitutions (and expressing the original fixed convolution grid equivalently) makes all seven module ASTs match main.

All twenty launcher mappings and targeted kernel ASTs match `b00a789573079`; the wrapper test file is byte-identical to that version. Syntax, Black, Ruff and whitespace checks pass. No new GPU or model run was made for this synchronization; source equivalence does not establish current-main model accuracy or performance.

At `b00a789573079`, the 2026-11-27 MI308X run passed all 163 wrapper GPU cases / 489 phases, without skips, xfails, errors or failures. It used the original tests and normal conftest, the fixed e8 image, merged AITER `fb3f506d390414433da9aa437b2a1af4beb3fa21`, Torch `2.10.0+rocm7.2.4` and Triton `3.8.0`. This establishes wrapper correctness for that recorded version, including its graph cases. The model runs below remain separate evidence.

## Native TTFT at b00a789 (2026-12-02)


Base `739165651cdd` -> head `b00a789573079` completed the original six fresh-service groups per arm on host20 physical GPUs 6/7: TP2/EP2/MTP3, input/cache-hit token pairs 8192/6080 and 10240/7104, output 200, concurrency 1/2/4/8/16, seeds 503/504/505, fixed e8 image and AITER `fb3f506d3904`. Each arm has 372 formal and 372 warmup requests. All 372 content/reasoning pairs, inputs, request payloads and usage match.

The two original clients differ: `ten` improves TTFT in 27/30 seed/workload cells; `bench` improves in 18/30. For `bench`, the three-seed arm medians regress at 8192/c4 (909.33 -> 980.42 ms, +7.82%) and 10240/c2 (824.43 -> 921.37 ms, +11.76%). The largest individual-cell regression is 18.37%; a uniform TTFT benefit is not established.

[All 60 TTFT/TPOT/throughput pairs, three-seed summaries and statistic definitions](#3431 (comment)). Full 1,319-question accuracy and model graph-path coverage remain open. The [earlier five-request check and separate untimed 19/20-wrapper diagnostic](#3431 (comment)) remain separate evidence. Earlier performance and accuracy below are historical.

## Earlier performance evidence


Setup: MI308X (gfx942), Triton 3.8, one GPU.

Host time per call, without the profiler, in µs. Calls run in bursts of 16 with a sync in between, over 5 interleaved rounds; the figure is the median of the round medians. "Cold" puts 8 MiB of cache traffic and unrelated Python between two calls. The baseline is #3429 at `fa5ebfe15`, where every wrapper is on plain `kernel[grid]`; the other column is this PR on `fast_launch(by_specialization=True)` at `4bd4fe4c8`, with #8061 at `7c54c82f4`.

| wrapper (per-rank shape) | `kernel[grid]` hot / cold | `fast_launch` hot / cold |
|---|---:|---:|
| `causal_conv1d_fn` (2112 tokens) | 71.1 / 105.8 | 53.4 / 83.4 |
| `qsa_sparse_paged_gqa` (2096 rows, 1 split) | 72.9 / 113.6 | 57.4 / 94.3 |
| `qsa_paged_mqa_logits` MFMA (2096) / stacked (16) | 67.2 / 108.5, 68.9 / 110.9 | 53.6 / 90.9, 55.2 / 93.8 |
| `qsa_compress_groups` (2112) | 47.9 / 81.5 | 37.3 / 66.4 |
| `qsa_apply_mrope` (attention Q/K, 2112) | 47.6 / 83.1 | 38.2 / 70.1 |
| `sigmoid_rmsnorm_quant` (2112 × 24 × 128) | 36.4 / 65.9 | 28.9 / 54.4 |
| `fused_qk_norm` (2112) | 34.9 / 63.7 | 25.7 / 50.4 |
| `hc_combine_norm` (2112 / 16) | 33.0 / 59.4, 32.6 / 58.6 | 24.8 / 48.1, 24.2 / 47.5 |
| `fused_gdn_gating` (2112) | 32.7 / 59.6 | 23.3 / 44.9 |
| `sigmoid_mul_quant` (2112 × 3072) | 30.7 / 56.7 | 24.7 / 47.7 |
| `scaled_silu` (2112) | 29.5 / 56.5 | 23.8 / 47.5 |
| `hc_gated_mean_quant` (16) / `hc_gated_mean` (2112) | 38.9 / 67.5, 26.1 / 50.7 | 32.0 / 57.6, 21.6 / 43.4 |
| `qsa_expand_block_indices` (1056) | 33.2 / 64.7 | 25.5 / 53.5 |
| `qsa_store_rows` (2112) / `qsa_compressed_slots` | 24.8 / 50.1, 23.0 / 50.8 | 20.6 / 43.4, 18.2 / 42.0 |
| `l2norm_fwd` (2112 × 8 × 128) | 24.4 / 52.4 | 20.1 / 43.5 |

`sigmoid_mul` is not in the table: this checkpoint's prefill does not run it.

The table above uses #8061 at `7c54c82f4`. There, `fast_launch` saved less per call than the ATOM-local `CachedLauncher` of the previous revision, because its extra guards cost about 2–9 µs. For example, `causal_conv1d_fn` measured 69.6 → 44.1 µs hot with `CachedLauncher` and 71.1 → 53.4 µs with `fast_launch`. #8061 `7324631fc8` makes a hit about as cheap as `CachedLauncher`. Summed over 7 of these wrappers, a hot loop gives 154.3 µs for `CachedLauncher`, 169.7 µs for #8061 `6cccc0974` and 159.2 µs for `7324631fc8`.

End to end, this PR was measured with the new launcher by ablation: the same integration tree with and without it.
- Setup: MI308X, TP2, issue protocol (cold 8192 c=1, then warm 8192/6080 and 10240/7104 at c=1 and c=4, round 0 dropped), no profiler, one stack at a time, each configuration started twice in palindromic order.
- With this PR: ATOM integration tree `700d662e6`, a merge of the PR branches that includes this PR at `943dae39f` and #3429 at `fa5ebfe15`.
- Without this PR: `63ce29825`, the same merge without this PR.
- Both use the same aiter overlay with #8061 at `7324631fc8`.

TTFT, pooled median in ms:

| | with this PR | without | with − without |
|---|---:|---:|---:|
| SGLang 8192/6080 c=1 | 153.0 | 164.9 | −11.9 |
| SGLang 8192/6080 c=4 | 508.4 | 520.2 | −11.8 |
| SGLang 10240/7104 c=1 | 200.9 | 202.2 | −1.3 |
| SGLang 10240/7104 c=4 | 780.8 | 794.6 | −13.7 |
| SGLang cold 8192 c=1 | 442.7 | 443.2 | −0.4 |
| Native 8192/6080 c=1 | 300.8 | 315.1 | −14.3 |
| Native 10240/7104 c=1 | 410.7 | 434.6 | −23.9 |
| Native cold 8192 c=1 | 661.4 | 689.0 | −27.5 |

Native c=4 is left out: after it is split by how the requests were batched, each group has only 1–6 waves.

GSM8K with this PR on #8061 `7324631fc8` (limit 200, 5-shot), flexible / strict and MTP accept rate:
- SGLang 0.985 / 0.985 and 0.717;
- Native 0.985 / 0.985 and 0.718.

The kernels and their arguments are unchanged. All 302 bitwise cases are equal: each wrapper called twice (compiling, then from the cache) and compared byte for byte with #3429's `kernel[grid]` wrapper on the same inputs, across 6 wrapper groups including HC.

## Notes

- Decode. Some of these wrappers also run in the decode CUDA graphs: mRoPE, cache writes, gating, q/k norm, scorer, attention and HC. The first launch of a key goes through `kernel[grid]`. Later launches call the same compiled kernel's launcher on the current (capture) stream, so the graphs are unchanged.
- torch.compile. `fused_qk_norm` (`DualRMSNorm`, used by Qwen3-Next), `l2norm_fwd`, `causal_conv1d_fn` and `fused_gdn_gating` are shared ops that a model under `@support_torch_compile` can trace. Since #8061's `1b63b6344`, a traced launch goes to `kernel[grid]` before `fast_launch` reads any of its state, so `fullgraph=True` traces them as before. Qwen4Exp itself runs eager in both stacks.
- Not covered here:
  - the FLA chunk kernels (#3426);
  - aiter's `_mla_decode_fwd_reduce_kernel`;
  - `_gemma_rmsnorm_kernel`, the PLE kernels and HC's small-batch kernels (1–7 launches each per forward);
  - the non-quantizing `sigmoid_rmsnorm`, which this checkpoint's prefill does not run.

cc @valarLip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants