Skip to content

gpu, verbs, levers, gpu-gates: a tier node on another DGX Spark binds its own RDMA end, and Qwen3.8 decodes across two Sparks - #358

Merged
juliankang4 merged 3 commits into
midagedev:mainfrom
juliankang4:dgx-spark-p5-n2
Oct 16, 2026
Merged

juliankang4 merged 3 commits into
midagedev:mainfrom
juliankang4:dgx-spark-p5-n2

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

Part of #53 (P5, on the plan in #127).

What and why

With this PR, node 0 (the Spark that runs the stage card and the request) decodes Qwen3.8 while its routed-expert tier lives on a second DGX Spark, node 1, reached over one direct RoCE link. This is the N = 2 run that the P5 row of docs/contrib/dgx-spark.md listed as left. A tier node could only be on the same host before, because both processes mapped one /dev/shm page and BLOOMERY_TIER_NODES took loopback addresses only. Now a node at a private IPv4 address binds its own page and RDMA end, and the two ends exchange their endpoints on the existing control channel.

In one sitting, the same plan ran with the tier on node 0's own card (A, one Spark) and on node 1's card (B, two Sparks), alternated A1 B1 A2 B2. The output tokens, the full histories with logits and every layer's split are byte-identical across all four runs. A two-Spark token costs 1 control round trip and 48 go/done pairs over RDMA; a go/done pair is one tier layer's handoff from the stage to the tier and back. "Comparison with the reference" below has the match table, and "Qwen3.8 on two DGX Sparks" has the speed.

Release notes: Added: a tier node at a private IPv4 address on another machine serves its expert tier to node 0 over RDMA (BLOOMERY_TIER_NODES with BLOOMERY_TIER_LINK=rdma), and Qwen3.8 decodes across two DGX Sparks with the same output as on one.

What changes

The three commits each hold one contract.

  1. gpu, verbs: bind a tier node through its own RDMA end (c9d12df1d). An RDMA bind gives each process its own page (Link::remote). Node 0 opens an RdmaEnd on the RoCE port whose IPv4 GID matches the control socket's local address (bloomery_verbs::roce_v2_at) and sends its queue pair's endpoint in the Bind request; node 1 replies with its own. Each end carries only its tier's crossings and holds its own page, queue pair and pump. A reset runs in three phases with a control reply after each (stop both ends, reset both writers, then both readers) under a new Reset tag. A refused replay or a tier drain releases the remote reader's waits first, through a separate non-resetting Release request, so the server is never left waiting on a stream that cannot finish. If the RDMA release cannot settle, the session keeps the work it still owns and returns the error instead of freeing live device buffers. A malformed Bind is refused with a shape error. None of this runs on a successful token: the success path gains no launch, copy, synchronization or request. The protocol version goes from 3 to 4, so a node of the other version is refused by name. A shared-file bind is accepted only on a loopback connection. BLOOMERY_TIER_LINK=loopback with a node tier, and an RDMA node page that would also carry a local tier, are refused by name. Node 0 counts the completed control round trips to each tier node.
  2. levers, gpu-gates: select private tier nodes from their census (17be6d9a4). BLOOMERY_TIER_NODES and tier_server --listen take loopback or private IPv4 addresses (bloomery_levers::tier_ip). A node off this host requires BLOOMERY_TIER_LINK=rdma, and the lever is refused by name without it. The control channel still has no authentication; the lever's help text and docs/contrib/dgx-spark.md say it belongs on a trusted network. The docs map (the P5 row, 9.5 and section 10) now describes the RDMA bind and what is left.
  3. gpu-gates: compare decode on local and node expert tiers (02e4b73dc). gate_qwen38_nodes --decode0 <gib> <tokens> <out> plans under a fixed card budget, decodes greedily and writes the run to <out> for a byte comparison. It prints the plan's read terms, each tier's go and done wire bytes, the routed hits before and after the timed tokens, the control round trips a token and the go/done pairs a token. TierLayout::wire_bytes gives one row's go and done post bytes, generation words included. Three cards in docs/cards/ state what the two-Spark sitting measures: node-decode (control round trips a token), node-link-bytes and node-small-link (the link's byte and small-message ceilings).

