Skip to content

[FlyDSL] [CI] AOT cache: build a missed entry at launch, and say why it missed - #8939

Merged
coderfeli merged 10 commits into
mainfrom
flydsl-aot-launch-build
Dec 1, 2026
Merged

coderfeli merged 10 commits into
mainfrom
flydsl-aot-launch-build

Conversation

@coderfeli

Copy link
Copy Markdown
Collaborator

Motivation

ATOM DSv4.1-Flash TP8 on gfx950 floods [FlyDSL AOT] no prebuilt entry (1568 lines = 185 keys × 8 ranks) and [fused_moe] no tuned FlyDSL config, and still does on a second run. The misses were a stale/mismatched cache (mostly tuned dsv41 GEMM keys), but the log could not say so, and nothing ever filled the cache outside a prebuild.

Changes

  • Launch builds a missed entry (aot_cache._launch_build) so the next process hits it. It is refused, and the launch traces on the JIT path as before, when what this process imported may differ from what the digest is made from:
    • aiter/ops/flydsl/source_snapshot.py (new; installed from aiter/ops/flydsl/__init__.py before FlyDSL or any kernel is imported) hashes each tracked source as it is imported. Modules in the dirs of declared sources run from the exact bytes hashed, via checked-hash pycs, so a same-size edit within the mtime granularity cannot slip through. Contents only, no mtimes.
    • also refused on a changed FlyDSL module or replaced FlyDSL library, a moved aiter install, a declared env var changed since cache creation, COMPILE_ONLY on a preload, or AITER_FLYDSL_AOT_RUNTIME_BUILD=0. The check runs again after the trace.
    • a failed build logs one error and disables further launch builds in the process (verify mode still raises, except an unwritable dir); a lock held by another builder is waited on for at most 10 min, then the launch misses.
  • Miss diagnosis: the first miss per cache logs a WARNING with the cause (no fingerprint dir + how fingerprint.manifest differs, nothing built, stale sources/env, key not prebuilt); later misses log at INFO.
  • fused_moe: report an untuned FlyDSL fallback once per shape and process, not per padded token count.
  • Docs: docs/flydsl_aot_cache.md, the flydsl-aot-export skill, AGENTS.md.

Test

python -m pytest -q tests/test_flydsl_aot_launch.py tests/test_flydsl_aot_cache.py → 41 passed (MI300X, includes the GPU end-to-end test_aot_cache with a new "aot launch build" step and unit tests for the snapshot, refusals, re-check after trace, failure-once and bounded lock wait). black/ruff clean.

🤖 Generated with Claude Code

…ssed

A launch that misses an AOT entry now exports it for the next process,
so a second run of a server no longer floods "no prebuilt entry". The
build is refused, and the launch traces on the JIT path, when what the
process imported may not match the sources the digest is made from:

- source_snapshot (installed by aiter/ops/flydsl/__init__.py before
  FlyDSL or any kernel is imported) hashes each tracked source as it is
  imported; modules in the dirs of declared sources run from the very
  bytes hashed, through checked-hash pycs. The comparison is by
  contents only, never mtimes.
- refused also when a FlyDSL module or library changed, aiter's install
  moved, a declared variable changed since the cache was created, a
  preload has COMPILE_ONLY on, or AITER_FLYDSL_AOT_RUNTIME_BUILD=0.
  The check runs again after the trace.
- a failed build logs one error and the process builds no more; a lock
  held by another builder is waited on for at most 10 minutes.

The first miss per cache logs a WARNING saying why it missed (no
fingerprint dir and how the fingerprint differs, sources or variables
changed, key not prebuilt); later misses log at INFO. fused_moe reports
an untuned FlyDSL fallback once per shape, not per token bucket.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderfeli
coderfeli requested a review from a team November 30, 2026 15:15
@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 8939 --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 [FlyDSL] AOT cache: build a missed entry at launch, and say why it missed [FlyDSL] [CI] AOT cache: build a missed entry at launch, and say why it missed Nov 30, 2026
@aiter-bot

