Skip to content

placement: every load holds made ≤ planned on its card; pass heads, captured graphs, the ring floor and the prompt batch parts are planned terms at one owner (supersedes #1190) - #1191

Merged
midagedev merged 111 commits into
mainfrom
train2
Nov 10, 2026

Conversation

@midagedev

@midagedev midagedev commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

train2 메모리 넘침 수정 일괄 반영: 계획 밖에서 쓰이던 바이트(pass heads, 그래프, ring floor, prompt batch parts)를 공통 owner의 항목으로 넣고, elastic fill과 spill이 카드 예산을 정직하게 읽도록 고친다.

What and why

Every load now holds the card-byte invariant: made ≤ planned at load, first prompt and first step
(refuse_card_past_plan). The bytes a load made outside its plan get a term at one common owner. These are the
multi-row pass heads (placement::heads), the graphs captured after the card reading (placement::graphs), the
xstream ring's floor (place_hybrid's one ring rule), and the prompt batch parts (placement::parts). A K/V fit past
the margin takes back the elastic fill first. Spill and fill read free bytes under the budget as the budget less what
the load made since its open. Supersedes #1190.

Release notes: Fixed — a two-slot or drafted load no longer fails its first prompt past the card plan; Qwen3.8 on a
24 GB card keeps its split prompt pass (+34.2 % pp at P 4096, below).

Code shape

  • No second copy. Card terms are summed in one place, CardTotals::bytes. Its one variant is
    bytes_beside_prompt. The second sum, card_terms, is removed; it had dropped stage_rows. There is one
    ring rule (plan_ring_last, StreamRing), one capture rule (CaptureRule) and one budget-aware free figure
    (card_budget::free_under).
  • Model code holds only architecture facts. The Qwen3.8 ring floor (64 a half) is a per-program fact read
    through program_of.
  • Dead code is gone.
  • No silent failure. A budget with no open reading, a card-experts cap past what the budget holds, and a
    missing head form are each a named error.
  • Comments state what is true now.
  • No relaxed gate. GRAPH_NODE_BYTES is re-pinned with PIN(2026-11-10):, from the box's capture
    bytes= lines. FAIL-first: 5,632 fails every_measured_capture_fits_its_graphs. Two qwen38 serve clauses
    compared plans that are no longer alike; they now build their twin by construction
    (BLOOMERY_CARD_EXPERTS_CAP). Neither has a tolerance.
  • fmt and clippy clean; just mac-lint 0 warnings.

Duplication found or removed: place_hybrid.rs card_terms (removed); xstream.rs:523 MIN_HALF (moved beside the
ring rule).

What I ran

Landing batch, fixture tier, on the box (RTX 3090 250 W + RTX A6000, driver line in the batch witness), list from
just affected origin/main (narrowing kept the full list: crates/levers/src/lib.rs maps to every gate; every
ptx-scan --no-jit of the scan set identical to the base), at bb39c4b:

DONE total=293 red=4 tier=fixture wall=2753s deferred=329 real_only=59 no_fixture=3 real_file=27 needs_env=10

The four reds were the gates' own expected figures, which predated the new terms (a seat test header with no head
form, qwen4exp's drafted plan rows, the MTP draft budget clause, GLM's nextn front). e8e2ac1 reads the terms from
their owners and re-pins the drafted rows with PIN(2026-11-10): and a derivation (the old pins are the FAIL-first,
red in that batch). Rerun at e8e2ac1:

DONE total=4 red=0 tier=fixture wall=399s

The first CI run's static tier found eight reds the box batch does not read (check-arch, check-model-tax,
check-records, check-unsafe, and check-recipes: a reference-tree path, two tests no recipe ran, two profile-less
fixture rows, a plan pin). 6f651c0..e64353b fix each at its owner. Mac: bash tools/check-recipes.sh rc 0, every
tools/check-*.sh rc 0, just mac-check and just mac-lint (0 warnings). Box, fixture tier, just affected e8e2ac1ec at e64353b (every ptx-scan --no-jit identical):

DONE total=227 red=0 tier=fixture wall=2589s deferred=300 real_only=49 no_fixture=3 real_file=21 needs_env=6

Elastic mutants on the fixture tier at bb39c4b: all six turn gate-gpu-qwen38-serve red (2, 2, 9, 4, 12, 10 FAIL
lines).

Same-lease A/B (RTX A6000 300 W, plan a under BLOOMERY_CARD_BUDGET=24176M = the 3090's usable bytes, Qwen3.8
prose:4096, 4 rounds rotated, docs/cards/ringfloor-pp4096.card):