What this PR does not do

  • The load does not use the second Spark as independent capacity. The plan still charges node 1's card bytes to node 0's pool (the conservative single-pool bound), and the adapter from a routed assignment to the rows each node loads is not written. The two-Spark run therefore has the same split as the one-Spark run, and no model or context larger than one Spark can plan is shown.
  • It runs Qwen3.8 only. GLM and DeepSeek-V4.1 do not run across nodes here.
  • It runs N = 2 only. N = 3 and N = 4 are not run.
  • It is not HTTP serving. The run is the gate binary's greedy decode of one request.
  • It claims no speedup. node-decode is a profile card: it counts control round trips, and the decode times are reported beside the count.

Qwen3.8 on two DGX Sparks

These numbers were measured on e009f1e3da353019cb890f86321c83f0e45180f8 (base ce1c310ff39080bd4ef885447737cab426e06ff5) and are carried to this head, not re-measured. The host and verbs source is identical between the two heads, and the later changes add nothing to a successful token (range-diff in the evidence folder). Both arms ran Qwen3.8-Flash-Next UD-Q4_K_XL with a 32-token prompt, context 3072 and a 45 GiB card budget. Each run was a fresh process load, then 32 stepped warm tokens and 64 timed greedy tokens. Arm A is one Spark: one process with the stage and the expert tier on its card (BLOOMERY_TIER_LINK=shared). Arm B is two Sparks: the stage on node 0, the tier on node 1 under tier_server, one process on each card, BLOOMERY_TIER_LINK=rdma. The order was A1 B1 A2 B2 in one sitting under tools/ref/lease-hold.sh --card docs/cards/node-decode.card on both Sparks.

Run Sparks 64 timed tokens tok/s Read ceiling, tok/s [derived] Fraction of the ceiling [derived] Control round trips a token go/done pairs a token
A1 one 3.152 s 20.31 38.66 0.525 0 48
B1 two 2.877 s 22.24 43.94 0.506 1 48
A2 one 3.119 s 20.52 38.66 0.531 0 48
B2 two 2.865 s 22.34 43.94 0.508 1 48

The read ceiling is the plain-read rate a card reached in the same sitting divided by the bytes the plan reads a token. The plan reads 6,373,736,000 B a token [derived]: the serial bytes, each layer's shared bytes and 10 routed experts a layer, from the decode read terms line. On one Spark, node 0's card reads all of it at its best plain stream read of the sitting, 246.4 GB/s. On two Sparks, the routed hits put 766,321,600 B of each token on node 1 (242.9 GB/s) and 5,607,414,400 B on node 0 [derived], and the slower card sets the ceiling. Both arms reach about half of their ceiling.

The card predicted 1 to 4 control round trips a token; the two-Spark runs counted 64 round trips in 64 tokens, and the one-Spark runs 0. Both arms hand off 3072 go/done pairs in 64 tokens, one pair for each of the 48 tier layers; in B these cross the RDMA link. One pair is 41,220 B of go and 409,612 B of done, so a token sends 21,639,936 B [derived]. At B's rate that is 0.48 GB/s [derived], 3.5% of the 13.59 GB/s byte ceiling that link_probe --size 33554432 measured on the same link in the same sitting (one-way p50 2469.03 us) [derived].

In all four runs the tier held 12627 experts (39572172800 B), every tier layer was sent a routed slot, and the tier's chains were captured 4 times and replayed 82 times.

Comparison with the reference

The reference is the one-Spark plan of the same build: arm A above, on the measured build e009f1e3da353019cb890f86321c83f0e45180f8. The same binary, model, budget and plan ran with the tier on node 0's card (A) and on node 1's card over RDMA (B), alternated A1 B1 A2 B2, and after the four runs the sitting compared their files byte for byte.

Item Matches Allowed Result
Output token streams of A1, B1, A2 and B2 all four byte-identical byte-identical PASS
Full histories including logits all four byte-identical, one sha256 1b44bc645313e239 byte-identical PASS
Each layer's stage and tier split all four byte-identical byte-identical PASS

Serving the expert tier from the second DGX Spark changed no output byte: the token streams, the full histories including logits and every layer's split are byte-identical across the four runs.

Code shape

  • No second copy. The shared-file Bind payload has one writer, write_file_bind, which the node client, its test and gate_qwen38_nodes share. The RDMA bind reuses the existing RdmaEnd, and roce_v2_at shares one search with first_roce_v2.
  • Model code holds only architecture facts. No model file is touched, and the common tier code gains no per-model branch.
  • Dead code is gone. I found nothing left unused when reading the diff; just lint, which reports unused code, is still running.
  • No silent failure. A non-IPv4 RoCE port, a public or unspecified address, an off-host node without RDMA, an invalid endpoint, a shared-file bind off loopback and a step during an incomplete reset are named errors.
  • Comments state what is true now. tools/check-comments.sh runs in t0, which is still running.
  • No relaxed gate. No band, tolerance or lint moved. The new --decode0 budget range applies to that mode only.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up. just lint is still running.

Duplication found or removed (path:line), or "none": none.

What I ran

The head is 02e4b73d, three commits on upstream/main b9808a65. The checks below the first table row group marked e009f1e3 ran on that earlier build of the same three contracts; the refusal and reset checks ran on the final head. Everything ran in the bloomery-dev:cuda13.3.1 container on two DGX Sparks.

Check Result
cargo oxide build --arch sm_121 -- -p bloomery-gpu-gates --features gpu --release --bin tier_server --bin gate_qwen38_nodes --bin link_probe, on both Sparks rc 0 on both
FAIL-first: TierLayout::wire_bytes without the generation word, then BLOOMERY_ARCH=sm_121 bash tools/gate.sh --oxide -p bloomery-gpu --release --lib -- keeps_its_fields_apart rc 101 at an assertion
The same test on the head test result: ok. 3 passed; 0 failed
BLOOMERY_ARCH=sm_121 bash tools/gate.sh --oxide -p bloomery-gpu --release --lib -- host::tier test result: ok. 8 passed; 0 failed; 1 ignored
BLOOMERY_ARCH=sm_121 bash tools/gate.sh --oxide -p bloomery-gpu --release --lib -- host::node test result: ok. 5 passed; 0 failed
target/release/gate_qwen38_nodes on the Qwen3.8 fixture, node 1 over loopback as a second process on one Spark (not timed) clauses: 8 ran, 0 left to the real tier and PASSED: gate_qwen38_nodes; 98 tokens, 98 logits rows bit for bit the reference's
The two-Spark sitting above, gate_qwen38_nodes --decode0 45 64 under lease-hold.sh on both Sparks rc 0 on both Sparks; the comparison above
FAIL-first on the refusal fixes (drain before release, panic on an unsettled release, unknown Bind mode accepted), then tools/gate.sh --oxide -p bloomery-gpu --release --lib -- host::tier host::node on 505548c8 the three planted defects fail; 10 tier and 6 node tests pass (GPU source identical to this head)
Two DGX Sparks, refusal then one reset and an immediate decode, on 02e4b73d (two earlier mutants on ebf63f2e: no release request and early drain, both rc 101) rc 0; the next token and full logit row are bit-identical to a fresh session
just lint Still running on the DGX Spark when this was posted; the result goes into this description when it ends.
just contrib-check --tier t0 Still running on the DGX Spark when this was posted; the result goes into this description when it ends. It runs cargo test -p bloomery-levers, which holds the new remote_nodes_require_private_addresses_and_rdma.

To reproduce the sitting, build at this head on both Sparks, then run each arm inside bash tools/ref/lease-hold.sh --card docs/cards/node-decode.card -- ... on each Spark. <model> is Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf and <node1> is node 1's RoCE IPv4 address.

# Arm A, node 0 only
BLOOMERY_DATA=<data> BLOOMERY_REF_MODEL=<model> BLOOMERY_TIER_LINK=shared \
  target/release/gate_qwen38_nodes --decode0 45 64 A1.run

