Repository navigation
placement: Qwen3.8's restated stage counts the rope rows its load copies to the card - #821
Conversation
…ies to the card The restated Qwen3.8 cache (Kv38) counted every layer's stores but not the rope rows the stage keeps beside them, 64 rope dims of f32 a position, which qwen35moe's KvLayout counts through stage_position_bytes and the load copies to the card. The restated A6000 plan so kept 1,048,576 B more expert room at 4,096 positions than the engine's and held one expert more on layer 30 than the box gate's CARD_PLANS row. Kv38 now counts them. The A6000 plan is the CARD_PLANS row, its rounding bytes included in the assertion, and the two-slot boundary moves from 254,208 to 252,928 positions a slot.
There was a problem hiding this comment.
Verdict: CLEAN: The fixture now counts the shared rope rows and matches the existing model gate's A6000 plan.
Checked
Duplicates: 1 new method checked; the model implementation cannot be reused by its dependency's fixture. No duplicate owner exists in placement. Dryer reported 0 pairs.
Complexity: crapper flagged no function; the new method adds straight-line arithmetic.
Silent failure: 1 former zero-default path followed through the slot wrapper into the card budget and public stage_rows_bytes total. No new error suppression.
Tests: static mutation analysis of crates/placement/src/placement/qwen38_cards.rs:219: returning 0 restores the old budget, which the changed A6000 tuple and two-slot next-step margin assertions reject. This mutation was not executed.
Gates: both changed expectations have dated PIN comments, reasons, and derivations. The A6000 expert counts, bytes, and rounding equal the existing CARD_PLANS row.
Adversarial checks: slots share one rope table; only the card running layer 0 is charged; fixture contexts fit the new multiplication. The changed module is test-only and adds no runtime hot-path work.
Escape catalog: no C1–C4 pattern matched.
Notes
Rust tests and runtime mutations were not executed during this review. The PR reports 197 passing placement tests.
🔨 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. |
Qwen3.8 배치 시험이 쓰는 카드 계산에서 빠진 rope rows 항목을 채워, 시험이 실제 배치 계획과 같은 값을 확인하게 합니다.
What and why
The Qwen3.8 placement fixture in
crates/placement/src/placement/qwen38_cards.rsrestates the model crate's cache terms, because the placement crate cannot read the model crate. ItsKv38left outstage_position_bytes, so the trait default of 0 applied. The real planner counts it:KvLayout::stage_position_bytesincrates/model/src/arch/qwen35moe/place.rsreturns the rope row (64 rope dims of f32, 256 B) times the context, and the planner charges it to layer 0's card. The serve load copies those rows to the card (RopeRows::newincrates/gpu/src/arch/qwen3moe/body38.rs), so the planner's count is the right one.With the term missing, the fixture's A6000 plan kept 1,048,576 B more expert room at 4,096 positions than the engine's plan. That is less than one granule, so the plans differed by a single expert on layer 30 instead of by a visible amount, and the fixture no longer matched the box gate's
CARD_PLANSrow.Kv38now implementsstage_position_bytes(ctx_max) = ctx_max * 64 * 4. Two assertions follow from it, each re-pinned withPIN(2026-10-26)and its derivation:q4_on_one_96gb_card_holds_every_routed_expertasserts the box gate's A6000 row: 263 experts on the first 30 layers and 262 on the rest, 39,505,100,800 B of experts and 593,981,952 B of rounding. It had asserted 263 on the first 31 layers and 39,508,684,800 B. The rounding bytes are now part of the assertion.two_slots_at_252416_stay_within_the_marginis a boundary the fixture derives for itself, not a box gate value. The rope rows (256 B a position, one copy shared by both slots) move the last step that holds from 254,208 to 252,928 positions a slot, with 505 experts on every layer and 336 on the host. The test name is unchanged, as in its earlier re-pins.Release notes: internal: the Qwen3.8 placement fixture counted no rope rows, so it disagreed with the planner it restates.
Code shape
Kv38; I found no other Qwen3.8 cache restatement in the placement crate.Kvinnodes_scale.rsis a synthetic cache and does a different job.Resultis new. The multiplicationctx_max * 256lives inside the test restatement, with test contexts only.PIN(2026-10-26)lines follow the file's existing re-pin format.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": none.What I ran
cargo fmt -p bloomery-placement --checkandcargo clippyonbloomery-placementare clean.I did not run
just gate-qwen4exp-metaorgate_qwen38_residency; the change does not touchcrates/model.Hardware (if the change is for a machine)
Not a machine change. The tests are CPU only.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.