Repository navigation
fast weights: read shards on eight threads, decode CSF scales at upload - #308
Conversation
A FP4-Local checkpoint holds 73,728 CSF streams and 876 native MXFP8 tensors that `materialize` fetched one read at a time after the load, on top of a single shard reader waiting on one read at a time. - `ShardReaders`: eight readers per shard, at most 16 tensors and 1 GiB past the next one ahead of the copier, handed over in tensor order. Dropping it stops and joins them, so an upload that fails mid-shard leaves no reader on a closed descriptor. - `CsfAssembler`: the fast loader no longer defers CSF streams. It gathers each pair, in either order and across shards, and uploads only the decoded `weight_scale` through the existing codec. A stream without its partner, or a scale both plain and compressed, fails the load. - `deferred_modules`: native MXFP8 modules load through the shard path. `materialize` checks them where they sit instead of reading them back. Only what it expands stays deferred. `pack_slab` keeps working and reserves nothing for streams. `materialize` still decodes streams another loader left resident. The readers port Enntity/atlas f4d95a1 (AGPL-3.0-only). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
I pre-gated this exact head (
Main has moved since (#303, #159, #306, #307). My sentinel runs found KL 0 between each of those main heads, and none of them touch the weight-load path. I'll merge once CI is green. |
The tree keeps its CSF assembler, which handles both encodings and checks each scale against its weight, and takes Atlas-Inf#308's shard readers. Its tests get a weight for every scale and an exception that decodes positive. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@data-angel This PR has a small decode slowdown on Qwen3.8-Flash-Next. Logits are unchanged. A/B on reiner + spark2: main before (
Three independent runs agree on direction:
KL is exactly 0 throughout, so the numerics are identical. That points at where the weights or scales land in memory rather than at the math. The two suspects are native MXFP8 modules now loading through the shard path, and CSF scales decoded at upload. I'm bisecting the two halves on the pair next. If you already know which of the three parts changes placement for decode-path tensors, say so and I'll test that first. |
|
Bisect result: it's the native MXFP8 modules going through the shard slab. Main
KL is 0 for U and for D against M. D recovers most of the -1.1 to -1.35% and keeps nearly all of the boot win. U is within noise on decode, though C2 and C4 move by about 1%. My reading is that the native MXFP8 modules (qwen4_exp's shared experts and MXFP8 projections) decode slower from their place inside the shard slab than from Two possible fixes:
I'll open a small PR doing (1) and gate it, unless you'd rather do (2). |
…lab (#308 decode regression) Pair A/B vs main (3 boots/arm): decode +0.7..1.1%, C1/C2/C4 +0.5..0.8%, KL 0, boot neutral. CI green except the PR benchmark gate.
|
Hardware check of this PR's loader (and #314's decode-regression fix) on main Arms (interleaved same-day, one arm each): this PR's stack at main
* the C8 cell on the pre-#308 arm hit what looks like a scheduling stall (25 s wall); treat it as suspect. Read: at this tip the loader work is a large win on this profile — boot 24 s vs 69 s, and decode/TTFT/warm numbers all ahead. That's more boot gain than the PR's own 30.0 s vs 54.3 s, likely because the 8x262k profile builds a much bigger KV pool than the 8x32k Strict arm in the test plan, so the shard-read time saved is larger here. The decode numbers are in line with #314 having recovered the slab-offset regression (we did not observe the −1% decode the raw #308 tip had, though this is a different profile and single-arm). Caveats: one arm each, not the PR's 3-boot interleaved A/B; the base here is the live deploy image (main |
Atlas-Inf#308 let the fast loader upload native MXFP8 modules through the shard path, so they sat at interior offsets of a shard slab. On Qwen3.8-Flash-Next (qwen4_exp, two DGX Sparks) that cost about 1% of decode. Bisected on the pair, 3 fresh boots per arm, n=9: deferring the natives to `materialize` again (its own allocation per module) recovered decode +0.5..1.0% and C1/C2/C4 +0.9..1.5%, with identical logits (KL 0) and nearly all of the boot win kept. Deferring the CSF streams again recovered nothing. `deferred_modules` is `host_decode_modules` again; `materialize`'s native-upload path is unchanged. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
On main, an FP4-Local checkpoint takes about twice as long to boot as SparkQwen 0.4.0. In Strict mode on two DGX Sparks, the server was live 54.3 s after start, against 26.8 s for 0.4.0. Most of that gap is one shard reader waiting on one read at a time, plus
materializefetching 73,728 CSF streams and 876 native MXFP8 tensors after the load. This PR gets the same boot to 30.0 s.ShardReaders: eight readers per shard, holding at most 16 tensors and 1 GiB ahead of the copier, handed over in tensor order. Dropping it stops and joins them, so an upload that fails mid-shard leaves no reader on a closed descriptor.CsfAssembler: the fast loader no longer defers CSF streams. It gathers each pair, in either order and across shards, and uploads only the decodedweight_scale, through the existingmodelopt_codec. A stream without its partner, or a scale both plain and compressed, fails the load.deferred_modules: native MXFP8 modules load through the shard path, andmaterializechecks them where they sit. Only what it expands stays deferred.pack_slabkeeps working and reserves nothing for streams.materializestill decodes streams another loader left resident. The readers port Enntity/atlas f4d95a1.Part of #220.
Test plan
cargo fmt --all -- --checkATLAS_SKIP_BUILD=1 cargo clippy --locked --workspace --tests -- -Dwarnings, CI's env. Not--all-features, which stops onobjc2on Linux.python3 scripts/check_spdx.py, which is what CI runs.scripts/check-license-headers.shneeds Docker and did not run in my container. All new files carry the header.typos: not run, not installed here.spark-runtime --lib fast_weights: 21 passed.spark-model --lib modelopt_local: 11 passed. The workspace suite was not run.The gates above ran on this commit merged into main
575db42e1. The hardware results did not: they ran onb8a330647, which is this commit and #303 on8c2b67218. Main has since taken #159, #306 and #307, which are not in any number below.Fingerprint. Qwen3.8-Flash-Next-FP4-Local,
8x32kprofile, Strict mode unless noted, one boot per arm. 0.4.0 is9b25f57596d1; "no loader" iscecf6539e(8c2b67218with #303). Arms were interleaved in an order that balances drift.sq_benchcells, temperature 0, 256 tokens per stream at C4 and C8. Each value is the mean of per-boot means. P values are two-sided exact permutation tests over boots. Run tagsr5-*andr6-*on our box.Server live, sBoot is about 3 s slower than 0.4.0 here. I have not split that gap in Strict.
p = 0.03 is the lowest 4 against 4 can reach.
p = 0.10 is the lowest 3 against 3 can reach.
Output against 0.4.0, on the same
b8a330647engine, in earlier arms on the same day: greedy 8/8, prompt logprobs zero delta, tools 7/7, agentic 20/20, vision 14/14, in Spark and Strict. On4x1m, greedy and logprobs match earlier runs and tools pass.8x262kbooted and passed pre-flight.Notes for reviewers
9b25f57596d1also uploads each decoded scale on its own allocation. Treat it as observed, not established. If your bench shows it, I want to know.8c2b67218.rank0.log. My earlier 10 s health poll rounded these to 32 s, 32 s and 63 s and hid the 3 s gap, so use the figures above.host_decode_moduleskeeps its meaning.ffn.rsuses it as the FP4-Local test.deferred_modulesis the new, narrower set thatserve_phases/weights.rshands the loader.CsfAssemblerkeeps the call shapes of the assembler in the SparkQwen stack, so a later merge with the GLM stack stays small. I have not merged glm: native prefill and FP4-Local for dual DGX Spark (#199 by @Mango-kid, rebased onto main + #198) #242's head against this.Authorship
AI-authored (Claude Code). No human-written code.
🤖 Generated with Claude Code