Skip to content

placement, gpu-gates: derive independent node budgets from the census - #330

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-p5-load
Oct 16, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-p5-load

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

Refs #127.

What and why

This is the placement half of the engine step in docs/contrib/dgx-spark.md 9.2 and answer 20 in its section 11, the step after #321. The node gate (gate_qwen38_nodes) now builds one independent card machine per node from the census and derives each node's NodeBudget from that machine. Until now the budget code for a remote node existed only as copies inside the nodes_scale tests, and no gate checked that a census reading reached a node's own plan.

Release notes: internal: the node gate plans each node from its own census reading, and plan_node_tiers and the remote budget builder become public so that the engine load can use them next; the load itself is unchanged.

What changes:

  • plan_node_tiers loses its test-only condition, so the gate binary can call it.
  • NodeBudget::routed builds a remote node's budget: routed_only model, zero KV, the remote's own machine. It reuses routed_only, plan_routed and NodeBudget::of. NodeBudget::node is a read-only accessor that the existing node-identity check now uses.
  • The nodes_scale fixtures had six copies of the remote budget branch. They now call one test helper, budget_on, which calls NodeBudget::routed. The independent oracle keeps its own full-model or routed-only choice, so the tests still compare the builder with a separate path. The three-node test census_budgets_keep_each_node_and_stage_terms gives each node a different UUID and free reading and checks its machine, pool and budget.
  • In gate_qwen38_nodes, a new census clause builds the independent machines from the census. Node 0's NodeBudget and Terms come from its full-model plan, and each remote's budget comes from NodeBudget::routed. The clause checks each machine's UUID, free reading and pool against its census spec, and checks that each budget names its own node. On a discrete card it keeps the existing loopback path, and a unified-node input on one must be refused with NotUnified.
  • census_specs is the one function that reads the remote census and the local stage spec. census_plan calls only it, and a test calls it against a closed port, so a gate that stops reading the remote census fails.
  • generate.rs documents that a loopback tier address shares this host's physical pool. The existing loopback test now goes through Place::on_nodes with a fake census server that reports a different UUID and free reading for the remote, and checks that the remote's free bytes are not added to the stage pool.
  • docs/contrib/dgx-spark.md 9.2 and section 10 say what is done and what is left.

What this PR does not do

  • The engine load still builds one machine and one physical pool for loopback tier addresses. No load, kernel, request or token changes, so no timing is claimed.
  • On one Spark the new clause checks the plan inputs. It cannot show where the remote census came from, because both readings come from the same GB10. docs/contrib/dgx-spark.md 9.2 says so.
  • Left for the next PRs: remote load selection and the adapter from routed assignment to loaded rows, node 1's host room in the census with the plan term that reads it, the router counts in the split, and decode at n = N in the predictor. The node plans' card terms use the generic workstation card constants, not the program's machine_for_experts constants; section 10 lists this too.

Code shape

  • No second copy. The remote budget has one owner, NodeBudget::routed. The six copies in nodes_scale call budget_on. The remote census read has one owner, census_specs, and the gate uses the existing node_card reader.
  • Model code holds only architecture facts. No model file changes. The gate takes the Qwen program's rule through accepts::routed_rule.
  • Dead code is gone. An always-true budget length check in the gate was removed. Every API made public has a caller outside the tests: plan_node_tiers and NodeBudget::routed in the gate, NodeBudget::node in the gate and the node planner.
  • No silent failure. A missing budget and a mismatch in census UUID, free reading, pool or budget node are named gate errors. The fake census server reports accept, read, write and join failures, with a 5 second limit on each socket call.
  • Comments state what is true now.
  • No relaxed gate. No band, tolerance, lint level or gate was changed or removed, and no unsafe code was added.
  • cargo fmt is clean: cargo fmt --all -- --check returns 0. The lint result is in the table below.

Duplication found or removed (path:line), or "none": the remote budget branch copied in the nodes_scale fixtures is now NodeBudget::routed (crates/placement/src/placement/nodes.rs:216) behind budget_on (crates/placement/src/placement/nodes_scale.rs:237). The independent oracle in those tests is left as a separate path on purpose.

What I ran

The head is 18661cad. The base is d0e8a8e1. Most rows below ran at 667b7f3a, which differs from the head only in the census fixture's thread in generate.rs (it now starts through threads::helper::spawn_helper); at the head, cargo fmt --all -- --check, tools/check-arch.sh and generate::tests ran again and passed. Unit tests and fmt ran on an RTX 5090 host, and the fixture gate and the placement gate ran on one DGX Spark. Base logs say which commit they ran on.

