Repository navigation
gpu: a parts load stages each part as it and the parts before it are read, so a run's staging overlaps its reads - #913
Conversation
…river's cubins, so a first start compiles nothing oxart_jit --cubin links each .oxart bundle's PTX through the driver on the building GB10 and writes a section of the same bundles with the cubin as their payload; the release build makes it the binary's .oxart and keeps the PTX as .oxart.ptx. cuda-core's loader takes a bundle's cubin before its PTX; when the driver refuses that cubin as an image it cannot run, bloomery-gpu's bundle loader loads the same bundle's PTX from .oxart.ptx instead and says so on one line.
…into one buffer, one open a shard A routed expert stack of Qwen3.8's FP4 folder is about 4,000 stored tensors. Each was read alone: an O_DIRECT open, a probe read, a buffer of its own and one small read, so seven parallel part reads took the drive at under 2 GB/s of its 5. The part now opens each shard once and reads tensors whose aligned spans touch as one extent.
…read, so a run's staging overlaps its reads A run of a folder load read every part, then staged them one by one while the drive sat idle; on Qwen3.8's FP4 folder the drive alternated between 3.3 GB/s and nothing each second. Readers now hand each part to the staging thread as they finish, and the parts still stage in plan order.
…box.sh's release/build.sh test is no run
…uses an answer The test held the same card tensors in both plans, so a key without the card's tensors still passed. A plan whose card tensor has other bytes is now planned again.
There was a problem hiding this comment.
Verdict: CLEAN: I built failure paths for the reader threads, the extent merge, the cubin fallback and the release step, and the code blocks each one.
Non-blocking
⚠ The refusal set is checked on one driver only: crates/gpu/src/lib.rs:2585. refuses_image accepts three codes. The cubins are linked by driver 595 and docs/serving.md supports R580+. The PR body says the R580 start was not run and the refusal was made by editing the SM byte. If R580 returns another code for a cubin it cannot load (for example CUDA_ERROR_INVALID_SOURCE), the server fails at start with the driver's error, with no PTX fallback. Please run one start on the oldest driver you can reach, or say in the PR which codes it returned.
⚠ The open-file-limit test can pass without checking anything: crates/model-hf/src/part.rs:1203. When Wholes::read returns None (a temp dir whose filesystem refuses direct reads), the test prints a line and passes. The mutant "hold every visited shard open" then stays green. Direction: create the shards where direct reads work, or fail the test on None and let the machine without direct reads skip it by name.
⚠ Wholes::read is new and complex on its own (crapper 19): crates/model-hf/src/part.rs:413. It builds extents, sizes the buffer, opens shards and fills slots. The extent build (first loop) is the part that could stand alone. Not needed now.
Checked
- Duplicates: 9 new items checked (
load_or_ptx,refuses_image,file_ptx,read_staged,Extent,Wholes,cubin,cubin_bundle,GLOB_QUOTE), none duplicated; no othercuLink*call or.oxart.ptxreader exists. dryer: 0 pairs. - Complexity:
Wholes::readis a new complex function (⚠ above).oxart_jit::run12 to 19 is one added branch that delegates tocubin_bundle; harmless.bloomery_serve::drive::run36 to 44: the diff changes only a string constant and a doc there, so the rise is not from this change. - Silent failure: 7 sites followed (reader mask, read, stage, no-PTX refusal, non-refusal driver error, short direct read, empty link image). Each ends in a named error. Reader hang paths (a failing mask, a panicking reader, a stage failure) all end the
recvloop or drop the receiver. - Extent merge: sorted by (path, start);
start <= e.end()merges touching spans only; slots stayDIRECT_ALIGNmultiples; the EOF check is per tensor. - Tests: mutants named in the PR body match production lines. The stage-order test fails on arrival-order staging. The open-file test fails on held shards where direct reads work (⚠ above).
- Gates: no band or tolerance moved. The unsafe ratchet PIN is dated, and its 5 blocks match the 5
unsafeblocks incubin. - Escape catalog: C1 to C4 checked on
build.shandgate-batch.sh. No match (set -euo pipefailinbuild.sh; no pipe swallowsgpu-gate.sh's exit code). - Performance: load path only; no decode or prefill code changed.
Notes
- The PR body measures an "earlier revision" of the head and names no head commit hash, and its base
625bf506c2f6is not this PR's base. TheCONTRIBUTING.mdevidence list asks for both hashes, sogpu.jsonsays no evidence.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/bloomery_serve.rs, crates/gpu-gates/src/bin/gate_clef_serve.rs, crates/gpu-gates/src/bin/oxart_jit.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
DGX Spark(GB10)에서
bloomery-serve -m <폴더>로 FP4-Local 체크포인트를 띄울 때 서버가 시작해서 health가 열리기까지의 시간을 줄이는 PR입니다. release archive가 GPU 코드를 미리 컴파일해 담고, 체크포인트 읽기를 줄입니다.Supersedes #905.
Part of #565.
What and why
bloomery-serve -m <folder>on a DGX Spark spends its start in two places: the driver compiling the GPU code on the first start, and reading the checkpoint from disk. This PR shortens both for an FP4-Local folder.tools/release/build.sh: the GB10 archive carries its kernels compiled.oxart_jit --cubinlinks each bundle's PTX with the driver on the GB10 that builds the archive. The binary's.oxartsection then holds those cubins and the PTX stays beside it as.oxart.ptx;--checkrequires both sections. A first start from the archive compiles nothing. If the driver refuses a bundle's cubin (the invalid-image, no-binary-for-GPU or unsupported-PTX-version errors),load_or_ptxincrates/gpu/src/lib.rsloads that bundle's PTX from.oxart.ptxand the server prints one line saying so. Any other failure, and a refusal with no PTX to fall back on, keeps its original error. The x86-64 archive and a source build are unchanged.crates/model-hf/src/part.rs: a folder part reads the stored tensors that touch as one extent into one buffer, with one open per shard. Before, each tensor was opened, probed with a 4 KiB read and read again in a small request.Wholes::readreplacesread_whole. The extents run shard by shard, so a part holds one shard open at a time however many shards it spans. A shard on a filesystem without direct reads now sends the whole part through the mapping, where it used to send only that one tensor.crates/gpu/src/parts.rs:read_stagedruns a load's readers on scoped threads, each set to the pool's CPUs first, while the main thread stages parts in plan order as they arrive. Staging overlaps the reads. The host peak is unchanged, because a run's parts coexist until release as before. A read, mask or stage failure ends the load with a named refusal.tools/spawn-allow.txthas one row for these readers.crates/gpu/src/parts.rstest:a_placed_source_plans_a_cards_parts_once_a_roomalso asks for a plan whoseoutput.weighthas other card bytes at the same room and expects a fresh plan, so a memo key that ignored the card's tensors would fail it.tools/gate-batch.sh:script_refsskips a quoted string touched by a glob star, so thecasepattern*"release/build.sh"*intools/box.shis no longer taken for a script the file runs. Without it the fixture--classeswalk fails oncetools/release/build.shchanges. New self-test casesr-pat.gpu-gatesfrom 109 to 114 blocks with a dated PIN, for the five driver callsoxart_jit --cubinmakes to link a bundle, each with a SAFETY line.README.md,docs/performance.md,docs/evaluating.md,docs/serving.md,docs/contrib/dgx-spark.md,tools/release/README.release.md, and the first-start line inbloomery_serve.rsandgate_clef_serve.rs.The cost is a larger archive binary and a longer release build, both listed under What I ran. Decode and prefill code are not touched.
Release notes: Changed: the GB10 release archive carries its GPU code compiled, and an FP4-Local folder loads with fewer reads, so a DGX Spark server starts sooner.
Code shape
DirectFileandaligned_span, masks reuseset_maskand the pool's topology, and the bundle rebuild reusesoxide_artifacts::ArtifactBundleSpec. The per-tensorWholeandread_wholeare removed.read_wholeand the per-tensorWholeare deleted, andExtent::endhas two callers.cargo fmtandcargo clippyare clean on what I touched:cargo fmt --checkpassed on the three changed crates, andcargo clippywas clean forbloomery-gpu-gatesandbloomery-model-hf.bloomery-gpuneeds CUDA to lint and was not linted here.Duplication found or removed (
path:line), or "none": none. The duplicate scan reported no candidates.What I ran
All timed runs are on one DGX Spark with an installed archive, built and installed with the release scripts for each side. The base is main at
625bf506c2f6. The model isnvidia/Qwen3.8-Flash-Next-FP4-Localat revisionb9ce18a6887e18c089fdea8509a33e63429a3300, served withbloomery-serve -m <folder>and no other flag.Build both archives with
just release-build 0.3.10in a clean checkout of each side, install each withtools/release/install.sh --version v0.3.10 --prefix <dir>, then start each binary three rounds, base cold, head cold, base warm, head warm. A cold start uses an empty driver JIT cache and a dropped page cache for the checkpoint, and a warm start keeps both. The metric is the time from spawn to a 200 from/health.Each cell is the median of three starts with its range in parentheses.
Cold start to health is 26.96 s shorter (76.34 s to 49.38 s); warm start is 11.99 s shorter (61.18 s to 49.19 s); the ranges do not overlap. The driver JIT cache after a cold start is 34,811,323 B on the base and 0 B on the head, which compiled nothing. The 26 greedy replies of the head's starts are identical to the base's. The installed
bloomery-servegrows from 62,722,432 B to 75,092,768 B, the archive from 17,574,765 B to 20,294,039 B, and the release build from 509 s to 527 s.Refused cubin: on the same card I changed the SM byte in each of the head's five
.oxartcubins to another card's, so the driver returns its no-binary-for-GPU error. The base's loader fails at once on that image. The head loads the PTX and serves.Tests, and the mutant each test must catch. The
parts::gate ran on a GB10. Thepart::tests ran on another Linux machine, on an ext4 drive that takes direct reads. The third call ran on a GB10.part::tests, including the folder against GGUF equality tests.a_whole_stack_over_more_shards_than_open_files_readsunder a soft limit of 32 open files with "Too many open files".a_run_stages_in_order_as_its_reads_arrive.a_placed_source_plans_a_cards_parts_once_a_room(left: 2,right: 3).load_or_ptxfailshw_a_refused_cubin_loads_its_ptxwith the driver's 209 (this mutant ran on the measured revision).file_ptxfrom a copy of the test binary whose.oxartis renamed to.oxart.ptxwithobjcopy, as the release build does. PointingPTX_SECTIONat another section name fails it, because the copy then yields no PTX.cargo fmt --checkonbloomery-gpu,bloomery-model-hfandbloomery-gpu-gatesended with exit 0 on another Linux machine.The checkpoint upload is still the largest part of a head start, 34.84 s of 49.38 s cold.
just gate-gpu-libnot run: a maintainer runs the full library gate.Not run: the x86-64 archive install, a start under the oldest supported driver (R580), the tests that need an RTX 5090 machine, and
cargo clippyonbloomery-gpu. The refusal was made on driver 595.84 by changing a real cubin, so the code a different driver returns for an unusable cubin may differ from the three the fallback accepts.Hardware
One DGX Spark, Linux aarch64.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.