pp tok/s @ prose:4096   split (ring floor) 1678.27 [1669.80..1685.43]   admit 1251.62 [1185.35..1277.77]
paired +34.2 % ± 8.2 (t 3.182, df 3); predicted +15..+40

qwen38-serve on the 3090: fixture 154 PASS 0 FAIL; real 193 PASS 0 FAIL. gate-gpu-lib green. The six elastic E1b
mutants each turn the gate red.

Known, not in this PR

  • V4.1 plan (a) at the plan room holds 2609 card experts, 53 fewer than before (892 MB). The likely cause is the
    prompt batch parts counted per buffer at the granule [derived; --plan prints no per-term bytes, so this is not
    bisected]. Host experts rise 0.4 %, and decode cost is ~0.3 % [derived], inside the ruler.
  • The graphs term counts only the Qwen3.8 seat. glm, ds41, qwen3, mistrallarge4, minimaxm3 and mimo2 still capture
    after their reading with no term.
  • GRAPH_NODE_BYTES sizes a pass at 8 driver steps; the measured maximum is 7. A two-slot MTP load gives up about
    190 card experts to this conservative count. Counting nodes a layer exactly would tighten it.
  • The Qwen3.5/3.6 ring floor is still 0. It needs a route trace and its constants measured on the box.
  • plan_ring_last does not refuse a half under MIN_HALF. Four test fixtures use floors under 8 and must be
    rescaled first.
  • A drafted tier plan reserves the stage card's pass heads on every card, so a 3090 tier gives up 2 experts. It is
    conservative and never past the plan.

🤖 Generated with Claude Code

https://claude.ai/code/session_017hHKUrZnzeEHMiSWRFagxQ

midagedev and others added 30 commits November 9, 2026 13:17
…142 (d256kdsa, real and fixture sets, the prose-all corpus); the over-limit clause past it

WIP: GLM_PROSE_ALL_SHA256 is a placeholder until the corpus copy is made on the box and pinned; the d256kdsa sets are not dumped yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XgzWzhZmMb7Ec2SohqrR1A
…t can attend (list_width(kept), the dense positions), not by ctx; the plan's prompt reserve counts them (prompt_attn_bytes) and Bufs refuses by name past it; BP_TIER_EXPERTS re-pinned for the 262,144 plan

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XgzWzhZmMb7Ec2SohqrR1A
…m the box run (132 pairs; fixture reach-check rc 0 there), beside the checked-in header pairs' rows

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CjHkkoRrDMeThyrzguSMXZ
…nly (fx_ref_glm5next_d256kdsa); the real recipe refuses d256kdsa by name, its CPU prefill of the full file running past the dump bound (~14 h [derived]); refset's mirror test names the fixture-only set

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CjHkkoRrDMeThyrzguSMXZ
…seats (drafted and DSpark paths; the Qwen3.8 seat opens a watched session); the max-ctx arm is one function, serve_client::card_bytes_hold_at_max_ctx, called by the shared and the three main serve gates; ten .mutants/kcover4b-*

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CjHkkoRrDMeThyrzguSMXZ
… would fall below the plan's margin (Card::margin_bytes), not only on the driver's refusal; hw_held_a_spill_room_keeps_the_cards_margin (WIP: unrun on a card)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CjHkkoRrDMeThyrzguSMXZ
…sitions and spill (the seat owns KV_DEFAULT; levers and placement stay model-free: KvFloor with `off`, KvDefault, PlanLevers::from_levers_with); a device that cannot back a host page takes kv_host=off for an unset lever, named on stderr

Decided by docs/cards/ctxplace-q38.card (A6000, ctx 262,144, 6 rounds): decode +3.75 / +2.51 / +1.16 % at depth 6 / 512 /
4,096, prompt +2.0 / +11.1 / -0.0 %. BLOOMERY_KV_FLOOR=off and BLOOMERY_KV_HOST=off give the plan of the context alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X1hsQdxdmvvQpg1WFwxmEf
…rule's heat from the sequence before is cleared and the call keeps its pick (SwapRule::call_history(start), one owner for Qwen3.8, Qwen3.5, V4.1 and Muse); a call past 0 keeps today's return

A server's second request onward always held decode heat, so a new conversation's prompt pick was put back and its
decode ran on the previous conversation's pool. gate-gpu-qwen38-residency gains newseq (mutant
.mutants/callkeep-history-ignores-pos.patch); the swap rule's unit test is red on that mutant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X1hsQdxdmvvQpg1WFwxmEf
…er (runtime::stores PosLayout/PosBuf/Access, KvBytes::rooms, the room facade gpu::room::kv with kv_backing, RoomTensor and fit_rooms); Qwen3.8 moves onto it, and a load whose family declares no rooms refuses a set BLOOMERY_KV_FLOOR count or BLOOMERY_KV_HOST spill/all by name (KvUnroomed)