Check Result
cargo fmt --all -- --check rc 0
cargo test -p bloomery-placement -p bloomery-levers, then cargo test -p bloomery-model arch::qwen35moe::place test result: ok. 40 passed; 0 failed for levers, test result: ok. 134 passed; 0 failed for placement, and test result: ok. 22 passed; 0 failed for the Qwen placement tests
BLOOMERY_BOX_LOCAL=1 BLOOMERY_TIER=fixture just gate-gpu-qwen38-nodes PASSED: gate_qwen38_nodes, clauses: 8 ran, 0 left to the real tier, with 6 unit tests passed. The fixture run uses one card and loopback, so it is not a real-model run and not a two-machine run
just gate-placement rc 101, 6 passed, 5 failed. The base d0e8a8e1 ends the same way, with the same five hw_placement_* tests failing on the missing DeepSeek-V4.1 first shard, so this gate is not shown to pass
FAIL-first: three production-path mutations on the head, each run against the test that guards it, plus one run on the earlier gate source (list below) Each of the 3 mutations fails with rc 101 on an assertion, and the restored tree returns rc 0 after the census_specs mutation and after the two generate.rs mutations. The run on the earlier source stays green, rc 0
LC_ALL=C just contrib-check --tier t0 DONE tier=t0 total=84 red=2. One red step is check-arch, which the base does not have: crates/gpu-gates/src/generate.rs: 1 spawn(s), not in tools/spawn-allow.txt (use threads::helper::spawn_helper). It was the fake census server's thread in the new test; the head starts it through spawn_helper and tools/check-arch.sh passes there. The other red step is check-recipes, which the base shows too (DONE tier=t0 total=84 red=1): a --v41-queue self-test fails there, and the base fails the same way
Lint (just mac-static) still running on the card when this was posted; the result goes into this description when it ends
just affected gates against d0e8a8e1, with the base run beside them still running on the card when this was posted; the result goes into this description when it ends
just canon-check and ptx-scan not run. The change touches no kernel, launch or copy code
gate-gpu-qwen38-nodes against the real Qwen3.8 model not run, because the model shard is not on the contributor machine

FAIL-first mutations. The first three apply to the head's production code, the fourth to the earlier source:

Mutation Guarding test
In census_specs, the remote census read is replaced by the local stage spec the gate's closed-port test, which fails with no local census replaces the remote
In Place::on_nodes, the remote census is read but the stored spec is the stage's the loopback test's specs[1] == remote_spec check
The loopback plan adds the remote's free bytes to the stage pool the loopback test's pool comparison (150 GiB against 90 GiB)
On the gate source before census_specs, census_plan stops reading the remote census (not a head mutation) no test failed: the earlier gate test stayed at rc 0. This is the gap that census_specs and its closed-port test close

What I ran into

None of this blocks the PR.

contrib-check --tier t0 also shows check-recipes red on both the head and the base, and just gate-placement ends the same way on both, so the branch adds no red step there.

The loopback clause cannot tell a real remote census from a copy of the local one on a single Spark. A test that fakes the census server, the closed-port test and the mutations above cover the code paths, and a two-machine run would cover the rest. That run is not part of this PR.

The node plans in the clause use the generic workstation card constants. The program's machine_for_experts constants differ, and section 10 lists the difference as work left.

An earlier version of the new three-node test compared a budget's pool with the raw free reading and failed. Plan::pool_need adds the CUDA context cost back to the free reading, so the test now compares against that owner.

Hardware (if the change is for a machine)

Unit tests and fmt ran on an RTX 5090 (NVIDIA GeForce RTX 5090, 595.99.02, 12.0 in nvidia-smi). The fixture gate and the placement gate ran on one DGX Spark (NVIDIA GB10, 595.84, 12.1). These are pass and fail results, not timings.

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 needs-gpu Changes code a card must check, and carries no gate run on a card placement Placement planning: crates/placement 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 behavior failure or proven quality defect survives review.

Non-blocking

⚠ Exercise the census clause itself: gate_qwen38_nodes.rs:1417 calls only census_specs.
Replacing the call in census_plan at line 553 with local specs leaves this test green. The one-card clause then compares machines against those substituted specs.
Exercise census_plan with fixture inputs and assert the remote connection error.

Checked

Duplicates: 7 new functions checked by grep; none duplicated. The moved NoKv and exposed APIs reuse existing definitions. Dryer reported 0 pairs; gpu-gates was checked manually.
Complexity: crapper flagged census_plan, 8 → 26. Existing orchestration gained census and budget validation branches; budget construction reuses NodeBudget.
Silent failure: 2 new sites followed. NotUnified is an expected rejection; a discarded fixture-channel send cannot produce a successful test because join and receive are checked.
Tests: static mutation review. Dropping the routed-only filter or adding KV breaks the budget oracle; copying the local spec or summing loopback pools breaks the fixture assertions. Skipping the remote read inside census_specs fails its test on a working card; bypassing its caller remains uncovered as above. Updated remote fixtures preserve zero-KV planning.
Gates: no threshold, band, tolerance or gate removed or relaxed; no PIN change required.
Adversarial checks: distinct remote UUID/free readings, discrete cards, missing census, missing budgets and integrated specs without a free reading reach checks or named errors. No token-dependent hot path or unsafe block changed.
Escape catalog: no C1–C4 pattern matched. No ledger lessons apply.

Notes

Static review only; runtime tests were not rerun. The PR leaves lint and affected-gate results pending. Its card-run evidence omits the fixture model file path.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_qwen38_nodes.rs, crates/gpu-gates/src/generate.rs, crates/gpu/src/host/node.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 8dc9ccc 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 needs-gpu Changes code a card must check, and carries no gate run on a card placement Placement planning: crates/placement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants