Repository navigation
gpu: a split pick is a function of the prompt: the expert stream prices its lane by where the probe's experts sit (lane_rate), its probe's timing printed beside it, and an admit's return by the walk's last card layer alone; gate_nvtier's sittings clause loads the paged plan twice, once beside a host copy load - #647
Conversation
…es its lane by where the probe's experts sit (lane_rate), its probe's timing printed beside it, and an admit's return by the walk's last card layer alone; gate_nvtier's sittings clause loads the paged plan twice, once beside a host copy load
There was a problem hiding this comment.
Verdict: CLEAN: Split pricing uses fixed source rates, and return pricing uses walk position.
Non-blocking
⚠ Provide a timed prefill A/B: crates/gpu/src/host/prompt_stream.rs:418 removes the backlog-dependent return charge from earlier card layers in a returning call's final walk. An admit that adds a restore contributes 2 × expert_b lane bytes [derived: admission plus restore]. Fixed lane pricing also changes the selected sets. Attach a same-lease base/head prefill comparison on the contributor's card, as required for dispatch changes; token equality does not establish unchanged throughput.
Checked
Return pricing: traced the prefill caller through PromptStream::pick, admit_walk, and queued restore copies.
Lane pricing: source classification selects fixed rates; the measured probe remains separate. An empty or zero-byte probe is rejected before lane pricing.
Tests: lane assertions reject source-rate and count-weighting mutants; the sitting-record test rejects missing fields. The PR body reports FAIL-first for restored probe pricing. These were checked by inspection, not Rust execution.
Gates: no existing threshold, tolerance or case relaxed.
Escape catalog: C1–C4 do not match the changes.
Notes
The attached RTX 5090 gate run identifies c69d73f94; the reviewed head is 186be362c. Current-head hardware evidence is absent. No builds or hardware gates ran during this review.
Card check: gpu-evidence. This pull request changes crates/gpu-gates/src/bin/gate_nvtier.rs, crates/gpu-gates/src/bin/gate_xstream.rs, crates/gpu-gates/src/record.rs … and carries a gate run on the author's card, which counts as verified.
🔨 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. |
기본 설정에서 같은 prompt의 greedy 출력이 load마다 달라지던 결함을 고칩니다. 분할 expert stream이 load 때 잰 copy 속도 대신, expert의 바이트가 놓인 곳(host 메모리 또는 NVMe tier)으로 정한 속도로 값을 매기게 합니다.
Fixes the token item in #637.
What and why
With
BLOOMERY_RESIDENCYandBLOOMERY_XSTREAMunset (residencymid-p0-s1, streamsplitunder--place a), the same build and the same greedy command give different tokens on different loads of Qwen3.8 UD-Q4_K_XL. Tokens are equal within one load. After this change the split pick depends only on the prompt and the plan, and every load gives the same tokens.Cause:
XStream::newtimes a probe copy at load and keeps its rate as the lane rate (x.lane_b_per_us = x.probe()?incrates/gpu/src/host/xstream.rs).admit_walkincrates/runtime/src/xsplit.rsprices every admit at that rate. The probe rate moves with the page cache and other memory traffic, so the floor per layer, the set of admitted experts and the set summed on the card change from load to load. A second read of the same kind sits inreturn_cost(crates/gpu/src/host/prompt_stream.rs): it prices an admit's return as exposed when the copy lane still owes returns, and that depends on how far the lane has got. I never saw it change output in my runs, but it reads the same kind of state, so it goes out with the first.Introduced by:
5012cc05bbe746f0b8abc7d43d05eddb81275b77(2026-10-08,xsplit::admit_walk). The timed rate itself came earlier with156125b22(2026-10-07). There it priced only units at leastm_minwide, and narrower units admitted from the fixedSTREAM_FLOOR.5012cc05bpriced every split pick at a probed layer throughadmit_walk, so prompts of any width read the timing. Thereturn_costread came withffa9f9203(2026-10-09).What changed:
crates/gpu/src/host/xstream.rs:lane_rateprices each probed expert's bytes at a fixed rate for where they sit,LANE_HELD_B_PER_US(20,410 B/µs) for host memory andLANE_PAGED_B_PER_US(3,600 B/µs) for the NVMe tier. It is a function of the plan only. The timed probe stays asprobed_b_per_us, printed beside the priced rate: the load line keepsxstream_lane_gbs=as the measured value and gainsxstream_priced_gbs=.crates/gpu/src/host/swap.rs,crates/gpu/src/host/swap_source.rs:SwapSource::pagedsays whether the NVMe tier serves an id.FileSwapanswers it with the existingtier_serving.crates/gpu/src/host/prompt_stream.rs:return_costmarks a return as exposed only at the last card layer of the call's last walk.HostTier::call_returns_owed, which had no other caller, is gone.crates/gpu-gates/src/bin/gate_nvtier.rs: a newsittingsclause loads the paged plan twice in child processes, the second beside four threads copying 256 MiB. It compares the stream mode, the priced rate, every pick (unit, layer, admitted set, floor, counts), 106 greedy tokens and 106 logits rows bit for bit. The probe value is printed and not judged. The load part ofarmmoved intoopen_arm, whicharmand the children share.xsplit.rs,body38.rs,wide38.rs,registry.rs(theBLOOMERY_XSTREAMrow),gate_xstream.rsand thejustfiledescription ofgate-gpu-nvtier.The two rates are fixed numbers.
LANE_PAGED_B_PER_USis the quiet probe value of the paged Qwen3.8 plan on an RTX 5090, so a quiet load on main and on this head give the same tokens. On a machine whose real lane differs from these numbers, picks may fit the copies less well. I did not round the probe into bands, because loads on either side of a band edge would still split.Release notes: Fixed: under the default expert stream, the same prompt no longer gives different greedy tokens on different loads, because the stream prices its lane by where the experts sit and not by a timed probe.
Code shape
tier_servingfor the paged test,shared/xstream_rule.rsfor the unset stream rule,spawn_helperfor the copy threads and oneopen_armfor the load.HostTier::call_returns_owedhad one caller and is removed.SwapMachine::returns_owedstays becausegate_swapreads it, and only its doc changed.check-commentspassed in the contribution check below.cargo fmtis clean on this tree.cargo clippywas not run on this head, so the lint count is unchecked.Duplication found or removed (
path:line):crates/gpu-gates/src/bin/gate_nvtier.rs:1793resemblescrates/gpu-gates/src/bin/gate_clef_serve.rs:567andcrates/gpu-gates/src/bin/gate_glm5next_serve.rs:622. It is this gate's owngrant_fieldreader, renamed for a second clause. Each gate is its own crate root with no shared owner for it.crates/gpu-gates/src/bin/gate_nvtier.rs:1984resemblescrates/gpu-gates/src/bin/shared/q38_history.rs:47. The child keeps one digest per logits row, asarmin this gate does.q38_history::stepstores whole rows, and including that module would pull its unused verify and window helpers into this gate.What I ran
The PR head is
c69d73f949e91ebf6483967abe6accc51b76bb1d, one commit on upstream mainbe69eb0ce882dcddd318adb8ab7082c79e39afd1. Everything below ran on this head, except the main and older-commit rows, which ran on the commits they name.Unit tests:
The first line is
cargo oxide test --arch sm_86 -- -p bloomery-gpu --release --lib -- xstream prompt_stream swap. The second iscargo test -p bloomery-runtime --release --lib -- xsplit. The first added test,the_lane_prices_each_copy_at_its_sources_rate, fails when a paged expert is priced at the held rate.Reproduction, on an RTX 5090 machine with the Qwen3.8 UD-Q4_K_XL GGUF on local NVMe, run the same way on main and on this head:
BLOOMERY_RESIDENCYandBLOOMERY_XSTREAMare unset. The md5 is the first 12 hex digits ofgrep -a '^tokens ' <log> | md5sum. A warm load runs with the model in the page cache. "Page cache dropped" runs after the model files were evicted withPOSIX_FADV_DONTNEED. "Beside a copy load" runs with a four thread memory copy loop on the host. The probe column is the printed timing of the lane probe.58356c00358356c00358356c00358356c003c69d73f94c69d73f94c69d73f94c69d73f94On main the tokens first differ from the first load at index 102 for the second load and for the dropped page cache, and at index 85 beside the copy load, counting from 0. On the head, all four loads give the same tokens and the same picks, whatever the probe reads. The head's first load gives the same tokens as main's first load.
Two other settings give the same tokens on main and on the head. With
BLOOMERY_XSTREAM=admitno probe is read, and withBLOOMERY_HOST_ROOM=100Gthe plan has no NVMe tier:58356c003BLOOMERY_XSTREAM=admitc69d73f94BLOOMERY_XSTREAM=admit58356c003BLOOMERY_HOST_ROOM=100G, first load58356c003BLOOMERY_HOST_ROOM=100G, second loadc69d73f94BLOOMERY_HOST_ROOM=100G, first loadc69d73f94BLOOMERY_HOST_ROOM=100G, second loadTo place the introducing commit, I ran the same command on its parent and on it. The parent
6ec3b939gave the same tokenscfc3ae1e001con three loads with probes of 3.75, 11.98 and 7.94 GB/s.5012cc05bgave19f2e3fe4318on loads with probes of 11.50 and 11.94 GB/s, andc1fde2f88857on a load with a 7.82 GB/s probe.Contribution check on the head, tier t0, on an x86_64 Linux machine:
GPU Evidence
The card is an RTX 5090, driver 595.99.02, CUDA 13.2. These lines are from
nvidia-smion the machine that ran the tests, the reproduction and the gates:The gate plan on main opens its card census only for the A6000 and the 3090 by name. On this machine each gate run added one line to
crates/gpu-gates/src/bin/shared/gate_card.rsso the census also names the 5090, and the file was restored after each run. That line is not part of this PR.With the old pricing rule restored (
x.lane_b_per_us = x.probed_b_per_us;set again after the constants are built inXStream::new), the newsittingsclause fails. The probe reads 11.85 and 2.01 GB/s and the priced rate follows it, so the picks and the logits rows differ:On the PR head the same command passes. The probe reads 11.40 and 2.21 GB/s, the priced rate is 3.60 GB/s in both sittings, and the picks, tokens and logits rows are equal:
What I ran into
This does not block the PR.
cargo clippywas not run on this head.just gate-gpu-xstreamandjust gate-gpu-swapreported PASS on this change before the final rebase onto main. The files they cover did not change in that rebase, and I did not rerun them on the final head.gate_qwen38_residencyis one of them. It repeats its split sitting inside one load, so its probe stays the same and it cannot see this defect.admitand print their mode. The new clause then does not exercise the split pricing on that card.lane_rateruns once per load over the 32 probe experts.Hardware
An RTX 5090 32 GB machine, x86_64 Linux, driver 595.99.02, CUDA 13.2, about 125 GB of available host memory, with the model on local NVMe. A 28 GB host room makes the plan page routed experts through the NVMe tier.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.