Repository navigation
Core zoo: restore a main-built Inductor cache - #19126
Merged
Merged
Conversation
The zoo suite's CPU compile tests rebuild every Inductor kernel with g++ on every run. A same-runner A/B of the 25 heaviest zoo files (cold, warm, cold on Intel Xeon 6975P-C and AMD EPYC 7763) measured ~14.5% less wall time with a warm cache and identical pass/skip/fail IDs. The cache is ~50-80 MB per leg. Saved on main only, after a green suite, keyed by the zoo SHA; PRs restore the newest generation for their leg by prefix. The janitor keeps one generation per leg.
…rs, save on pushes only
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
danielhanchen
added a commit
that referenced
this pull request
Nov 24, 2026
) ## Problem Since #19126 added a restored Inductor cache to Core zoo, almost every Core zoo leg on a PR has failed. Over the last day: 20 failed runs against 33 green, with the failures starting right after #19126 merged. In the failing jobs 12 to 17 pytest workers die inside compiled kernels: ``` free(): invalid pointer Fatal Python error: Aborted File "/home/runner/work/_temp/inductor-cache/lu/clufi3ej....py", line 596 in call File ".../torch/_inductor/output_code.py", line 638 in __call__ ``` (some legs show `*** buffer overflow detected ***` instead), and xdist then ends the session with `INTERNALERROR ... KeyError: <WorkerController gwN>`. ## Cause - Every crashing job restored a `zoo-inductor-v1-*` cache. The four failing jobs that ran without one (before the first save, or on a miss) had no worker crash. - The cache is good on the machine that built it. The main push that saved `zoo-inductor-v1-t4576-trl0latest-...-a9f1c604...` at 16:04 ran the suite green with it; #19286 restored that exact key a few minutes later and lost 4 workers. - Locally, the crashing files (`test_frozen_table_store.py`, `test_tiling_inductor_short_tail.py`, `test_moe_stacked_expert_lora_reaches_forward.py`, `test_cpu_ce_compile.py`, `test_grpo_rollout_correction.py`, `test_moe_swap_weights_restores_parameters.py`) run cold, warm and warm again against one cache dir on one machine with 291 passed in all three arms. Inductor builds CPU kernels with `-march=native`, and its own cache key does not name the CPU. GitHub's `ubuntu-24.04` pool mixes Intel Xeon and AMD EPYC generations, so a cache saved on one model was being handed to PRs on another. #19126's A/B ran cold and warm on the same runner, which could not see this. ## Fix - The `inductor-stack` hash now also covers `gcc -march=native -Q --help=target`, the target gcc actually resolves for `-march=native`. A cache is restored only on the CPU target that built it; another model misses cleanly and runs cold. If gcc prints nothing the step fails instead of keying without the CPU. - The step prints the runner's CPU model and resolved `-march`, so a future crash can be matched to the runner it came from. - The key prefix moves from `zoo-inductor-v1-` to `zoo-inductor-v2-`, so none of the existing entries are restored again. - `cache-janitor.yml`: comment only; the `zoo-inductor-*` family rule already strips just the trailing zoo SHA. ## Test `tests/studio/test_zoo_inductor_cache_is_cpu_keyed.py`: - the restore key, the restore prefix and the save key all carry the stack hash, the save key equals the restore key, and no `zoo-inductor-v1-` key remains; - runs the real `inductor-stack` step in bash with a stub `gcc` and `python`: two CPU targets give two different stack hashes, the same target gives the same hash, and an empty `gcc` answer fails the step without writing a key. On the old workflow all three tests fail; with the change, 3 passed. Every test that reads `consolidated-tests-ci.yml` or `cache-janitor.yml`: 315 passed, 4 skipped. ## Follow up This PR's own Core zoo legs run cold, since no v2 entry exists yet. After it merges, main pushes save one v2 generation per CPU target as they go green. If a PR leg still loses workers after restoring a v2 entry, the printed CPU line will show whether it matched the saver, and the restore should then be dropped rather than keyed further.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Core zoo's three legs run the unsloth_zoo suite on CPU, and its compile tests rebuild every Inductor kernel with g++ on every run. On a recent staging run of
main, the default leg hit its 50 minute job cap and the latest leg finished at the cap.Change
consolidated-tests-ci.yml,consolidated-zoo: before the zoo pytest step, pointTORCHINDUCTOR_CACHE_DIRat$RUNNER_TEMP/inductor-cacheand restore it.zoo-inductor-v1-<leg>-<stack>-<pyproject hash>-<zoo SHA>.<stack>hashes the installed torch, triton and transformers versions, so a new compiler stack or new pins start a fresh cache instead of growing an old one.main, after a green suite, matching the pip cache gate (test_no_workflow_saves_a_cache_on_a_pull_request_ref). Aworkflow_dispatchnever saves, since it can pin a candidateunsloth_zoo_ref.cache-janitor.yml: azoo-inductor-*family that strips the trailing 40-hex SHA and keeps one generation per prefix.The latest leg is red on
maintoday (2 Inkling2 tests), so it will not save until that is fixed; its PRs run cold until then.Results
test_pypi_version_sync.py::test_pypi_version_is_not_ahead_of_main) appeared in both arms. The warm arm always ran second; with the other caches isolated, order alone was worth about 3% in earlier runs.Cache not found for input keys: zoo-inductor-v1-...) and the job continues.test_cache_budget_discipline.pyandtest_pip_cache_naming.py: 303 passed, 4 skipped.