Repository navigation
The cargo cache belongs on the CPU tiers, and the GPU's build is irreducible - #226
Merged
Merged
Conversation
…ducible `target/` moves onto a Modal Volume (`ferro-kittens-cargo`), mounted by the two tier-2 entry points and deliberately not by the GPU ones. `_cached_target` derives the per-crate directory from the working directory `_run` was given, and mounting the volume is the only switch there is. Tier 2 `build` at 41f9e57, warm against the same tree cold: wall 470.8 s -> 291.8 s steps 457.1 s -> 281.1 s (-176 s, -38%) clippy 67.6 s -> 17.3 s (four crates) A cold first fill costs nothing over the baseline. `regcount` is the check that this is placement and not measurement: run against 41f9e57 and against this tree, its output is identical over all 1650 lines -- every register count, the ladder, the timed twins, the occupancy gate, both censuses. The GPU half of the plan was measured and rejected. Warm on `device_tests` the cache does what it claims -- 58 dependency crates compiled become 1 -- and the container still gets *slower*, 53.3 s of cargo becoming 66.0 s and 60.0 s over two runs. The 58 dependencies were never the cost: they compile in parallel on `cpu=8` behind the long pole, which is the crate's own device codegen, and cargo-oxide redoes that on every invocation regardless. Two consecutive `run`s of an unchanged tree both rebuilt `device-tests` in full. So the volume trades free work for network-filesystem I/O there, and loses. What that leaves is the lever this PR adds instead: **fewer containers**. `session --arms` runs any comma-separated set of the named sweeps in one container, off one `ARMS` table that the individual entry points are now thin wrappers over -- so a session and N separate `modal run`s issue byte-identical commands and batching cannot change a number. Measured on `bench:softmax,bench:layernorm,device-tests`: 258.2 s as three runs, 161.2 s as one session, 97 GPU-seconds and 38% saved. `bench --case sol-k` and `profile` have no arm on purpose -- an arm that can wedge the container belongs in its own process. CI.md gains a spending policy section carrying all of the above plus the measurement ladder (local typecheck, tier 2, one container per A/B, a batched session for a multi-arm claim), and tier 3's cost line is corrected from a budgeted ten GPU-minutes to a measured 83.5 s.
This was referenced Aug 7, 2026
feitreim
added a commit
that referenced
this pull request
Aug 7, 2026
…is a gate (#225) (#229) * The jump tables were #219's after all, and the census that missed it is a gate (#225) Three readings of `regcount`'s jump-table census, each from a build that `_freshen` (#228) forced and whose four crates are seen to recompile in the container log, same image and same pinned nightly: 3ae07a8 #218, before the access ladder 0 of 309 bda3329 after #219, before #227 55 of 318 (9 shipped) 09beda9 main, after #227 0 of 319 #219 introduced every `brx` in this tree and #227 removed every one of them, which is the consumer's bisect exactly. #227 reported the opposite -- 51 already present at 3ae07a8, identical counts across its own fix -- from a comparison taken across the warm cache volume #228 later found serving stale builds. Both numbers are superseded. 3ae07a8 has no `AccessWidth` to match on at all, so zero is the only count that tree can produce. Half of #225's "necessary but not sufficient" survives and half does not. No GPU entry point mounts the cache volume (#226), so #227's B200 runs at then-main really were runs of the 55-table tree and those modules really did load. `shared_drain_quad` is the half that goes: it was added on the fix branch, after the fix had put both drains back on a three-case dispatch, so it has never carried a table and it is inside main's 0 of 319. Its doc said it demonstrated a JIT taking four of them; it demonstrated nothing of the kind, and now says so. So the census arms on the condition it set for itself. A kernel in the shipped set -- `examples/` plus `GATED_KERNELS` -- carrying a `brx` fails the run; probes are printed and do not, the way the local-memory depot's are. The table stays as the diagnostic. Watched in both directions: green at this branch (0 of 319) and red at bda3329's sources under the same armed `modal_app.py`, naming the nine shipped kernels. * The access ladder's note carries the in-tree numbers, not only the consumer's
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.
target/moves onto a Modal Volume (ferro-kittens-cargo), mounted by the two tier-2 entry points and deliberately not by the GPU ones._cached_targetderives the per-crate directory from the working directory_runwas given, and mounting the volume is the only switch there is — an entry point that mounts it builds onto it, one that does not builds where it always did.CI.md's "Known inefficiency: … A Modal Volume mounted at the project's target directory would cut most of that. Not done here" is what this closes.
What it bought — tier 2
build, at 41f9e57clippy×4176 s of step time per run, 38%. Cold costs nothing over the baseline. The saving lands exactly where the theory says: the four
clippysteps collapse, the fivecargo oxide buildsteps barely move — they are codegen, and codegen is redone every time. Tier 2 runs two such jobs per push, so ≈350 CPU-seconds a push.Semantics are unchanged, and
regcountis the proofRun against 41f9e57 and against this tree,
regcount's output is identical over all 1650 lines — every register count, the shape ladder, #63's timed twins, #95's occupancy-step gate, the opcode census and the local-memory depot census. cargo-oxide writes the emitted PTX to the working directory rather than undertarget/, so nothing this file reads moved. Same commands, same pass/fail meaning, everywhere.The GPU half of the plan was measured and rejected
The obvious design — fill the cache on CPU, let the B200 skip its compile — does not work here, and the negative result is written into both
modal_app.pyand CI.md so it is not redone. Ondevice_tests, cache warm from a precedingbuild:cargoin the containerThe cache does exactly what it claims and the container still gets slower. The 58 dependencies were never the cost — they compile in parallel on
cpu=8behind the long pole, which is the crate's own device codegen, and cargo-oxide redoes that on every invocation: two consecutiveruns of an unchanged tree both rebuiltdevice-testsin full. So on a GPU function the volume trades work that was already free for artifact I/O over a network filesystem.Note there was no GPU-held build tier to reclaim:
build,regcountandupstream_ptxhave beencpu=8all along, becausecargo oxide buildemits PTX and the driver stub satisfies the link. The rule is now written down rather than merely observed.So the lever is fewer containers:
session --armssessionruns any comma-separated set of named sweeps in one container. The arms are oneARMStable and the individual entry points are now thin wrappers over it, so a session and N separatemodal runs issue byte-identical commands — batching cannot change a number, only how many containers paid for it. It also gives multi-arm claims one device, one driver, one clock and one cuBLASLt, which is the control #98 and #118 keep paying for by hand.Measured on
bench:softmax,bench:layernorm,device-tests:session --arms …97 GPU-seconds, 38%. Saved: the image pull and container start, three times down to one, plus the dependency compile for an arm following one in the same crate (
bench:layernormbuilt in 28.6 s behindbench:softmax's 40.6 s, against 72 s cold). Not saved: the device codegen, per rule 1.bench --case sol-kandprofiledeliberately have no arm — a launch that hangs takes every row after it, which is howsol-kwas found, so an arm that can wedge the container keeps its own process.Also here
## Spending policysection: the three rules above with their measurements, and the measurement ladder — local typecheck first (CUDA_TOOLKIT_PATHat an unpackedcuda_cudartredist reaches all four crates including--features host, typecheck only, not codegen), then tier 2 on CPU, then one container per same-arm A/B, then a batched session for a multi-arm claim.cuda.ymlandgpu.ymlheader comments updated to match.Verification
All green, on this tree:
build(cold and warm),regcount(and diffed against the baseline tree),device_tests57/57 twice,bench --case softmax,bench --case layernorm,session --arms bench:softmax,bench:layernorm,device-tests57/57.scripts/fmt --checkclean.