Repository navigation
q27: faster cold start: parallel module load, pinned weight upload, tokenizer under the weight read - #34
Merged
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]>
This was referenced Nov 19, 2026
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.
Summary
Cuts cold engine start for Qwen3.8-27B on one DGX Spark (SparkQwen 0.7.0 profile, release image with this binary overlaid) from 9.1–11.1 s to 7.3–8.1 s to ready, with no change to outputs. Three commits:
pread16 MiB pieces into their own page-locked buffers and copy them on their own streams. The 18.8 GB load goes from 3.05 s to 2.5–2.7 s. CSF parts, F16 converts and failed allocations keep the old copier path and its managed-memory fallback. Linux only.tokenizer.jsonvocab parse (~0.3 s) on threads during the weight read. The early result is used only if every input it read still equals the serial path's inputs; otherwise the phase runs in place as before.Test plan
rustfmt --checkon every touched file.cargo fmt --all -- --checkstill fails on DSpine-era example files already onq27/conc; none of them are touched here.ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy -p atlas-core -p spark-runtime -p spark-server --tests: clean.spark-runtime fast_weights: 30 pass, including newpinned_uploadtests and an allocation-failure fallback test.spark-server tokenizer_prep: 5 pass.fast_load_benchonnvidia/Qwen3.8-27B-NVFP4+ tandem: the digest of every resident tensor's bytes,b4b9ae18a3bd270d, matches the old loader.0.7.0-27bimage with the binary overlaid: ready 7.3–8.1 s vs 9.1–11.1 s for the same commit without these changes.Notes for reviewers
cuMemAllocon GB10 runs at ~25 GB/s however many threads call it. This profile allocates ~94 GB at startup (weights, the 14 GB layer build, ~62 GB of KV, SSM pools and drafter context), so allocation, not the ~1.8 s disk read, is now the floor. Going further means allocating pools during the disk-bound weight read, which needs KV sizing moved earlier. Not attempted here.nvidia_fsmodule).AtlasRegistry::init, used by every CUDA model, and the fast loader, used by every safetensors load.🤖 Generated with Claude Code