Skip to content

[FlyDSL] [AOT] Port the remaining AOT-replayed launchers to export_to_c - #8911

Merged
coderfeli merged 1 commit into
mainfrom
flydsl-aot-export-remaining
Dec 1, 2026
Merged

coderfeli merged 1 commit into
mainfrom
flydsl-aot-export-remaining

Conversation

@coderfeli

@coderfeli coderfeli commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #8678, rebased on #8939: moves the FlyDSL launchers that an existing AOT replay reaches onto the export_to_c cache (FlyDSLAotCache). No new AOT coverage is added: kernels without a replay (comm-fused MoE, FlyDSL all-reduce, TP / gfx1250 / internode MegaMoE) are untouched and stay on JIT.

Area Caches Replay (existing)
QKV front qkv_chain_cooperative, qkv_reduce_insert, mxfp8_gemm_decode_splitk qkv_front
gfx950 ring HGEMMs, 4-wave mxfp8 GEMM gemm_a16w16_ring_gfx950, gemm_a16w16_cat_x_ring_gfx950, gemm_a8w8_mxfp8_4wave gemm
gfx1250 conv3d conv3d_implicit_gfx1250 conv
gfx1250 grouped MoE grouped GEMM + 11 helper caches the tuned rows reach moe

Design points:

  • No JIT front end on a hit. Call sites use aot_factory(...).lazy. gfx1250 conv3d, whose factory is not cached by its arguments, returns a new aot_launch.lazy_launcher(cache, key, build) handle: build() (the kernel definition) runs at most once, only to trace the entry or on the JIT path.
  • One JIT launcher per device. A lazy_launcher handle is for one CUDA device, so two GPUs in one process never share a JIT-compiled function; the disk entry is shared.
  • Miss = launch build ([FlyDSL] [CI] AOT cache: build a missed entry at launch, and say why it missed #8939). Every launcher bound here goes through [FlyDSL] [CI] AOT cache: build a missed entry at launch, and say why it missed #8939's _resolve, so a miss builds its .o at the launch for later processes (lazy_launcher handles included); AITER_FLYDSL_AOT_RUNTIME_BUILD=0 keeps the JIT fallback.
  • No cache without a replay. Only launchers an existing replay reaches are bound: grouped-MoE helpers reached only on EP / debug-switch / dead paths, and silu_and_mul_fq / swiglu_and_mul (split-K only), stay on JIT.
  • gfx1250 ep-scatter GEMM2 bakes the process's window handle (ep_arena_handle, a Constexpr), so it stays on JIT via an unbound launch_gemm_a8w4_tdm_ep().

Validation (gfx942 box, compile-only, no GPU visible)

Each replay built into a fresh AITER_FLYDSL_AOT_CACHE_DIR, then --check, then --check under AITER_FLYDSL_AOT_CACHE=verify (re-traces and compares IR hashes). All RC=0, no missing-entry / traceback lines in logs:

  • qkv_front full; gemm on the MiniMax-M3 rows using ring/4-wave (40 jobs); conv qwenimage_vae_gfx1250 (64 entries)
  • moe full gfx1250 grouped table (459 rows; 819 grouped GEMM + helper entries)

Unit tests (after the rebase on #8939): tests/test_flydsl_aot_launch.py tests/test_flydsl_aot_replay.py op_tests/tuning_tests/test_grouped_gemm_launch_abi.py: 105 passed; the 4 test_a_split_k_tdm_gemm_replay_reaches_flydsl cases (deselected) fail identically on main. test_lazy_launcher_builds_only_without_an_entry covers prebuild (one build), hit (load, no build, any device), a miss built at the launch (one build, then loaded) and, under AITER_FLYDSL_AOT_RUNTIME_BUILD=0, the JIT fallback (one build per device); test_lazy_launcher_retries_a_failed_build_and_is_plain_in_mode_0 covers a failed build being retried and mode 0.

Not yet validated

  • Runtime launches on GPU (this box has none); the hit path is covered by the unit test.

PR Self-Review

Reviewed revision

d8e0faf103

Behavior and intent

Launchers that an existing AOT replay already reaches (QKV front, gfx950 ring / 4-wave GEMMs, gfx1250 conv3d, gfx1250 grouped MoE and its helpers) traced their FlyDSL front end and loaded a JIT artifact in every new process. They now load the prebuilt export_to_c object from FlyDSLAotCache, so a hit runs no trace and no compile. A miss builds the entry at the launch (#8939); an uncacheable key, AITER_FLYDSL_AOT_RUNTIME_BUILD=0 or AITER_FLYDSL_AOT_CACHE=0 falls back to the JIT path as before. Kernels with no AOT replay on main are not touched.

Validation and unverified scope

Validated on a gfx942 box with no GPU visible, compile-only: every affected replay (qkv_front, gemm ring/4-wave rows, conv gfx1250, moe gfx1250 full grouped table) built into a fresh cache dir, then --check and --check under AITER_FLYDSL_AOT_CACHE=verify, all RC=0. Unit tests: pytest tests/test_flydsl_aot_launch.py tests/test_flydsl_aot_replay.py op_tests/tuning_tests/test_grouped_gemm_launch_abi.py: 105 passed after the rebase on #8939, plus the 4 test_a_split_k_tdm_gemm_replay_reaches_flydsl cases, which fail identically on main. Unverified: GPU runtime launches from loaded objects (the hit path is covered by unit tests only).

PR-specific question

Does a cache hit avoid running the kernel definition? Yes: call sites use aot_factory(...).lazy, and gfx1250 conv3d returns a lazy_launcher handle whose build() runs only to trace an entry or on the JIT path; test_lazy_launcher_builds_only_without_an_entry asserts no build on a hit.

Changed op tests

  • op_tests/tuning_tests/test_grouped_gemm_launch_abi.py: the ep-scatter grouped GEMM now launches through its own unbound launcher (launch_gemm_a8w4_tdm_ep()) so it stays on JIT while the non-EP launcher is bound to the cache. The fixture also sets AITER_FLYDSL_AOT_RUNTIME_BUILD=0: since [FlyDSL] [CI] AOT cache: build a missed entry at launch, and say why it missed #8939 a miss of the now-bound launcher would build a real gfx1250 entry instead of reaching the stubbed JIT compile. Without the update the test's stub asserts the single old launcher and fails on the EP case; no other test checks the grouped GEMM launch ABI for the EP path, so it is updated rather than duplicated.

🤖 Generated with Claude Code

@coderfeli
coderfeli requested a review from a team November 30, 2026 06:41
@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 8911 --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.

@aiter-bot

aiter-bot commented Nov 30, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision d8e0faf10368 · 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

Launchers that an existing AOT replay already reaches (QKV front, gfx950 ring / 4-wave GEMMs, gfx1250 conv3d, gfx1250 grouped MoE and its helpers) traced their FlyDSL front end and loaded a JIT artifact in every new process. They now load the prebuilt export_to_c object from `FlyDSLAotCache`, so a hit runs no trace and no compile. A miss builds the entry at the launch (#8939); an uncacheable key, `AITER_FLYDSL_AOT_RUNTIME_BUILD=0` or `AITER_FLYDSL_AOT_CACHE=0` falls back to the JIT path as before. Kernels with no AOT replay on `main` are not touched.

Validation and unverified scope

Validated on a gfx942 box with no GPU visible, compile-only: every affected replay (`qkv_front`, `gemm` ring/4-wave rows, `conv` gfx1250, `moe` gfx1250 full grouped table) built into a fresh cache dir, then `--check` and `--check` under `AITER_FLYDSL_AOT_CACHE=verify`, all RC=0. Unit tests: `pytest tests/test_flydsl_aot_launch.py tests/test_flydsl_aot_replay.py op_tests/tuning_tests/test_grouped_gemm_launch_abi.py`: 105 passed after the rebase on #8939, plus the 4 `test_a_split_k_tdm_gemm_replay_reaches_flydsl` cases, which fail identically on `main`. Unverified: GPU runtime launches from loaded objects (the hit path is covered by unit tests only).

PR-specific question

Does a cache hit avoid running the kernel definition? Yes: call sites use `aot_factory(...).lazy`, and gfx1250 conv3d returns a `lazy_launcher` handle whose `build()` runs only to trace an entry or on the JIT path; `test_lazy_launcher_builds_only_without_an_entry` asserts no build on a hit.

Changed op tests

- `op_tests/tuning_tests/test_grouped_gemm_launch_abi.py`: the ep-scatter grouped GEMM now launches through its own unbound launcher (`launch_gemm_a8w4_tdm_ep()`) so it stays on JIT while the non-EP launcher is bound to the cache. The fixture also sets `AITER_FLYDSL_AOT_RUNTIME_BUILD=0`: since #8939 a miss of the now-bound launcher would build a real gfx1250 entry instead of reaching the stubbed JIT compile. Without the update the test's stub asserts the single old launcher and fails on the EP case; no other test checks the grouped GEMM launch ABI for the EP path, so it is updated rather than duplicated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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.

Move the FlyDSL launchers that an existing AOT replay reaches onto the
export_to_c cache (FlyDSLAotCache):

- QKV front (qkv_chain_cooperative, qkv_reduce_insert,
  mxfp8_gemm_decode_splitk), the gfx950 ring HGEMMs, the 4-wave mxfp8
  GEMM and gfx1250 conv3d.
- gfx1250 grouped MoE: the grouped GEMM and the helper kernels the tuned
  rows reach. Helpers no replay reaches (EP-only, debug-switch or dead
  paths, split-K activations) stay on the JIT path, and so does the
  ep-scatter GEMM2, which bakes the process's window handle.

Kernels without an AOT replay (comm-fused MoE, FlyDSL all-reduce, TP and
gfx1250 MegaMoE) are left as they are, on the JIT path.

A cache hit does not build the kernel: call sites use
aot_factory(...).lazy, and gfx1250 conv3d, whose factory is not cached
by its arguments, returns a lazy_launcher handle, which builds its
launcher only to trace it or on the JIT path. A handle is for one CUDA
device, so JIT launchers are never shared across devices; entries on
disk are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderfeli
coderfeli force-pushed the flydsl-aot-export-remaining branch from 1ef8160 to d8e0faf Compare December 1, 2026 08:16
@coderfeli
coderfeli merged commit 1f96367 into main Dec 1, 2026
64 of 65 checks passed
@coderfeli
coderfeli deleted the flydsl-aot-export-remaining branch December 1, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants