Skip to content

gpu, placement, gpu-gates: a tier node on a second DGX Spark pages its experts from its own NVMe, and Qwen3.8 keeps its output - #411

Merged
juliankang4 merged 9 commits into
midagedev:mainfrom
juliankang4:dgx-spark-p5-node-nvme
Oct 17, 2026
Merged

juliankang4 merged 9 commits into
midagedev:mainfrom
juliankang4:dgx-spark-p5-node-nvme

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

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

What and why

A second DGX Spark can serve explicitly assigned routed experts from its own file and page them through its own host room and NVMe arena. The assignment is lowered into file-backed rows before node 0's host-memory split, so remote weights and tier overhead do not consume node 0's pool. Existing resident GPU assignments keep their device executor and do not enter the host split.

The comparison uses the same build's local CPU tier as the oracle, with the same expert ranges and Qwen3.8 history. On one DGX Spark, the loopback node matches the local tier's token ids, logits bits and stage graph counts.

Release notes: Added: a tier node on another DGX Spark can own routed experts by explicit id range and page them from its own NVMe, with Qwen3.8 output unchanged from the local CPU tier.

What changes

The NVMe request carries host room, planned and granted arena bytes, and assigned overhead. The connection and device identify its destination; the payload carries no second node ordinal.

NodeOpen::project selects host execution only from explicitly file-backed rows. It clears an earlier projection before checking the assignment. An unpaged host assignment still uses the CPU executor. The node reconstructs its host/NVMe split against its own room and grant; attention and row tables stay on node 0. Both reconstruction paths include the OS reserve that HostNeed later deducts. The protocol version is 5 at both ends.

PlanInputs::plan_nodes makes a stage-only seed, lowers the explicit global-id ranges, then applies the row-table and expert splits. File-backed ranges are built directly. Only the stage's kept prefix needs a GPU upload format, so IQ3_XXS, IQ4_XS and IQ4_NL still plan when the stage keeps no expert. The original tier and device validation still runs. Remote host tiers have zero stage-device allocations and KV entries, and do not inherit a resident-card capacity check. Pool-accounting tests give the remote tier nonzero scratch so an accidental charge is visible.

The server refuses missing or repeated routed stacks before it hashes or loads the assignment. The local host loader shares that row-set check. A set may exclude host-only layers at either end and keep empty rows in its interior.

The local and remote CPU tiers share the host expert executor and Qwen history, including the 2, 3 and 4-column verification chains. A local CPU tier leaves the worker pool available while its step port waits. Resident GPU tiers and separate-process tiers keep the parallel wait. Unsupported prompt blocks remain named errors. A failed CPU callback stays latched. Both ordinary and bounded fault clearing return its stored cause. A settled reset requires reloading the failed executor.

just gate-gpu-qwen38-nodes --host runs the host-mode gate through the existing recipe, which now forwards optional arguments. It checks remote NVMe fills, graph shape, capture/replay counts and the existing routing precondition. The removed resident-weight clause has a dated PIN explaining why a host executor has no device weights. No CUDA kernel or expert arithmetic is added.

--host --decode0 is refused by name before opening the model or card: --host is not supported with --decode0; use --history. The parser contract checks every mode with and without --host. The wire contract checks the exact NVMe budget payload, independently of the round-trip reader.

Node 0's open deadline counts the file data the node reads. A HostFile row has zero resident bytes, but the node still hashes and loads its assigned file data before answering. open_bound takes, for each row, the larger of its assigned file bytes (the listed experts' share of the file, or the whole file) and its resident bytes. The 120 s base and the 100 MiB/s rate are unchanged. Invalid or overflowing sums are named errors. The protocol contract checks an expert subset, a whole file, a larger resident upload and invalid sums.

What this PR does not do

  • It adds no HostResidency or HostSet integration for mmap rows.
  • It adds no GLM or DeepSeek-V4.1 node adapter. Only the Qwen3.8 adapter runs here.
  • It does not choose nodes automatically.
  • It claims no speed. Buffered reads into an anonymous arena do not establish cold-drive traffic, sustained NVMe bandwidth, O_DIRECT, a pinned arena or a process RSS limit.

Comparison with the reference

Both paths used build 4f56cfef, the same expert ranges and the same history on one DGX Spark. The prompt is the first 32 ids of the same head's README, encoded by the model's tokenizer; the gate then runs its greedy steps and 2, 3 and 4-column verification chains.

Execution path Token/logit rows Result
Local CPU tier oracle 98 Reference
Loopback file-backed node 98 Bit-identical token ids and logits

The stage graph counts also match: [1343, 1427, 1427, 1427].

The node owns 12288 expert instances against 4671 in the conservative resident-tier plan, with 0 B charged as resident tier weights. The node tier made 3025 NVMe fills reading 9500057600 file bytes. Its four graphs hold 481 nodes each. Its chains were captured 4 times and replayed 82 times. This is a loopback functional comparison, not a two-machine timing or RDMA check.

What I ran

The submission head is f04179496f87fa38aeb1788cfe5f9240ece6c55f, nine commits based on 8e05ce8f28f115450902a8214047b543bc1d97df. The hardware results below were measured at 4f56cfef396c5911f9ca88b33f7ce6342ba14890 and carried forward: the intervening rebases and checker fixes leave the Qwen node runtime path unchanged. The fixture now takes routed stack names from the model's architecture owner. The thread registry names the scalar-wait test's helper, and the defaults registry records why the host gate pins 20G: the machine's default room can hide paging. The node gates include the stopped and killed-node loss/drain checks.

Check on 4f56cfef Card Result
CPU budget and CUDA callback contracts GB10 and RTX 5090 2 passed per card
Node protocol CPU contracts GB10 and RTX 5090 3 passed per card; 1 separate hardware case not selected
just gate-gpu-qwen38-nodes GB10 7 unit tests passed, 1 hardware test ignored; all 8 full-gate clauses pass with 0 deferred
just gate-gpu-qwen38-nodes --host GB10 7 unit tests passed, 1 hardware test ignored; all 8 full-gate clauses pass with 0 deferred
just gate-gpu-qwen38-nodes --host RTX 5090 7 unit tests passed, 1 hardware test ignored; all 8 full-gate clauses pass with 0 deferred
Real CLI, nonexistent model RTX 5090 Host decode refused; 48 diagnostic combinations preserve the shared diagnostic exit; 113 competing, repeated or misplaced mode shapes refused by usage

Before the fixes, or with the earlier reserve/reset defects restored, each contract below exits 101. The hardware runs above used the unmodified measured tree.

Defect present Contract Result
Host decode accepted host_modes_never_ignore_the_requested_tier FAIL, host decode must be refused
Unused node ordinal retained messages_read_back_as_written FAIL, NVMe budget wire prefix differs
OS reserve omitted node_nvme_host_budget_keeps_the_os_reserve FAIL, zero room accepted and assigned need lost
Callback reset checks omitted hw_held_node_nvme_host_run_keeps_eager_and_captured_rows FAIL, both resets return success

On f0417949, bash tools/check-arch.sh and python3 tools/check-defaults.py check both pass on Linux. Both checks failed before the checker fixes. The synthetic host-budget contract and scalar-wait contract each pass on the new head, using bash tools/gate.sh --oxide -p bloomery-gpu --release --lib -- <test-name> --nocapture on a DGX Spark. Full contrib-check has not run on this head.

The hardware checks use loopback. I did not run a physical two-Spark RDMA check on this head. The broad affected-gate union, the repository-wide format check, lint and comment checks have not run on the submission head.

To reproduce the functional comparison, set BLOOMERY_REF_MODEL to the first shard of Qwen3.8-Flash-Next UD-Q4_K_XL, BLOOMERY_DATA to a writable test-data folder and BLOOMERY_LOCK_DIR to the machine's shared gate-lock folder. The gate owns the loopback server and compares it with the local tier.

set -euo pipefail
mkdir -p "$BLOOMERY_DATA/qwen4exp" "$BLOOMERY_LOCK_DIR"
cargo build --release -p bloomery-tokenizer --bin bloomery-tokenize
target/release/bloomery-tokenize -m "$BLOOMERY_REF_MODEL" -f README.md --no-bos --no-parse-special --ids |
  python3 -c 'import json,sys; print(*json.load(sys.stdin), sep="\n")' > "$BLOOMERY_DATA/qwen4exp/corpus-prose.ids"
export BLOOMERY_ARCH=sm_121 BLOOMERY_THREADS=8 BLOOMERY_NVTIER_BYTES=12G
export BLOOMERY_NVTIER_READ=buffered BLOOMERY_NVTIER_MEM=anon
export BLOOMERY_BOX_LOCAL=1 BLOOMERY_BOX_CARD=local BLOOMERY_MODEL=qwen4exp
export BLOOMERY_GATE_V41_LOAD=1 BLOOMERY_GATE_BOUND=1800
bash tools/gate.sh --oxide -p bloomery-gpu --release --lib -- host::tier_cpu::tests --include-ignored --nocapture
bash tools/gate.sh --oxide -p bloomery-gpu --release --lib -- host::node::tests --nocapture
just gate-gpu-qwen38-nodes
just gate-gpu-qwen38-nodes --host

Code shape

  • No second copy. Projection, splitting, grants, expert arithmetic and page copies reuse their existing owners. host_tier also owns the resident-capacity boundary. No new RPC operation is added.
  • Model code holds only architecture facts. The Qwen3.8 host constructor carries architecture facts. The common tier code gains no per-model branch.
  • Dead code is gone. The unused NVMe node ordinal and its projection argument are removed. The remaining added fields have execution, placement or validation consumers. Lint has not run on the submission head.
  • No silent failure. Invalid assignments, tiers and devices remain named errors. A failed projection cannot retain an earlier host plan.
  • Comments state what is true now. The required gate PIN is present; the comment check has not run on the submission head.
  • No relaxed gate. No band or tolerance moved. The removed resident-weight clause has its dated reason and host paging/graph coverage.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up. The changed Rust files were formatted with rustfmt. Clippy has not run.

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

What I ran into

These implementation problems are fixed and do not block this PR. Checks not run are listed above.

  • Planning the resident tiers before lowering could reject an explicit assignment before it was applied. The regression covers a stage that fits every expert, a stage that fits none, and a unified pool that fits only after remote ownership is excluded.
  • A host tier also inherited the resident card's capacity check. The same ownership predicate now excludes it from that check and both pool-accounting paths.
  • Constructing remote file-backed ranges through the resident upload builder rejected IQ formats when the stage kept no expert. The lowering owner now validates GPU formats only for its resident prefix. The same contract checks local file-backed spill bytes and unchanged row metadata.
  • Row-table bytes reserve node 0's host room before the expert split. The lowering contract checks that reserve as well as the placement.
  • A discrete-card projection omitted the OS reserve before HostNeed subtracted it. In the synthetic A6000 case, 53,451,264 B of assigned experts were hidden by a 6,694,629,376 B OS deduction. Both projection paths now preserve the assigned need and refuse zero host room.
  • A callback error survived a successful reset. The regression now requires both fault-clearing paths to return the stored error.
  • The default corpus was absent on the test host. The reproduction commands above make a corpus with the submitted README and the real model tokenizer. No replacement token ids or downloaded model were used.

Hardware (if the change is for a machine)

The comparison table uses one DGX Spark, NVIDIA GB10, driver 595.84, aarch64 Linux, with sm_121 builds in the CUDA 13.3.1 development container. The additional discrete-card checks use an RTX 5090, driver 595.99.02, x86_64 Linux, with sm_120 node-gate builds. Both have the same Qwen3.8-Flash-Next UD-Q4_K_XL model in four local shards. The node gates use loopback.

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 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 Oct 17, 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 proven behavior or quality defect remains in the changed code.

Non-blocking

⚠ Supply reproducible GPU evidence: crates/gpu-gates/src/bin/gate_qwen38_nodes.rs:1683.
The body reports runs on 4f56cfef; the reviewed head is ba275e0e.
Attach current resident and --host gate output, the nvidia-smi card/driver line, both commit hashes and the model path. This verifies the final callback and protocol paths before merge.

Checked

Duplicates: 38 added declarations checked against existing owners; no actionable duplicate. Dryer reported zero pairs; gpu-gates was checked by hand.
Complexity: new run_history (24) handles plan selection, capacity and history; new lower_routed (22) handles validation, row rebuilding and totals. Existing branch growth covers open_tier, NodeOpen::read, open_bound, parse_args, card_heaps, NodeCensus::read, rows_on, run, symlink_bind, attach_tiers, Session::handle, totals and violations_beside. The growth adds assignment validation and executor dispatch; complexity alone supplies no finding.
Silent failure: seven default, sentinel and clamp sites followed. Resident fill counters remain zero; HOST slots retain their rows; clamps bound room, grants and ownership; callback failures remain latched and poison outputs.
Tests, static mutation review: accepting host decode fails the parser assertion; restoring pooled waiting fails the scalar-wait contract; omitting the OS reserve fails the budget assertions. Wrong slot translation, skipped refills, freed callback storage and cleared callback errors fail the CPU contract. Removing remote ownership or pool exclusions fails the placement contracts. Missing/repeated stacks, invalid arena grants and resident-only open deadlines fail the protocol assertions. The remote replay test still checks reset exchanges and recovered logits.
Gates: the removed resident-weight requirement and increased unsafe counts have dated PIN reasons; no tolerance moved.
Adversarial checks: missing stacks are refused; pending callbacks retain storage; host-room shrinkage is checked against the arena floor; empty interior layers remain valid.
Escape catalog: no C1–C4 pattern matched.

Notes

Static review only. Builds and hardware gates were not executed.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_qwen38_nodes.rs, crates/gpu-gates/src/bin/shared/q38_history.rs, crates/gpu-gates/src/bin/tier_server.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 814b246 into midagedev:main Oct 17, 2026
6 checks passed
@juliankang4

Copy link
Copy Markdown
Collaborator Author

Reran the recipes on the reviewed commit, ba275e0ee164ff59025e8bcedf1069ee3302d293. The earlier body cited 4f56cfef396c5911f9ca88b33f7ce6342ba14890.

Model: /models/Qwen3.8-Flash-Next/UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf.

One DGX Spark, built for sm_121 in the CUDA 13.3.1 development container. Card and driver (nvidia-smi --query-gpu=name,driver_version --format=csv,noheader):

NVIDIA GB10, 595.84

just gate-gpu-qwen38-nodes completed with rc 0:

clauses: 8 ran, 0 left to the real tier (deferred(real) lines above)
PASSED: gate_qwen38_nodes
GATE resident rc=0

just gate-gpu-qwen38-nodes --host produced these results before it was stopped:

[node 0] paging: host tier true, NVMe fills 3025, file bytes 9500057600: PASS
ok node 0 and node 1: 98 tokens, 98 logits rows bit for bit the reference's

The host run was interrupted during the stopped-node fault case, after the history comparison. It did not reach its final summary or return a gate exit code; the supervising command ended with rc 143. This is partial host evidence, not a full host-gate pass.

Both paths use a loopback tier server on one card. This was not a physical two-Spark RDMA run.

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 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.

2 participants