A family declares its by-position buffers once as data (row bytes, positions a row, head runs, Scan or Select); the plan's
floor and cap terms, the page rounding, the Scan -> card / Select -> host-able class and the fit -> residency free -> retry
loop are common. Qwen3.8's plan lines and kernels are meant unmoved (canon-check and the plan tests decide).
.mutants/r3b-fit-retry-removed.patch now targets fit_rooms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X1hsQdxdmvvQpg1WFwxmEf
…serve after the placed load (CardTotals::grow_reserve, GpuModel::grow_plan_reserve), gate_mimo2_flash runs through the fixture tier (tier::acts_on, run_clause, tally_line), and three lints of kcover's card_made / card_bytes code

From the fixture-tier batch's 34 reds (cause table: ~/.cache/bloomery/specs/kcover/fixreds-report.md). The GLM fixture
budgets (19 rows) are stale data, not code: a box rebudget.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X1hsQdxdmvvQpg1WFwxmEf
…in's planner moved them since their last dump (the same bytes at main 2f560a7, so no kvbase commit moves them)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XgzWziKCXosAu2zaVTWpbG
…out the selector, plain buffers) pads nothing, so its plan does not refuse (gate-serve-draft-rules' four seat tests)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XgzWziKCXosAu2zaVTWpbG
… (runtime::prompt::call_groups, heat_call), and a failed call's take-back one (served::take_back)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XgzWziKCXosAu2zaVTWpbG
…a failed call back by served::take_back; GLM's steps refusal is served::refuse_steps_feed

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XgzWziKCXosAu2zaVTWpbG
midagedev and others added 12 commits November 10, 2026 12:53
… prompt and the ring (CardTotals::bytes_beside_prompt, the one variant of the sum), so stage_rows counts there; the ring's fewest slots a half (MIN_HALF) lives beside the ring rule

card_terms, a second sum of seven terms, left stage_rows out of the room place_hybrid,
deepseek41 and glm5next fit a prompt reserve under, so a reserve could pass that did not
fit. Its callers now use CardTotals' own term list less prompt and ring, which those
checks hold beside it. xstream re-exports MIN_HALF from place_hybrid.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CjHkko2PqJup1jDndE8pcP
…irst (placement::elastic::fill_first) and spills only past what the fill holds; every spill room keeps its margin against the card budget's free bytes (card_budget::free_under), not the driver's

The spill threshold read cuMemGetInfo's free while the load ran under a card budget,
so it saw total - budget more than the plan's card, and a K/V fit entered the margin
with nothing given back. Now one budget-aware free figure feeds every spill room
(qwen38, deepseek41, kimi_k3), and a fit first takes back min(asks + margin - free +
page, held) of the fill. Body38 does it before its prompt call opens, since the swap
machine refuses give-backs inside an open call. A load with no fill is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CjHkko2PqJup1jDndE8pcP
…verify passes and walks, two slots' rounds) are a planned card term (placement::graphs, CardTotals::graph_bytes), reserved before the experts; every capture phase past the reading prints the bytes it made

A two-slot Qwen3.8 load read its card, then added its slot, opened its drafts and
captured 24 round passes, none of which the plan counted: its first prompt was
refused 44,382,992 B past the plan on the 3090 (real file). One rule
(CaptureRule, set by the seat before its plans and by the gate's restated plans)
derives the captures of each plan; a pass's graph keeps GRAPH_NODE_BYTES a node in
the driver's 2 MiB steps, pinned from the capture lines' bytes= on the box. A
plain one-slot load captures nothing past its reading and plans byte for byte as
before. round_keys moves to runtime, so the capture and the plan count the same
rounds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUuV1aj7ZurRzfjcB7k
…e one spread rule (refused by name past what the budget holds); the qwen38 serve gate's elastic-fill twin is the static plan capped at the elastic plan's experts plus its fill, not a budget widened by the fill's bytes

The fill adds the same count to every layer and the spread hands the lowest layer
first, so a plan's per-layer counts are a function of its total; but the planner
buys 90 experts with the 295,698,432 B the fill paid for 88 (its granule model
against the fill's 2 MiB pages), so no widened budget pins the twin's total. The
gate reads the inherited budget through the parsed lever, and its new off-default
pins have their defaults twins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUuV1aj7ZurRzfjcB7k
…t the load made since its open (before - free), the count refuse_card_past_plan reads; the driver's total held the CUDA context and other processes' bytes, so a 3090 load under its own usable budget read 419 MB short and never filled

CardKeep carries the open reading into every spill room (qwen38, deepseek41,
kimi_k3) and the seat's settle; a budget with no open reading refuses by name.
The real-tier elastic-fill server read 1,011,744,768 B under the old figure
(under its 1 GiB margin, held) and reads 1,431,175,168 B now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUuV1aj7ZurRzfjcB7k
…plan room (the card bytes terms gain graphs; qwen38's plan line gains card_experts_cap; V4.1 plan (a) holds 2609 card experts, 53 fewer, as its prompt batch's parts are counted per buffer)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUuV1aj7ZurRzfjcB7k
… lookup plan's card experts (the lookup load now plans its verify graphs, so the two plans differ); the elastic-fill clause, when its plan leaves no quantum above the margin, reruns both arms capped three quanta below the plan so the warm settle fills

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUuV1aj7ZurRzfjcB7k
… split plan's ring and its staging grow into the bytes a card-experts cap frees (the capped real plan grew its ring from 64 to 83 a half and its reserves by 349 MB, and no fill fit)

Real tier on the 3090: the capped arm fills 3 slots a layer over 48 layers
(501,219,328 B) and the capped static twin holds the same 4247 card experts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUuV1aj7ZurRzfjcB7k
…from their owners; the qwen38 seat test header carries a head, qwen4exp's drafted rows are re-pinned for the passes' heads, the MTP draft budget adds the drafted terms, and GLM's nextn front adds its two-row heads

- serve_seats/qwen38.rs: seat_plan_inputs gives its synthetic header an output.weight (Q8_0 [2560, 8]), so HeadForm::of_model reads a head form and the auto-slots tests plan.
- qwen4exp_meta.rs, qwen4exp_mtp_meta.rs: the drafted rows re-pinned with PIN(2026-11-10) and their derivation (the Q8_0 head's 2..4-row passes are 10,485,760 B, five granules; the Q6_K head's 12,582,912 B); a card prompt clause holds the plan's prompt term to pass_heads_bytes.
- gate_qwen4exp_mtp.rs (d): the drafted budget is the alone budget plus the draft's card bytes plus the heads and graphs a drafted load counts beside its experts, drafted less alone.
- gate_glm5next_residency.rs nextn-front-refuse: the front is the prompt batch's units plus pass_heads_bytes at two rows, checked equal to the nextn plan's prompt term.
- qwen35moe/place.rs: pass_heads_bytes is pub (bytes unchanged).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUrZnzeEHMiSWRFagxQ
@github-actions github-actions Bot added documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset 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 placement Placement planning: crates/placement tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo labels Nov 10, 2026
midagedev and others added 8 commits November 11, 2026 02:20
…, not a coverage/ directory, which check-arch and check-model-tax read as an architecture

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUrZnzeEHMiSWRFagxQ
…, word) lives in the qwen3 seat, not in the common served.rs; check-model-tax's served.rs qwen row goes; body38 names qwen35moe::place by path, not by a cross-architecture use

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUrZnzeEHMiSWRFagxQ
…loomery_gpu::raw_device_attribute, the one owner of a device attribute read, not an unsafe block of its own (check-unsafe)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUrZnzeEHMiSWRFagxQ
…ulary file lives there with no link in /models); a literal under it is keyed as a model file, not read as a reference tree, so gate-tokenizer and gate-ptx-spill skip again

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUrZnzeEHMiSWRFagxQ
…tests, which gate-gpu-gates-lib runs; the shared e2e.rs re-exports rel, and the two V4.1 gates that read rel_max import it there (orphan-tests: the tests compiled into thirty bins no recipe tests)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUrZnzeEHMiSWRFagxQ
…s) beside the registry's lib tests; the kimi-k3-full and muse-spark-full profiles exist (their base profile's names, MODEL spelled), so the fixture-dirs rows kcover added resolve

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUrZnzeEHMiSWRFagxQ
…0962808 (2609 card experts, 65..66 a layer; the prompt batch's parts counted on the stage card), PIN(2026-11-11)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017hHKUrZnzeEHMiSWRFagxQ
@midagedev
midagedev merged commit e64353b into main Nov 10, 2026
8 checks passed
@midagedev
midagedev deleted the train2 branch November 10, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset 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 placement Placement planning: crates/placement tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant