Skip to content

gpu-gates, model: plan the fixture tier's card budget beside what its card sets aside - #785

Merged
juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:dgx-spark-fix-qwen3-5-moe
Oct 24, 2026
Merged

juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:dgx-spark-fix-qwen3-5-moe

Conversation

@juliankang4

@juliankang4 juliankang4 commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

통합 메모리 카드에서 Qwen3.8 픽스처 계획이 레이어마다 전문가를 몇 개 덜 담던 문제를, 카드가 따로 떼어 두는 바이트를 예산에 더해 계획하도록 고칩니다.

What and why

The Qwen3.8 fixture records the card budget under which its plan on the RTX 3090 keeps half of the experts on every card-eligible layer. The fixture tier plans on whatever card is visible. On a unified-memory card such as the DGX Spark's GB10, the stage also reserves the activations' MMA forms, which the 3090's plan does not. Under the recorded budget alone, every layer on the GB10 ended up a few experts short of half.

A family's fixture budget can now name what its plan sets aside on a card past the card it was planned on (Budget::card_set_aside). For Qwen3.8 that is the stage's extra reserves on the given card (card_set_aside in qwen35moe/fixture.rs), and it is 0 on the 3090. tier::header_budget returns a HeaderBudget with the recorded value and this set-aside on the fixture tier's card, and budget_levers plans under recorded + set_aside + extra. The recorded value, its staleness check and the comparison against a BLOOMERY_CARD_BUDGET lever are unchanged, so discrete cards plan as before. A set-aside that overflows u64 is a named error.

The same change moves the stale-budget re-plan and its error mapping into one function, planned, that header_budget calls. The regeneration advice was tested through its formatter alone, so a production call that dropped it was not caught. The test now drives planned. The fixture tier's card lookup also moves out of tier::card into fixture_card, which header_budget shares.

Release notes: internal: the fixture gates plan Qwen3.8 on a unified-memory card with the experts its recorded budget promises.

Code shape

  • No second copy. The card's set-aside is computed once, in the family's card_set_aside, and header_budget and budget_levers carry it. The Qwen3.8 file's machine layout is now budget_machine, which both card_experts and card_set_aside use.
  • Model code holds only architecture facts. The qwen35moe fixture states what its stage reserves. The common Budget gained a card_set_aside field that is None for every other family, and no per-model branch.
  • Dead code is gone. fixture_budget_error is folded into planned.
  • No silent failure. A set-aside below the 3090's, a set-aside past u64 and a budget sum that overflows are named errors.
  • Comments state what is true now.
  • No relaxed gate. No band, tolerance or lint moved, and no pin changed.
  • cargo fmt and cargo clippy are clean on what I touched, and the lint count did not go up. The repository's t0 check tier ran on this head: DONE tier=t0 total=37 red=0 wall=690s

Duplication found or removed (path:line): the test hw_fixture_q38_budget had a second machine layout beside its plan closure for the unified card; it is one closure that takes the card. The test's machine_for_experts call repeats budget_machine in qwen35moe/fixture.rs, which is private; I left it, because opening it would add a public item only a test uses.

What I ran

Commands and output are from the DGX Spark below. I ran no timing measurement, because this change touches no decode, prefill or kernel path.

hw_fixture_q38_budget is #[ignore]d and needs the Qwen3.8 fixture generated from the model file. On the Spark I generated it once with the tree's own fixture generate and ran the test in the fixture tier (BLOOMERY_TIER=fixture):

cargo test --release -p bloomery-model-hf --test fixture hw_fixture_q38_budget -- --ignored --nocapture

Its output on the GB10:

q38 budget: recorded 9482272768 B (9043 MiB); layers 4; host-only []; unbounded [512, 512, 512, 512]; recorded [256, 256, 256, 256]; a unified card sets aside 45379584 B more: [253, 253, 252, 252] under the recorded budget alone, [256, 256, 256, 256] beside it
test hw_fixture_q38_budget ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 42 filtered out; finished in 0.82s

