Repository navigation
[FlyDSL] [AOT] Port the remaining AOT-replayed launchers to export_to_c - #8911
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
6309964 to
d70d989
Compare
d70d989 to
1ef8160
Compare
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]>
1ef8160 to
d8e0faf
Compare
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.qkv_chain_cooperative,qkv_reduce_insert,mxfp8_gemm_decode_splitkqkv_frontgemm_a16w16_ring_gfx950,gemm_a16w16_cat_x_ring_gfx950,gemm_a8w8_mxfp8_4wavegemmconv3d_implicit_gfx1250convmoeDesign points:
aot_factory(...).lazy. gfx1250 conv3d, whose factory is not cached by its arguments, returns a newaot_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.lazy_launcherhandle is for one CUDA device, so two GPUs in one process never share a JIT-compiled function; the disk entry is shared._resolve, so a miss builds its.oat the launch for later processes (lazy_launcherhandles included);AITER_FLYDSL_AOT_RUNTIME_BUILD=0keeps the JIT fallback.silu_and_mul_fq/swiglu_and_mul(split-K only), stay on JIT.ep_arena_handle, aConstexpr), so it stays on JIT via an unboundlaunch_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--checkunderAITER_FLYDSL_AOT_CACHE=verify(re-traces and compares IR hashes). All RC=0, no missing-entry / traceback lines in logs:qkv_frontfull;gemmon the MiniMax-M3 rows using ring/4-wave (40 jobs);convqwenimage_vae_gfx1250(64 entries)moefull 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 4test_a_split_k_tdm_gemm_replay_reaches_flydslcases (deselected) fail identically onmain.test_lazy_launcher_builds_only_without_an_entrycovers prebuild (one build), hit (load, no build, any device), a miss built at the launch (one build, then loaded) and, underAITER_FLYDSL_AOT_RUNTIME_BUILD=0, the JIT fallback (one build per device);test_lazy_launcher_retries_a_failed_build_and_is_plain_in_mode_0covers a failed build being retried and mode 0.Not yet validated
PR Self-Review
Reviewed revision
d8e0faf103Behavior 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=0orAITER_FLYDSL_AOT_CACHE=0falls back to the JIT path as before. Kernels with no AOT replay onmainare not touched.Validation and unverified scope
Validated on a gfx942 box with no GPU visible, compile-only: every affected replay (
qkv_front,gemmring/4-wave rows,convgfx1250,moegfx1250 full grouped table) built into a fresh cache dir, then--checkand--checkunderAITER_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 4test_a_split_k_tdm_gemm_replay_reaches_flydslcases, which fail identically onmain. 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 alazy_launcherhandle whosebuild()runs only to trace an entry or on the JIT path;test_lazy_launcher_builds_only_without_an_entryasserts 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 setsAITER_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