Skip to content

gpu-gates: (pg) plans card experts on a machine that counts their route scratch, and reads the drafted plan's room from MtpPlan - #255

Merged
midagedev merged 1 commit into
mainfrom
perf-q38pg
Oct 15, 2026
Merged

midagedev merged 1 commit into
mainfrom
perf-q38pg

Conversation

@midagedev

Copy link
Copy Markdown
Owner

gate-gpu-qwen4exp-mtp's (pg) clause (a set draft on a paged plan) was red on the A6000 real tier, the 0.3.2 known issue q38pg. The red was in the clause's reading, not in the plan. This PR does two things:

  • It plans the clause on the machine the load uses.
  • Its fit reads the field that holds the draft's reserve (option B, the user's choice), against an explicit expected relation.

What

  • The machine. drafted_paged_run now plans with machine_for_experts(.., Experts::Card), as the load does. That machine counts the card experts' route scratch. This is the WIP fix carried from branch q38pg (ff1e0aea).
  • Why the old fit was red. It compared the drafted plan's stage-card headroom_bytes with the plain plan's.
    • That field leaves the draft's reserve R out. R is the draft's card bytes plus its program arena, the lever's extra.
    • The expert rule moves experts off the card to make room for R, so the field rose by about R.
    • The clause read that rise as "less room" with the sign flipped. On the A6000 real tier the delta was −2,843,738,112 B.
  • The new fit. It reads MtpPlan::headroom_bytes, which subtracts R, against the plain plan's stage-card headroom (the plain-side partner). It also holds the relation term by term:
    • The fixed terms are equal on both stage cards: dense, KV, stage rows, scratch, context and reserves.
    • The planner's identity holds: MtpPlan::headroom = T.headroom + T.reserves − R.
    • The remainder R − moved is bounded. moved is the expert and rounding bytes the rule took off the card. The bound is the largest layer's one-expert card bytes, read from the plain plan's card segments, plus one granule for each routed stack. The rule moves whole experts, so this is its slack.
    • On the A6000 run the remainder was 2,091,180 B.
  • No other clause changed.

공통화한 것 (Commonized)

  • R is the lever's extra, the same number plan_mtp_with reserves. It is not recomputed.
  • The expert bytes are read from the plan's own card segments, not from a second formula.

Evidence

  • Pre-review: Pre-review CLEAN at e62bf8ff493d7538da3d4e72b94a4a5a05808736.
    • Two earlier passes were MUST_FIX, both fixed: GRANULE is a NonZeroU64, and R must include the draft arena.
  • An earlier card run at c74d236f stopped by name: (pg) the plain plan's 14601420800 card expert bytes are not 4659 equal experts. This file's layers differ in per-expert bytes, and the bound now takes the largest layer.
  • The criterion is B′, the user's choice. The fit is the relation alone: equal fixed terms, the identity, and |R − moved| under the bound. Which plan holds less room is printed, not required, because the remainder's sign follows the packing. A dated PIN(2026-10-15) line above the fit carries the evidence: remainder +2,091,180 B at room 30,796,775,936 (fde6499) and −2,103,124 B at room 31,139,464,192 (cee6e7e4).
  • A6000 real tier, just gate-gpu-qwen4exp-mtp at e62bf8f (job s698): gpu-gate.sh: gate_qwen4exp_mtp ran 243 s (exit 0).
    • (pg) room 30608413696 B: … the drafted plan's headroom 1077197076 B (MtpPlan) against the plain plan's 1075093952 B, -2103124 B less (the drafted plan holds less: false, printed); R 2845829292 B, moved 2847932416 B, remainder -2103124 B (bound 10285056); fixed terms equal true, identity true PASS
    • (pg) the drafted run's 32 ids = the plain run's PASS …
  • FAIL-first, A6000 real (tools/mutant-run.sh):
    • b-no-reserve (r = 0, s680): … identity false FAIL, killed.
    • a-old-field (also require the old stage-card inequality, s676, read by boxq.py attach after a daemon blip): red. That inequality is false whenever the identity holds, because the stage card's headroom is the MtpPlan headroom plus R.
  • Mac static (tools/mac-remote.sh --tree <a clean copy of cee6e7e4> origin/main, d1-mac):
  • The spec note specs/common/q38pg-pg-options.md is marked "chosen: B".

🤖 Generated with Claude Code

…te scratch, and reads the drafted plan's room from MtpPlan

The paged clause planned on a machine that did not count the card experts' route scratch; it now plans
with machine_for_experts(.., Experts::Card), as the load does.

Its fit read the drafted plan's stage-card headroom, which leaves the draft's reserve R out: the expert
rule moves experts off the card to make room for R, so that field rose and the clause read the rise as
less room (A6000 real: -2,843,738,112 B). The fit now reads MtpPlan::headroom_bytes, which subtracts R,
against the plain plan's stage-card headroom, and holds the relation term by term: equal fixed terms
(dense, KV, stage rows, scratch, context, reserves), the planner's identity MtpPlan = T.headroom +
T.reserves - R, and a remainder R - moved (moved: the expert and rounding bytes the rule took off the
card) under the largest layer's one-expert card bytes plus a granule for each routed stack. The
remainder's sign follows the packing at the room (A6000 real: +2,091,180 B at one room, -2,103,124 B at
another), so which plan holds less room is printed, not required.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added gpu The card engine: crates/gpu*, crates/app needs-gpu Changes code a card must check, and carries no gate run on a card labels Oct 15, 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: The revised gate uses the planner's draft reserve and checks its headroom relation without requiring a packing-dependent sign.

Checked

Duplicates: 1 new callable (fixed) checked; no duplicate owner. No new named functions, types or constants; no dryer pairs reported.
Complexity: drafted_paged_run rose from 31 to 36 through branches that derive the per-layer packing bound in the existing clause.
Silent failure: 3 sites followed. Non-layer tensors and empty expert lists do not contribute; Stages::new rejects the zero-layer case before the maximum's fallback can run.
Tests: removing reserve from crates/model/src/arch/qwen35moe/place.rs:807 makes the new identity false, and fit reaches the gate result. Mutation checked by inspection; the PR reports killed reserve and old-field mutants.
Gates: the replaced inequality carries PIN(2026-10-15), its reason and evidence for both remainder signs. No production hot path changes.
Escape catalog: no C1–C4 patterns match.

Notes

Diagnostics report that dryer did not run. GPU gates were not run during this review. The reported card run lacks the required nvidia-smi card/driver line and a complete base/head/model witness; GPU evidence is false.

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

@midagedev
midagedev merged commit ccd03f7 into main Oct 15, 2026
6 checks passed
midagedev added a commit that referenced this pull request Oct 15, 2026
The status names 0.3.3's MiniCPM-V 4.7 images and the two Qwen3.8 fixes,
and points at the release notes for the release pass. The known issues drop
the two 0.3.2 lines fixed in #121 and #255 and add the split clause's run
to run distance. The tarball names and release link are 0.3.3's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 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