Repository navigation
gpu: share the serial packing reserve across a part read run - #809
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: The shared packing reserve matches the serial staging lifetime; no must-fix defect was found.
Non-blocking
⚠ Complete the hardware evidence: crates/gpu/src/parts.rs:185. The gate and timing reports omit the tested commit hashes. The timings also lack exact checkpoint paths and benchmark commands with output. Can you attach the measurement record, including both pre-rebase hashes?
Checked
Duplicates: 0 new functions, types or constants; Grep found no second grouping owner. Dryer reported 0 pairs.
Complexity: crapper flagged no changed function.
Silent failure: 0 new default or suppressed-result sites; read errors and arithmetic overflow reach named load refusals.
Tests: static mutation review of a_read_takes_the_parts_that_fit_and_at_least_one: replacing max at crates/model/src/part.rs:184 with addition or the current part's cost fails the existing assertions.
Tests: later_reads_use_their_own_peak_under_a_falling_host_room rejects summing packing peaks: its combined-run assertion fails. Exact-room and one-byte-short checks cover admission and live-room boundaries.
Gates: no pins, tolerances or coverage clauses removed; changed expectations enforce the new accounting.
Adversarial: concurrent reads retain their summed reserve; serial packing and ring-owned copies prevent packing overlap. Empty runs, oversized first parts, falling room and overflow remain guarded.
Performance: load-time planning only; no decode, prefill or kernel path changed.
Escape catalog: no C1–C4 pattern matched.
Notes
Dryer did not scan crates/gpu; the changed GPU code was searched manually.
No Rust or GPU tests were run here; test assertions were checked statically.
Card check: needs-gpu. This pull request changes crates/gpu/src/parts.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. |
병렬로 읽는 part 묶음이 packing 메모리 예약을 한 part 분량만 잡도록 고쳐, 모델 load의 start-to-ready 시간을 줄이는 속도 PR입니다.
What and why
A checkpoint load reads several tensor parts at once. The planner decides how many parts one read may take by adding up each part's host memory cost, and that cost was the part's read bytes plus its packing bytes, summed over the whole read. The reads of one run are alive together, but packing runs one part at a time in plan order, so only one part's packing buffers exist at any moment. Summing the packing bytes overstated the reserve, ended each read early and left more, smaller reads.
This PR charges a run the sum of its read peaks plus the largest single packing peak. Under the same host room the planner now groups more parts per read: FP4-Local plans 50 reads before and 38 after, and NVFP4 plans 39 before and 30 after.
read_aheadincrates/model/src/part.rstakes a(read_peak, packing_peak)pair per part instead of one cost. Its one production caller,LoadPlan::newincrates/gpu/src/parts.rs, supplies the read bytes and the packing bytes (twice the staged bytes, as before).Release notes: Changed: model load groups more tensor parts per read under the same host memory room, which shortens start-to-ready.
Code shape
read_ahead, and the GPU planner calls it.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.cargo clippyonbloomery-modelran clean.bloomery-gpuneeds CUDA and was not linted here, and I did not record a separatecargo fmtresult.Duplication found or removed (
path:line), or "none": none.What I ran
The metric is start-to-ready: seconds from process start to the first healthy
/healthresponse, with--parallel 4 --ctx-size 16896,BLOOMERY_HOST_ROOM=96Gand the MTP draft off. The checkpoints are the FP4-Local and NVFP4 builds of Qwen3.8-Flash-Next. Each arm is three starts, main and head alternating on the same DGX Spark in one sitting, after one discarded first start per checkpoint and binary. A cold start first drops the tensor files from the page cache withPOSIX_FADV_DONTNEED. A warm start first reads every file once in order.Start-to-ready median fell by 11.689% and 8.893% for FP4-Local cold and warm, and by 9.765% and 8.300% for NVFP4 cold and warm.
Each figure is the median of the three starts. In every row the three head starts are all faster than the three main starts, so the ranges do not overlap. For both checkpoints the card bytes read back after load have the same SHA-256 on main and head, and a 128-token greedy generation returns the same content and token count. No out-of-memory error or admission refusal appeared in any run. Each read now fills more of the same room, so the largest reserve of a single read is a little higher than before and stays within the room.
GPU Evidence
The card and driver of the DGX Spark that ran the BF16 gate:
The gate printed 309 PASS lines.
On an RTX 5090 machine:
Before the change, the new assertion in the first test fails against the old planner (exit code 101). The all-targets check of the workspace also finishes:
Not run: the full
bloomery-gpulibrary suite and a PTX comparison (no kernel or launch changed).Hardware
Timings and the BF16 gate ran on DGX Spark machines (GB10, driver 595.84, CUDA 13.3 on the gate machine). The two regression tests ran on an RTX 5090 machine.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.