Repository navigation
[FlyDSL] [CI] AOT cache: build a missed entry at launch, and say why it missed - #8939
Conversation
…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]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
WAITING ON AUTHORPR Self-ReviewRevision 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
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
- 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]>
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
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 fromaiter/ops/flydsl/__init__.pybefore 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.COMPILE_ONLYon a preload, orAITER_FLYDSL_AOT_RUNTIME_BUILD=0. The check runs again after the trace.fingerprint.manifestdiffers, 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/flydsl_aot_cache.md, theflydsl-aot-exportskill,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-endtest_aot_cachewith 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