Repository navigation
gpu, gate-paths: the tier page is reached over its link; host/link.rs holds the shared page, and the stage card, each tier card and the host take the page's addresses and words there - #96
Conversation
… holds the shared page, and the stage card, each tier card and the host take the page's addresses and words there The tier protocol enqueued device addresses straight from the page's MappedHost. Each side now takes them from its end of the link (LinkEnd): the stage card's go and wait batches and its windows from Link::stage_end, a tier card's go wait, staging copies, fault copy, signal and row windows from the end Link::tier_end made at bind, and the host's progress, release, reset and fault reads from Link::word. The link is the shared page, so every end is the page's one device address and every operation, address and value is the one it was. TierCard::bind's address check moved into Link::tier_end with its message unchanged; it binds the tier's context itself. The weekly-gpu-ds41-lost trigger row of tools/gate-paths.tsv lists host/link.rs, where the tier card's wait_for and lost_detail now read their words.
6d0dc9e to
f690d6f
Compare
|
@midagedev 리베이스 완료했습니다. 리뷰 부탁드립니다. |
There was a problem hiding this comment.
Verdict: CLEAN: The page-access move preserves addresses, protocol operations, error handling and ownership order.
Non-blocking
⚠ Complete the move-class evidence: crates/gpu/src/host/tier.rs:1220. The base contract (AGENTS.md:88) requires an e2e-set comparison, which the PR reports was not run.
The supplied runs use a patched one-card loopback. They do not exercise the F32 staging copy or address validation across two physical cards.
Attach base/head just gate-gpu-e2e output and the owning two-card gate outputs when the fixtures and hardware are available.
Checked
Duplicates: Link delegates allocation and atomic bounds to MappedHost; the tier address check moved without a second copy.
Complexity: Parts::enqueue_layer's existing row/column validation now also requires an endpoint.
Silent failure: invalid flag-word offsets reach the invariant panic; missing endpoints return a named error before enqueueing. CUDA errors propagate.
Tests: no new or changed tests; mutation checks do not apply.
Gates: no pins or clauses moved; the weekly lost-card trigger adds link.rs.
Performance: derived from the diff, decode/prefill dispatch adds 0 allocations, launches, copies or synchronizations per tier layer. The change is in the move class.
Adversarial checks: mismatched device addresses fail before binding; unbound and boundary rows fail before access; reset retains the endpoint and page; cards and windows drop before the allocation.
Escape catalog: no C1–C4 patterns matched.
Notes
GPU evidence: false. Validation used static inspection; no build or GPU gate was run.
Card check: needs-gpu. This pull request changes crates/gpu/src/host/link.rs, crates/gpu/src/host/mod.rs, crates/gpu/src/host/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)
…link as generations; a loopback link carries them between two pages on one machine with a host pump A row's go counter is added to by the stage card and taken back by the tier, and its done counter the other way. Across two pages a copy of the writer's absolute value would erase the reader's take back, and a captured wait keeps one fixed target on every replay. So on the loopback each counter is split: on the writer's page only the writing card adds to it (a generation), and for each new generation the pump copies the bytes it publishes to the reader's page (a go: the row's image; a done: the row's routed rows and the tier's fault copy), writes the progress for a done, and then adds one to the counter on the reader's page, where the reading card's wait and take back are the shared page's. The step is checked before anything is published: 0 carries nothing, 1 carries one, and any other step publishes nothing and stops the pump by name, so the host sees the tier behind and the lost tier's detail names the step. The host's progress word on the stage card's page counts the dones carried, so it never runs ahead of their bytes. A release stops its own counter. A reset takes that counter's generations as carried, restarts its tier's progress count from the tier's page and resumes that counter alone, so a counter still released keeps what its writer adds until its own reset; a broken relay stays stopped across any reset. At rest means every generation carried, the reader's counter at 0 and no relay broken. Link::broken also names a pump thread that ended, and the not-at-rest error of a reset's check carries it, as lost_detail does. host/link/pump.rs holds the relay (Relay, Relays) over a Page trait, with four host tests: the step rule across the u32 wrap; two model cards over the pump thread for 2000 goes and dones from a generation near the wrap, then a release, three more layers the cards run with nothing carried, the go's and the done's resets taken apart with the pump running between them, and 2000 more (every go carries its image, every done its rows, the progress counts every done, both counters end at rest); a reset of one counter that leaves another, released, stopped until its own; and a doubled done with raised rows that publishes nothing. Link::new picks the link's kind; the loopback allocates the tier cards' page in the first tier's context and starts the pump thread through threads::helper::spawn_helper, floating, so it never shares a pinned load thread's cpu; TierLayout::crossings lists the counters and their spans. Link::store writes the tier cards' page first. The tier protocol's code is the same over both links. BLOOMERY_TIER_LINK (shared | loopback, unset shared, a mode) picks the link where HostTier::attach_tiers builds the page, through bloomery_levers::tier_link, read below every binary's main. On the shared page nothing changes. weekly-gpu-ds41-lost runs gate_deepseek41_tier's T1, T2, B7, B2 and its lost-card clauses over the loopback after its shared-page line; that recipe's trigger row in tools/gate-paths.tsv lists host/link/pump.rs, its tools/box-fill.tsv row says it runs the loopback, and tools/defaults-twins.tsv names the recipe's shared-page line as the loopback pin's twin. tools/spawn-allow.txt holds the relay tests' two threads. docs/contrib/dgx-spark.md: section 1's P5 row and file list, section 9's opening, 9.5 (the impls and item 2), 9.6 (item 3 and what carries to N = 4) and answer 20 describe the relay on the plan the maintainer agreed to in midagedev#127, and 9.6 item 3 records that the maintainer takes it on midagedev#96's structural proof in place of a same-lease A/B. The lines it cites in host/tier.rs and host/link.rs are updated.
…link as generations; a loopback link carries them between two pages on one machine with a host pump A row's go counter is added to by the stage card and taken back by the tier, and its done counter the other way. Across two pages a copy of the writer's absolute value would erase the reader's take back, and a captured wait keeps one fixed target on every replay. So on the loopback each counter is split: on the writer's page only the writing card adds to it (a generation), and for each new generation the pump copies the bytes it publishes to the reader's page (a go: the row's image; a done: the row's routed rows and the tier's fault copy), writes the progress for a done, and then adds one to the counter on the reader's page, where the reading card's wait and take back are the shared page's. The step is checked before anything is published: 0 carries nothing, 1 carries one, and any other step publishes nothing and stops the pump by name, so the host sees the tier behind and the lost tier's detail names the step. The host's progress word on the stage card's page counts the dones carried, so it never runs ahead of their bytes. A release stops its own counter. A reset takes that counter's generations as carried, restarts its tier's progress count from the tier's page and resumes that counter alone, so a counter still released keeps what its writer adds until its own reset; a broken relay stays stopped across any reset. At rest means every generation carried, the reader's counter at 0 and no relay broken. Link::broken also names a pump thread that ended, and the not-at-rest error of a reset's check carries it, as lost_detail does. host/link/pump.rs holds the relay (Relay, Relays) over a Page trait, with four host tests: the step rule across the u32 wrap; two model cards over the pump thread for 2000 goes and dones from a generation near the wrap, then a release, three more layers the cards run with nothing carried, the go's and the done's resets taken apart with the pump running between them, and 2000 more (every go carries its image, every done its rows, the progress counts every done, both counters end at rest); a reset of one counter that leaves another, released, stopped until its own; and a doubled done with raised rows that publishes nothing. Link::new picks the link's kind; the loopback allocates the tier cards' page in the first tier's context and starts the pump thread through threads::helper::spawn_helper, floating, so it never shares a pinned load thread's cpu; TierLayout::crossings lists the counters and their spans. Link::store writes the tier cards' page first. The tier protocol's code is the same over both links. BLOOMERY_TIER_LINK (shared | loopback, unset shared, a mode) picks the link where HostTier::attach_tiers builds the page, through bloomery_levers::tier_link, read below every binary's main. On the shared page nothing changes. weekly-gpu-ds41-lost runs gate_deepseek41_tier's T1, T2, B7, B2 and its lost-card clauses over the loopback after its shared-page line; that recipe's trigger row in tools/gate-paths.tsv lists host/link/pump.rs, its tools/box-fill.tsv row says it runs the loopback, and tools/defaults-twins.tsv names the recipe's shared-page line as the loopback pin's twin. tools/spawn-allow.txt holds the relay tests' two threads. docs/contrib/dgx-spark.md: section 1's P5 row and file list, section 9's opening, 9.5 (the impls and item 2), 9.6 (item 3 and what carries to N = 4) and answer 20 describe the relay on the plan the maintainer agreed to in midagedev#127, and 9.6 item 3 records that the maintainer takes it on midagedev#96's structural proof in place of a same-lease A/B. The lines it cites in host/tier.rs and host/link.rs are updated.
…link as generations; a loopback link carries them between two pages on one machine with a host pump A row's go counter is added to by the stage card and taken back by the tier, and its done counter the other way. Across two pages a copy of the writer's absolute value would erase the reader's take back, and a captured wait keeps one fixed target on every replay. So on the loopback each counter is split: on the writer's page only the writing card adds to it (a generation), and for each new generation the pump copies the bytes it publishes to the reader's page (a go: the row's image; a done: the row's routed rows and the tier's fault copy), writes the progress for a done, and then adds one to the counter on the reader's page, where the reading card's wait and take back are the shared page's. The step is checked before anything is published: 0 carries nothing, 1 carries one, and any other step publishes nothing and stops the pump by name, so the host sees the tier behind and the lost tier's detail names the step. The host's progress word on the stage card's page counts the dones carried, so it never runs ahead of their bytes. A release stops its own counter. A reset takes that counter's generations as carried, restarts its tier's progress count from the tier's page and resumes that counter alone, so a counter still released keeps what its writer adds until its own reset; a broken relay stays stopped across any reset. At rest means every generation carried, the reader's counter at 0 and no relay broken. Link::broken also names a pump thread that ended, and the not-at-rest error of a reset's check carries it, as lost_detail does. host/link/pump.rs holds the relay (Relay, Relays) over a Page trait, with four host tests: the step rule across the u32 wrap; two model cards over the pump thread for 2000 goes and dones from a generation near the wrap, then a release, three more layers the cards run with nothing carried, the go's and the done's resets taken apart with the pump running between them, and 2000 more (every go carries its image, every done its rows, the progress counts every done, both counters end at rest); a reset of one counter that leaves another, released, stopped until its own; and a doubled done with raised rows that publishes nothing. Link::new picks the link's kind; the loopback allocates the tier cards' page in the first tier's context and starts the pump thread through threads::helper::spawn_helper, floating, so it never shares a pinned load thread's cpu; TierLayout::crossings lists the counters and their spans. Link::store writes the tier cards' page first. The tier protocol's code is the same over both links. BLOOMERY_TIER_LINK (shared | loopback, unset shared, a mode) picks the link where HostTier::attach_tiers builds the page, through bloomery_levers::tier_link, read below every binary's main. On the shared page nothing changes. weekly-gpu-ds41-lost runs gate_deepseek41_tier's T1, T2, B7, B2 and its lost-card clauses over the loopback after its shared-page line; that recipe's trigger row in tools/gate-paths.tsv lists host/link/pump.rs, its tools/box-fill.tsv row says it runs the loopback, and tools/defaults-twins.tsv names the recipe's shared-page line as the loopback pin's twin. tools/spawn-allow.txt holds the relay tests' two threads. docs/contrib/dgx-spark.md: section 1's P5 row and file list, section 9's opening, 9.5 (the impls and item 2), 9.6 (item 3 and what carries to N = 4) and answer 20 describe the relay on the plan the maintainer agreed to in midagedev#127, and 9.6 item 3 records that the maintainer takes it on midagedev#96's structural proof in place of a same-lease A/B. The lines it cites in host/tier.rs and host/link.rs are updated.
…link as generations; a loopback link carries them between two pages on one machine with a host pump A row's go counter is added to by the stage card and taken back by the tier, and its done counter the other way. Across two pages a copy of the writer's absolute value would erase the reader's take back, and a captured wait keeps one fixed target on every replay. So on the loopback each counter is split: on the writer's page only the writing card adds to it (a generation), and for each new generation the pump copies the bytes it publishes to the reader's page (a go: the row's image; a done: the row's routed rows and the tier's fault copy), writes the progress for a done, and then adds one to the counter on the reader's page, where the reading card's wait and take back are the shared page's. The step is checked before anything is published: 0 carries nothing, 1 carries one, and any other step publishes nothing and stops the pump by name, so the host sees the tier behind and the lost tier's detail names the step. The host's progress word on the stage card's page counts the dones carried, so it never runs ahead of their bytes. A release stops its own counter. A reset takes that counter's generations as carried, restarts its tier's progress count from the tier's page and resumes that counter alone, so a counter still released keeps what its writer adds until its own reset; a broken relay stays stopped across any reset. At rest means every generation carried, the reader's counter at 0 and no relay broken. Link::broken also names a pump thread that ended, and the not-at-rest error of a reset's check carries it, as lost_detail does. host/link/pump.rs holds the relay (Relay, Relays) over a Page trait, with four host tests: the step rule across the u32 wrap; two model cards over the pump thread for 2000 goes and dones from a generation near the wrap, then a release, three more layers the cards run with nothing carried, the go's and the done's resets taken apart with the pump running between them, and 2000 more (every go carries its image, every done its rows, the progress counts every done, both counters end at rest); a reset of one counter that leaves another, released, stopped until its own; and a doubled done with raised rows that publishes nothing. Link::new picks the link's kind; the loopback allocates the tier cards' page in the first tier's context and starts the pump thread through threads::helper::spawn_helper, floating, so it never shares a pinned load thread's cpu; TierLayout::crossings lists the counters and their spans. Link::store writes the tier cards' page first. The tier protocol's code is the same over both links. BLOOMERY_TIER_LINK (shared | loopback, unset shared, a mode) picks the link where HostTier::attach_tiers builds the page, through bloomery_levers::tier_link, read below every binary's main. On the shared page nothing changes. weekly-gpu-ds41-lost runs gate_deepseek41_tier's T1, T2, B7, B2 and its lost-card clauses over the loopback after its shared-page line; that recipe's trigger row in tools/gate-paths.tsv lists host/link/pump.rs, its tools/box-fill.tsv row says it runs the loopback, and tools/defaults-twins.tsv names the recipe's shared-page line as the loopback pin's twin. tools/spawn-allow.txt holds the relay tests' two threads. docs/contrib/dgx-spark.md: section 1's P5 row and file list, section 9's opening, 9.5 (the impls and item 2), 9.6 (item 3 and what carries to N = 4) and answer 20 describe the relay on the plan the maintainer agreed to in #127, and 9.6 item 3 records that the maintainer takes it on #96's structural proof in place of a same-lease A/B. The lines it cites in host/tier.rs and host/link.rs are updated.
What and why
This is item 4 of
docs/contrib/dgx-spark.md§8.9, aLinkseam where the tier page is written and read, with only the shared-page impl; the mirrored region of §8.6 would be a second impl and is not part of this PR. The stage card, each tier card and the host now take the page's device addresses and words fromcrates/gpu/src/host/link.rsinstead of the page'sMappedHost, and every address, value and operation the protocol enqueues or touches is the one it was. Part of #13 (P5's protocol half, started in 6135340457).Where each address comes from now
Linkholds the page's bytes, which today are oneMappedHostallocated in the stage card's context.LinkEndis one side's view of the page: the device address of each byte as that side's launches, copies and stream memory operations take it.Link::stage_end.Link::tier_endwhen it is bound. Its go wait, staging copies (q8_1 and F32), routed-rows windows, fault copy and signal take their addresses from that end. The check inTierCard::bindthat the page sits at the stage card's address in the tier's context moved intotier_endwith the same condition, error and message.Link::word.tools/gate-paths.tsv: theweekly-gpu-ds41-losttrigger row, which listshost/{mod.rs,tier.rs,batch.rs}for the tier card'swait_forandlost_detail, now listshost/link.rstoo, since those read their words there.Code shape
The review reads these first. A box left unticked needs one line of why.
Link::tier_end; it was not copied.TierPage::devis gone, and every device address now comes from aLinkEnd.TierCard.TierPage::devand theMappedHostimport intier.rs.tools/check-comments.shok.)host/link.rs(above), so the same weekly is still named when that code changes.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
This is the move class in
AGENTS.md's table, which asks forjust ptx-scanidentical and the host dispatch's structural lines (graph node count, eager = replay, e2e set identical). I checked the PTX md5 blocks, the graph node counts and the tier clauses' output on base and head. I did not run the e2e set (see "Not run here").Rebased onto main at
bd29e9c9with no conflicts.git range-diffshows the commit unchanged (6d0dc9eais nowf690d6f6), and main has not touchedcrates/gpu/src/host/sinceef641faf. The runs below are on6d0dc9ea. Onf690d6f6I reran onlytools/mac-check.sh checkon the Mac: rc 0, 25 bloomery crates checked or compiled.On a Mac, at
6d0dc9eaBoth passed. The block below is abridged and reformatted: the eleven check-script lines are merged into one, and the timings and long tails are cut.
On a DGX Spark
The PTX scan (1) ran before my last rebase, on base
8fb237f2and a head with the samecrates/tree as6d0dc9ea(bd46915a).8fb237f2'scrates/tree is the same asef641faf's (d75a9407). The gate runs (2) are onef641fafand6d0dc9eathemselves. Base and head were built with the same toolchain in the same container.1. PTX.
BLOOMERY_ARCH=sm_86 just ptx-scan <bin> --features <features> --no-jiton base and head, for the three bins oftools/recipes.py scan-setplusgenerate_ds41andgate_e2e. The scanner refuses sm_121 even with--no-jit, so these are the sm_86 PTX.bloomery-serve-ds41deepseek41,visionf631523a0c390751gate_kquantgpu99b5adffcb8d9ca6gate_swapgpu1d822d0aa255f44cgenerate_ds41gpu,deepseek4108f2485726dad9b6gate_e2egpu127a65e7fe8cdf8eThe ptxas columns are equal too.
2. Structural lines, from the tier loopback with local stand-ins. I used
gate_deepseek41_tier, the V4.1 tier loopback, which puts the expert tier on a secondGpuon the stage's own card, withBLOOMERY_TIER=fixture. As shipped,gate-gpu-ds41-tierstops at exit 66 on this machine:tools/ref/ref-paths.sh:143-147asks for the DSpark fixture draft, which a contributor cannot make (the v41 draft is not fetchable). The bin also reads that draft's header for the tier plan's draft reserve, and it readsengram/corpus-prose.idsfrom$BLOOMERY_DATA, which the published refsets do not carry. So I ran the bin throughtools/box.shlocal mode with four stand-ins, the same on base and head:BLOOMERY_DSPARK_MODELset to a placeholder path. This only gets the run past the draft check inref-paths.sh, which takes a caller's path as given. With the next stand-in, and without--bfeat, the bin never opens it.REAL_K3for the real file. With a reserve of 0 B the GB10's room would put the whole stack of 192 on the tier.x = 6364136223846793005 * x + 1442695040888963407 mod 2^64with seed 20261013, stepped before each id, andid = 1000 + (x >> 33) mod 100000. The command below writes them (sha25627cc28dbcc6521ecc31df2024c8358c74541a3f6ec97a94f1c442d3fc53cc84b).With these stand-ins it is not the owning gate's run, so I do not count
gate-gpu-ds41-tieras green. What the runs show is that base and head behave the same under one set of conditions.The commands, run in a tree with the stand-in patch below applied to
gate_deepseek41_tier.rs, and withBLOOMERY_DATApointing at the published refsets:--union --fault --two --batch --batch2 --bfault: PASSED on base and on head, 13oklines each.--bfirst --blost --lost(the one-card line ofweekly-gpu-ds41-lost): PASSED on base and on head, 9oklines each.The card, printed before each run (the same on base and head):
Head's output with the stand-ins, abridged: I kept the stand-in and plan lines and some of the clause lines, and cut the rest, including the build output. The
P5LOCALlines come from the stand-in patch. First--union --fault --two --batch --batch2 --bfault:Then
--bfirst --blost --lost, abridged the same way:Against the move row's structural lines:
The host's progress read through
Link::wordruns in T1's step, pair and eager settles, and in T3 (--lost) the host also reads it throughTierCard::wait_forfrom the stage wait's error path (host/mod.rs,TIER_GRACE).The stand-in patch to
gate_deepseek41_tier.rs(not in this PR)REAL_K3is the gate's own constant for the real file's depth, 23. The patch also prints oneP5LOCALline for each of these two stand-ins.Not run here
These are what a maintainer would run on the workstation:
gate-gpu-ds41-tieras shipped: the real draft reserve, depth and prompt ids, and--bfeat(B8), which reads the DSpark draft's header.weekly-gpu-ds41-lost, its second line (gate_deepseek41_twocard --lost,BLOOMERY_CARD=both).gate-gpu-ds41-twocard,gate-gpu-glm5next-twocardandgate-gpu-qwen38-twocard. Local mode refusesBLOOMERY_CARD=both(exit 64). These gates run the F32 staging copy (GLM and Qwen3.8 hand the tier F32 activations, V4.1 hands q8_1), and they put a tier on a second physical card, whereLink::tier_endcompares the page's address in two cards' contexts.gate-gpu-e2e, for the e2e set. It needs the V2-Lite file and its ik reference, which I do not have here.python3 tools/recipes.py affected upstream/main --no-boxselects 108 of 154 gate recipes and 1 of 8 weekly recipes (weekly-gpu-ds41-lost, by the trigger row above). It reaches the gate recipes through the dependency walk, since every one of those bins linksbloomery-gpu. I picked the runs above by the move row instead (identical scans plus the structural lines, on the paths this change touches) and did not run the other selected recipes.Docs this makes stale
I left the docs alone. These lines go out of date:
docs/contrib/dgx-spark.md:222and:717citehost/tier.rs:561for the tier page'scuMemHostAlloc. It is nowhost/link.rs:45.docs/contrib/dgx-spark.md:687,:727,:739,:741,:743and:785cite lines 14 to 53 oftier.rs's module doc. That doc is one line longer now. The counter rule that:727cites astier.rs:14-18is now at16-19, since its paragraph was rewrapped. The other cited ranges move down by one (for exampletier.rs:48-53is now49-54).docs/contrib/dgx-spark.md:719says the page sits "behind aLinkseam with two impls", and §8.9 item 4 (:840) and the P5 row (:341) list the seam as open. After this PR the seam exists with one impl.Hardware (if the change is for a machine)
tools/box.shlocal mode. Inside the containernvidia-smireadsNVIDIA GB10, 595.84too. I did not record which libcuda the gate process loaded. The gate kernels were built forsm_86and JIT-compiled on the card. Inputs: the v41 fixture fromfixture fetchand the publishedmidagedev/bloomery-refsets, plus the stand-ins above.rustc 1.100.0-nightly (e457a7b0d 2026-08-27).