The same test pins the card-dependent plan on both card conditions. On the 3090's spec the family's set-aside is 0, and the plan under the recorded budget holds [256, 256, 256, 256]. On the unified spec the recorded budget alone no longer holds half (the assert_ne! on [253, 253, 252, 252]), and the recorded budget plus 45379584 B does.

The tested head is one lint fix earlier than the pushed head: the card_set_aside field type became the alias CardSetAside because clippy's type_complexity flagged it on the GB10. Nothing else differs. I did not rerun the card test on the final head.

The tier.rs unit tests changed with the new field. The levers test builds fixture headers with a set-aside and checks the planned budget as the sum of the recorded budget, the set-aside and the draft reservation. It also checks that a lever matching only that sum is refused and that an overflowing sum is an error. A second test drives planned with a stale budget and checks that the error names the file, the recorded budget, the counts and the regeneration step.

Hardware (if the change is for a machine)

DGX Spark, driver 595.84, CUDA 13.3, from the node's nvidia-smi (the test ran in a CUDA 13.3.1 container image):

| NVIDIA-SMI 595.84                 Driver Version: 595.84         CUDA Version: 13.3     |
|   0  NVIDIA GB10                    On  |   0000000F:01:00.0 Off |                  N/A |

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

… card sets aside

The Qwen3.8 fixture records the card budget under which its plan on the
3090 holds half the experts on every card-eligible layer. The fixture
tier plans on the visible card, and on a unified card (DGX Spark) the
stage reserves the activations' MMA forms beside the 3090's terms, so
the recorded budget left every layer a few experts short of half.

A family's fixture budget now names what its plan sets aside on a card
past the card it was planned on (Qwen3.8: the stage's reserves), and the
fixture tier plans under the recorded budget plus that set-aside on its
own card. The recorded value, its check and the lever comparison are
unchanged, so discrete cards plan as before.
…makes

The regeneration advice was tested on its formatter alone, so a
production call that dropped it still passed. The re-plan and its error
mapping are now one function that header_budget calls and the test
drives.
@github-actions github-actions Bot added gpu The card engine: crates/gpu*, crates/app model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja needs-gpu Changes code a card must check, and carries no gate run on a card labels Oct 24, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: CLEAN: No must-fix defect is established in the changed code.

Non-blocking

⚠ Validate the production budget connection: crates/gpu-gates/src/tier.rs:984.
Replacing the assignment with planned(&planner, split, path, recorded)?; leaves the changed tests green: the fixture test adds the reserve itself, and the levers test supplies it by hand.
Run the existing fixture-tier MTP budget clause (d) on a unified-memory card with this mutant to confirm failure, then attach the final-head passing run. This verifies that header admission carries the reserve into the gate's plan.

Checked

Duplicates: dryer's one pair shares fixture-construction shape, with different architecture facts and rule owners. The new reserve calculation reuses Card::set_aside_bytes.
Complexity: crapper flagged no changed function.
Silent failure: the zero/default paths correspond to an absent budget, an inapplicable adjustment or a build without a device. Malformed headers, stale budgets and budget-sum overflow return errors.
Tests (static mutation inspection): dropping either budget addend breaks the sum assertions; returning zero from the unified-card callback breaks the half-expert assertion; dropping stale-error mapping breaks the regeneration assertions. The changed tests do not cover carrying the callback result through header admission.
Gates: no pins or tolerances moved; the half-per-layer contract remains.
Card identity: budget adjustment and card selection share the cached fixture card. Changes run during fixture setup, outside decode and prefill.
Escape catalog: C1–C4 do not match.

Notes

The reported fixture test predates the final alias edit. Complete GPU evidence is absent: no selected just gate-* run with output, tested commit pair or model-file identity is attached. This review used static tracing; no builds or gates were run.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_qwen4exp_mtp.rs, crates/gpu-gates/src/bin/shared/glm5next_tier.rs, crates/gpu-gates/src/tier.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)

Filed outside this PR: #786

@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

@juliankang4
juliankang4 merged commit 5c8e9ec into midagedev:main Oct 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gpu The card engine: crates/gpu*, crates/app model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja needs-gpu Changes code a card must check, and carries no gate run on a card

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant