Repository navigation
Faster cold start: parallel kernel module load, pinned weight upload, tokenizer under the weight read (Qwen3.8-27B 9.1–11.1 s → 7.3–8.1 s on one DGX Spark) - #398
Conversation
Each of a target's PTX blobs is loaded twice (cudarc and raw driver), and each load is a JIT or a JIT-cache lookup. Serially, Qwen3.8-27B's 220 blobs took ~1 s of every engine start on GB10; on eight threads the backend is up ~0.3 s sooner. The calling thread still gets the context bound (AtlasCudaBackend::new reads it back), the maps are built in blob order, and the first failing blob stops the other loaders. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fast loader handed every tensor to one copier thread that copied it from pageable memory and drained the stream before the next. On GB10 that loaded Qwen3.8-27B's 18.8 GB in 3.05 s (6.2 GB/s) against ~10.5 GB/s of O_DIRECT reads from the same files. Plain tensors are now allocated in tensor order on the calling thread while 16 workers pread 16 MiB pieces into their own page-locked buffers and copy them on their own streams: 2.5-2.7 s, with a digest of every resident tensor's bytes identical to the old loader. CSF scale parts, F16 converts and tensors whose allocation fails keep the copier path and its managed-memory fallback. Linux only. Swept 4-32 workers and 8-64 MiB pieces; two buffers per worker measured slower (2.7-2.9 s). direct_io's pread loop is factored into aligned_window + pread_window so both paths share it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The tokenizer phase (chat tokenizer, four whole-vocabulary decode passes, tool markers, XGrammar engine: ~1.2 s on Qwen3.8's 248K vocabulary) ran after the model was built, and the vocab cap parsed tokenizer.json again (~0.3 s) between the weights and the KV config. Both are CPU work that read none of the GPU phases. Rank 0 now starts the tokenizer phase on a thread before the weight load and uses its result at phase 8 only if every input it read (EOS list, vocab size after the tokenizer cap, model type, thinking support, template fields, ServeArgs) still equals the serial path's; otherwise it resolves in place as before. The vocab-size parse runs on a thread too. Qwen3.8-27B on one Spark with this and the two loader changes: ready in 7.3-8.1 s from a cold page cache against 9.1-11.1 s, with greedy outputs and logprobs identical to the old binary. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@data-angel I verified #398 on Atlas-Inf GB10 (sparky, native
Linux HIP (framework, gfx1151,
From my side this is ready. I'm carrying it in sparky nightq jobs 150b/151b · framework qctl 466-f344-hip-398 · 2026-11-21 |
Linux HIP builds take the pinned path as well (cfg!(target_os = "linux")), and serve identically there; the comment said CUDA only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@AzeezIsh thanks for checking it on
🤖 Generated with Claude Code |
|
Queued in train #422 ( 🤖 Generated with Claude Code |
|
GB10 gate of train #422 is green; results are on #422 (closure_attestation passes on one-model builds; 0 test failures; cold start −1.54 s; outputs identical). Merge follows #421. 🤖 Generated with Claude Code |
…t cold start (#398) GB10 (sparky 189): closure_attestation passes on one-model inkling-2-mini and qwen3.8-27b builds; full suite 6,829/0; Qwen3.8-27B lp_dump max|d| 0 and greedy C1/C8 8/8 vs #421; Inkling greedy 8/8; cold start 13.79 -> 12.25 s (-1.54 s). AMD (DevLab 45651124584): strix-hip builds with #420's build.rs, Strict/Spark --check, Spark C1 42.7 / C8 84.1. Follow-ups: c4108fd (rustdoc private link), c73fa30 (fast_weights_parity temp-dir race).
Summary
Engine cold start for Qwen3.8-27B on one DGX Spark falls from 9.1–11.1 s to 7.3–8.1 s to ready, with no output change. Three independent commits:
AtlasCudaBackend::newreads it back), maps are built in blob order, and the first failing blob stops the other loaders.pread16 MiB pieces into their own page-locked buffers and copy them on their own streams: 2.5–2.7 s.direct_io's pread loop is factored intoaligned_window+pread_windowso both paths share it.tokenizer.jsonagain (~0.3 s) between the weights and the KV config.ServeArgs) still equals what the serial path sees at phase 8. Otherwise the phase runs in place, exactly as before.Measured (one DGX Spark, Qwen3.8-27B NVFP4, DFlash2)
Measured on Enntity's
q27/concbranch (this series as Enntity#34), not on this branch. Setup: SparkQwen 0.7.0 27B image with the binary swapped, checkpoint evicted from the page cache before each start.fast_load_bench: identical old vs new (b4b9ae18a3bd270d).Tests
On this branch (main
269b533bcplus the three commits), in a Rust 1.93.1 container on GB10:cargo fmt --all -- --check,ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --testsandscripts/check-license-headers.sh: clean.cargo test -p spark-runtime --lib fast_weights: 30 passed.pinned_upload_tests.rs(pieces cover each tensor once; every tensor lands byte for byte with and without aligned windows, including one larger than a piece and one ending at EOF; a read past EOF fails; nothing to upload is a no-op; an unallocated tensor is left to the caller).csf_load_testscase where one allocation fails and the tensor still lands.cargo test -p spark-server --bin spark tokenizer_prep: 5 passed (the early phase equals the in-place phase; a vocab capped in between still agrees; changed inputs and a failed phase resolve in place; the early vocab cap equals the phase's).cargo build --release -p spark-serverforqwen3.8-27b.Notes for reviewers
AtlasRegistry::initruns for every CUDA model, and the fast loader for every safetensors load.cuMemAllocon GB10 runs at ~25 GB/s however many threads call it. A 27B serve allocates ~94 GB at startup (weights, layer build, KV, SSM pools, drafter context), so allocation, not the ~1.8 s disk read, is now the floor. Overlapping pool allocation with the weight read would need KV sizing moved earlier; not attempted here.🤖 Generated with Claude Code