# Arm B, node 1 first
BLOOMERY_DATA=<data> BLOOMERY_REF_MODEL=<model> target/release/tier_server --listen <node1>:<port> -m <model>
# then node 0
BLOOMERY_DATA=<data> BLOOMERY_REF_MODEL=<model> BLOOMERY_TIER_LINK=rdma BLOOMERY_TIER_NODES=<node1>:<port> \
  target/release/gate_qwen38_nodes --decode0 45 64 B1.run

# After A1 B1 A2 B2
sha256sum A1.history.run B1.history.run A2.history.run B2.history.run

What I ran into

None of this blocks the PR.

  • Loading took longer with the tier on node 1: 171.8 s and 173.3 s for B against 63.6 s and 51.9 s for A. The timed region starts after the load, so the table above does not include it. I did not break the load time down.
  • Both arms reach about half of their read ceiling (0.525 and 0.531 on one Spark, 0.506 and 0.508 on two), and the link's payload is 3.5% of its byte ceiling. I read that as most of the gap lying off the link. This PR does not look for where it is.

Hardware (if the change is for a machine)

Two DGX Sparks, each reported by nvidia-smi as NVIDIA GB10, 595.84, 12.1, aarch64 Linux, in the bloomery-dev:cuda13.3.1 container. One direct RoCE link joins them (rocep1s0f0 on node 0, rocep1s0f1 on node 1, RoCE v2 GID index 3). In the same sitting a 64 B message took 3.43 us one way at p50, and a GPU-played full-image round trip took 32.32 us at p50. Plain stream reads were 246.4 and 243.8 GB/s on node 0 and 241.6 and 242.9 GB/s on node 1, before and after the runs. No other GPU process ran before or after, and each phase started after 30 seconds with a load average below 1.

AI help

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

@github-actions github-actions Bot added dgx-spark The DGX Spark (aarch64, GB10) port 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 needs-gpu Changes code a card must check, and carries no gate run on a card tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo labels Oct 16, 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 reachable behavior failure or proven quality defect survived review.

Optimization headroom

  • E. Less work: crates/gpu/src/host/tier.rs:609, remote crossings retain the page's full column capacity during single-column decode. Transfer only the active columns using the existing chain width. For Qwen3.8 with four-column pages, 10 slots, hidden size 2560 and 48 tier layers, the routed-row saving is 4 × 3 × 10 × 2560 × 48 = 14,745,600 bytes/token [derived], before activation savings.

Checked

Duplicates: node.rs:814/885 sends different protocol requests; replacing these short wrappers adds elements.
Complexity: Session::handle adds Bind/reset/release dispatch; measure adds decode planning/readback/reporting. Complexity alone does not establish a defect.
Silent failure: node.rs:1255 reads progress after both bind implementations set the page and layout. Release failures return named errors and retain unsettled work.
Tests: source assertions cover Bind encoding (node.rs:584), endpoint bounds (:607), reset/Bind guards (:1217/:1253/:1262), retention (:1464), release-before-drain (tier.rs:1351), generation bytes (:512), and RDMA/private-IP validation (levers/src/lib.rs:736/:2604). The remote replay test checks Release/reset request counts and recovered token/logit equality. tier-cost.py:110 tests a missing hits_after field. No tests were run during validation.
Gates: no numeric tolerance or lint level moved. The removed private-address rejection has a dated PIN and replacement validation.
Escape catalog: C1–C4 do not apply to the retained advisory. No ledger lessons were in force.
Adversarial checks: malformed endpoints, interrupted resets and failed releases have named refusals. Decode token limits respect the context boundary.

Notes

The PR supplies the card line, hashes and direct binary/tools/gate.sh results, but no just gate-* command with its output. gpu.json therefore records evidence=false. The PR still lists lint and t0 as running.

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

@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 3b11b16 into midagedev:main Oct 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dgx-spark The DGX Spark (aarch64, GB10) port documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app gpu-verified host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset needs-gpu Changes code a card must check, and carries no gate run on a card tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants