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 - #905
juliankang4 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: I built five failure scenarios against the staged read, the extent merge and the cubin fallback; code in the diff blocks each one.
Non-blocking
⚠ The descriptor-limit test passes when direct reads are unsupported: crates/model-hf/src/part.rs:1203. On a filesystem that refuses O_DIRECT, Wholes::read returns None before it opens a second shard. The inner test only prints, so the planted mutant (every shard held open) stays green. Direction: panic on None in the inner test and skip by name in the outer test when the temp dir cannot do direct reads.
⚠ The ordering test does not check overlap on a one-thread pool: crates/gpu/src/parts.rs:654. read_staged starts pool.threads().clamp(1, run.len()) readers; with one reader the parts arrive in order, so the arrival-order mutant passes. Direction: assert that the pool has at least 2 threads.
⚠ object has a literal version in crates/gpu/Cargo.toml:41, while oxide-artifacts comes from the workspace. gpu-gates reads .oxart through oxide-artifacts with object-read (ptx.rs:148). Question: can exe_ptx read .oxart.ptx through that feature without a new direct dependency?
Also 1 minor: the new run branch in oxart_jit.rs could be a write_cubins function.
Checked
- Duplicates: 11 new items checked, none duplicated; dryer found 0 pairs. The two
FIRST_STARTstrings were already a pair and both are updated. - Complexity:
Wholes::read19 is a new function and fits R12.oxart_jit::run12 → 19 is a branch added to an existing function (minor item above). - Silent failure: 9 sites followed; each ends in a named refusal or the original error;
Nonefrom a refused shard falls back to the mapping. - Scenarios blocked: stage error while readers run, touching or duplicate names in one extent, short read at end of file, no PTX section on x86, empty run.
- Tests: the mutants in the PR body map to assertions; two weak spots are the ⚠ items.
- Gates: unsafe ratchet 109 → 114 with a dated PIN; the five new
unsafeblocks carry// SAFETY:. No band, tolerance or lint moved. - Performance: load path only.
- Escape catalog: C1 to C4 do not match in
build.sh.
Notes
just gate-gpu-libandcargo clippy -p bloomery-gpuwere not run, as the PR body says. A maintainer must run the gate before merge.- The body has no head hash and the tests ran with
cargo test, notjust gate-*: the GPU evidence is incomplete.
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)
…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.
dfaeb52 to
c58a5aa
Compare
There was a problem hiding this comment.
Verdict: CLEAN: carried from dfaeb525, not re-reviewed.
The approval of dfaeb525 stands for c58a5aa2. This pull request's 3 commits are the same patches in the same order: git patch-id --verbatim (the changed lines, the lines around them and whitespace) and the subject are equal for every commit. That review ran under the reviewer instructions, tools and slag ledger that review this head, and it approved.
The base moved, and changed none of the files this pull request changes.
A carry covers each patch's own lines and the lines around them. What the base changed elsewhere is covered by CI on this head and by the landing gates.
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)
|
Superseded by #913. |
DGX Spark(GB10)에서
bloomery-serve -m <폴더>로 FP4-Local 체크포인트를 띄울 때 서버가 시작해서 health가 열리기까지의 시간을 줄이는 PR입니다. release archive가 GPU 코드를 미리 컴파일해 담고, 체크포인트 읽기를 줄입니다.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. 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.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 on the measured head, andcargo clippywas clean forbloomery-gpu-gatesandbloomery-model-hfon an earlier head of this branch.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, and the head is this branch's three commits on that base; they were then rebased onto current main without a conflict, and main changed none of their code files. The model isnvidia/Qwen3.8-Flash-Next-FP4-Localat revisionb9ce18a6887e18c089fdea8509a33e63429a3300, served withbloomery-serve -m <folder>and no other flag.Build both archives, install each with
tools/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 on the same GB10, each with a planted mutant that must fail. The
part::tests ran on an earlier commit of this branch whosepart.rsequals the head's.part::tests, including the folder against GGUF equality tests.a_run_stages_in_order_as_its_reads_arrive.load_or_ptxfailshw_a_refused_cubin_loads_its_ptxwith the driver's 209.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: the full library gate was not run on this head, and a maintainer runs it.Not run: the x86-64 archive install on this head, a start under the oldest supported driver (R580), the tests that need an RTX 5090 machine, and
cargo clippyonbloomery-gpu. A decode A/B was not run because decode and prefill code are untouched. 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 초안 리뷰는 제가 직접 했습니다.