[AMD][CI] Add a model cache audit that counts per-commit workflows - #36114
Draft
michaelzhang-ai wants to merge 1 commit into
Draft
[AMD][CI] Add a model cache audit that counts per-commit workflows#36114michaelzhang-ai wants to merge 1 commit into
michaelzhang-ai wants to merge 1 commit into
Conversation
The AMD runners share one HuggingFace cache PVC per cluster with no eviction,
so it fills and a multi-hundred-GB download dies partway through with ENOSPC.
Deciding what is safe to drop needs a join from register_amd_ci tests to the
checkpoints they name to the jobs that dispatch them.
An audit that joined only the two nightly workflows put 939 GiB on the tw PVC
as reclaimable. Every byte of it was live: 289 of 429 AMD registrations are
dispatched only by the per-commit pr-test-amd*.yml workflows, whose jobs run on
linux-mi35x-gpu-1 and mount the same PVC as the 8-GPU nightly jobs. Deleting by
that list would have broken AMD CI on every PR.
Two details the tool exists to get right, both of which a hand-rolled scan got
wrong first time:
* --runner scopes to a cluster by the dispatching job's runs-on label.
Without it tw is compared against every AMD suite and the mi300-only
checkpoints all report as missing -- 134 rather than 24.
* Model ids resolve through list_stage_models.py's constant table, not string
literals. Llama-3.2-1B-Instruct looks unreferenced to a literal search but
reaches five per-commit suites via DEFAULT_SMALL_MODEL_NAME_FOR_TEST.
Dispatch detection accepts both '--suite <name>' and a bare test path, since
several MI35x perf steps invoke the file directly.
The suite -> models half is reused from list_stage_models.py rather than
reimplemented. Because nothing executes this tool in CI, a refactor there would
break it silently, so test_amd_cache_audit.py runs the real join against the
real repo and asserts the contract; ci-model-inventory.yml runs it next to the
extractor's own tests.
Co-authored-by: quitenode <quitenode@users.noreply.github.com>
5 tasks
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.
Motivation
The AMD runners share one HuggingFace cache PVC per cluster, nothing evicts from it, and it fills up — a multi-hundred-GB download then dies partway through with
ENOSPC. Deciding what is safe to drop needs a join:register_amd_citests → the checkpoints those tests name → whether any AMD workflow actually dispatches them.Getting that join wrong is expensive. A recent audit of the tw MI35x PVC joined only the two nightly workflows and reported 939 GiB as reclaimable. Every byte of it was live: 289 of 429 AMD registrations are dispatched only by the per-commit
pr-test-amd*.ymlworkflows, whose jobs run onlinux-mi35x-gpu-1and mount the same PVC as the 8-GPU nightly jobs. Deleting by that list would have broken AMD CI on every PR.Modifications
scripts/ci/utils/amd_cache_audit.py(new) — performs the join, counting per-commit and nightly separately and never reporting one without the other. With--cache-diror--cache-listingit diffs against a live cache and sorts the result into three buckets, of which only the first is unconditionally safe:Two details it exists to get right, both of which a hand-rolled scan got wrong on the first pass:
--runnerscopes to a cluster by the dispatching job'sruns-onlabel. Without it, tw is compared against every AMD suite and the mi300-only checkpoints all read as missing — 134 rather than 24.list_stage_models.py's constant table, not string literals.meta-llama/Llama-3.2-1B-Instructlooks unreferenced to a literal search but reaches five per-commit suites throughDEFAULT_SMALL_MODEL_NAME_FOR_TEST.Dispatch detection accepts both
--suite <name>and a bare test path, since several MI35x perf steps invoke the file directly rather than going through a suite.The suite → models extraction is reused from
scripts/ci/list_stage_models.pyrather than reimplemented; it already handles AST extraction, constant resolution and overrides for any backend, and already supports--backend amd.scripts/ci/test_amd_cache_audit.py(new) — unit tests for the label/text/cache-path helpers, plus an end-to-end case that runs the real join against the real repo. That last one is the point: no workflow executes this tool, so a refactor inlist_stage_models.pywould break it silently and nobody would notice until someone deleted the wrong checkpoints. It asserts the contract rather than exact counts, which move whenever a test is added — including specifically that the per-commit bucket is non-empty and that constant-resolved models still appear..github/workflows/ci-model-inventory.yml— runs those tests beside the extractor's own, and adds both files to the PR path filter.Accuracy Tests
Not applicable — CI tooling, no product code.
python3 -m unittest discover -s scripts/ci -p 'test_amd_cache_audit.py'→ 15 tests, ~15 s, stdlib only, no GPU and no sglang import.Behaviour on the current tree:
--runner mi35xresolvesnightly_only 39 / per_commit_only 3 / both 2 / undispatched 75over 157 checkpoints; a cache diff against a planted listing correctly sorts an unreferenced entry into "safe to drop" and reports the rest as missing.Speed Tests and Profiling
Not applicable. The end-to-end test adds ~15 s to
ci-model-inventory, which is anubuntu-latestjob.Checklist
Review and Merge Process
CI States
Latest PR Test (Base): ❌ Run #32673641979
Latest PR Test (Extra): ❌ Run #32673641830
Latest PR Test (AMD ROCm 7.2): ❌ Run #32673642000