aiter-bot commented Nov 30, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision f2ff6495ef64 · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. What permissions and untrusted-input boundary does this CI change have, and can fork PR code or text reach a privileged execution path?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer
  • FAIL — changed op test not explained in Changed op tests: op_tests/tuners/tune_comm_fused_moe.py
  • FAIL — changed op test not explained in Changed op tests: op_tests/tuners/tune_fhmoe.py
  • FAIL — changed op test not explained in Changed op tests: op_tests/tuners/tune_hc_gated_residual.py
  • FAIL — Changed op tests must explain why each changed op test is necessary and non-redundant

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

coderfeli and others added 9 commits November 30, 2026 15:32
- Compare declared variables with the environment as source_snapshot
  found it, before FlyDSL and the common sources read them at import,
  not only as of the cache's creation.
- Refuse a build when a declared source or FlyDSL module was imported
  again with other contents (a reload, or one file under two names).
- A source changed under the process (_check_unchanged, the check after
  the trace) is a miss, logged as a warning, not a failed build.
- An undeclared source at a launch logs one error and traces; a
  prebuild and verify still raise it.
- verify falls back only for an unwritable cache directory, not any
  OSError.
- A preload's COMPILE_ONLY miss is logged at INFO, leaving the warning
  to a miss that says why the cache misses.
- Read FlyDSL's sources once for the toolchain digest (same digest).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…uild

After a launch build of a cache fails, each key that misses it later
logs an error saying so (once per key, as its kernel is kept), rather
than only the first failure being an error and the rest INFO.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… pyc

_HashedLoader returned a cached .pyc's code with the path it was
compiled at; Python's own loader fixes it (_imp._fix_co_filename). In a
copied tree (cp -r, a Docker COPY with __pycache__), FlyDSL would read
kernel sources from the original tree and trace them. Also: a failed
build no longer logs an error per launch during another thread's
preload, and the docs name its per-key error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… FlyDSL

- aiter linked into site-packages from a checkout was skipped before
  realpath, so every launch build was refused ("imported before it
  could be hashed").
- The recorder is removed when aiter.ops.flydsl fails to import (no
  FlyDSL, or too old).
- A written pyc takes the source's mode, as Python's own loader does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- No uninstall when FlyDSL fails to import: the import error is enough.
- No /proc/self/maps scan for replaced FlyDSL libraries, and no check
  that aiter's install moved.
- One environment snapshot (source_snapshot.ENV), not one per cache too.
- No passing flag on _Miss, no special case for a symlinked aiter, no
  _KEY_TOKEN constant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tracking

- A failed launch build no longer stops the cache's other builds: each key
  tries its own and logs its own error. A source changed under the process
  is refused again cheaply by the import check, so no flag is needed either.
- A cache directory the process cannot write is a miss, checked before the
  build, instead of a list of errnos; verify raises every other failure.
- A launch waits for another builder as a prebuild does (blocking flock).
- A launch while another thread preloads builds as a launch may.
- source_snapshot no longer tracks FlyDSL's files; _toolchain_digest is
  main's again (same fingerprint). It writes its pyc with the loader's own
  _cache_bytecode, and its roots skip the dirs under aiter/ops/flydsl.
- _fingerprint_parts() returns its parts by name (same digest).
- base_tuner sets AITER_FLYDSL_AOT_RUNTIME_BUILD=0: tuning candidates are
  not exported into the shared cache. The switch is read at each miss.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- source_snapshot roots hold each directory as found and real: a module
  path is checked before it is resolved, and under a symlinked install no
  declared source was recorded, so no launch could build.
- The first refused miss warns even after a launch built an entry: the
  build's warning has its own flag.
- One _find_or_build for a prebuild and a launch; the reason for a build is
  worked out only when this process builds. _Miss keeps no directory, and
  verify is decided once.
- Docs: preloads build as a launch may; every reason a launch does not build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o date

Every reason a launch does not build, preloads that build, verify raising
every build failure, and entries a launch built in the miss diagnosis.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…made this one's dir

The miss diagnosis checked whether this fingerprint's directory exists
before naming the fingerprint that differs, but a launch build (or another
cache) creates it first, so the warning could no longer say what changed.
It now names other fingerprints holding this launcher's entries whenever
this one has none. The diagnosis runs once per launcher even if the build
fails, and the FlyDSL tuners outside base_tuner do not build entries for
candidate configs either.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

3 participants