Repository navigation
placement: cap the NVMe tier room at the unified pool - #716
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: No behavior or quality defect survived the placement accounting checks.
Checked
Duplicates: 10 new functions checked; no duplicate owner or unneeded item. The model tests exercise distinct caller paths. The reserve helper serves both planning paths.
Complexity: The production changes replace inline accounting, restore one reserve call, and add room caps; the new helper has one branch.
Silent failure: 1 fallback followed. An absent unified pool supplies an unbounded cap. Both reserve overflow paths return named Metadata errors before changing totals or headroom.
Tests: Static mutation checks cover all 10 new or changed tests. Removing either cap at crates/placement/src/placement.rs:3885 breaks the room test; restoring the uncapped room breaks the six model caller regressions. Wrapping arithmetic at crates/placement/src/placement.rs:3859 breaks the overflow assertions. Dropping the reserve call breaks the GLM trunk or node regression. Counting the reserve twice breaks the changed GLM test's independent physical-total assertion. Removing the refusal at crates/model/src/arch/place_hybrid.rs:317 makes the Solar test fail.
Gates: Exact-fit acceptance and one-byte-short refusal remain asserted. The changed GLM refusal has a dated PIN, a reason, and author-reported FAIL-first evidence. No tolerance or band moved.
Adversarial paths: Checked oversized host readings, context costs, local versus remote card reserves, overflow, and machines without a unified pool. The caps, ownership filter, checked arithmetic, and existing refusal paths block the constructed failures.
Performance: Load-time planning only; no decode, prefill, or kernel work changes.
Escape catalog: No C1–C4 pattern matches.
Notes
Tests were inspected, not executed in this review. Passing runs and FAIL-first results are author-reported. No GPU gate evidence was supplied.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
통합 메모리 pool에 들어가는 모델이 NVMe 계획 단계에서 PoolOver로 거부되는 결함을 고칩니다.
Part of #565. Tracked in #699.
What and why
On a machine with a unified memory pool, the planner could refuse a model that fits. When it splits experts between RAM and the NVMe tier, it sizes the host share from the host reading (
workstation::plan_room). That reading can be larger than the unified pool, and the final pool check still holds the plan to the pool. The split then kept more experts in RAM than the pool could hold, and the plan ended inBroken(PoolOver)although paging more experts to NVMe would have fit. The split and the pool check came together in c05b502 ("glm5next: GLM on the NVMe tier").Fixing it turned up a second gap in the same budget. When
loaded_routedlowers node ownership it rebuilds the plan's totals, and that drops the bytes the caller plans beside the plan on each local card (the reserve). A node-owned GLM plan was then split against a budget that missed the reserve and failed the pool check. That came in with 6b95421 (#411).The changes:
Plan::plan_atnow returns, and records inHostTotals::room, one effective room: the host reading, capped by the machine's host room and by the unified pool. The cards' context cost, card share and bytes beside the plan are already counted byHostNeed, so none is subtracted again. AGivenroom sets the headroom from this capped room.Plan::reserve_beside.plan_ruleuses it in place of its inline sum, andloaded_routedcalls it once after ownership lowering to restore the reserve. A product or sum pastu64is a namedMetadataerror and leaves the totals and headroom unchanged.Plan::plan_atfor the effective room.Only where weights are stored changes: RAM or NVMe. For the same model and card budget, the tight-room and wide-room fixtures give the same card counts, tier counts, rows and headroom. No kernel, CPU or card compute path, gate, pin or tolerance changed, and no public signature changed. I make no speed or output-bit claim.
Release notes: Fixed: a model that fits the unified memory pool is no longer refused with PoolOver when the host reading is larger than the pool.
Code shape
plan_rule; it moved intoPlan::reserve_beside, whichplan_ruleandloaded_routedshare. The room cap lives only inPlan::plan_at.plan_ruleis removed.Metadataerror on overflow.HostRoomFloor, which fires before the pool check; the test carries a datedPINwith that reason, and it also compares a separately computed physical total.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.cargo fmt --allandgit diff --checkare clean; clippy has not been run on this head.Duplication found or removed (
path:line), or "none": removed the inline reserve sum incrates/placement/src/placement.rs(plan_rule), nowPlan::reserve_beside. The duplicate scan found no other candidate.What I ran
The tested head is
9aeaef0b183575374f97f627ef3d4132af5c7c28, based on6c5cc348c96314a89ae9990d34b47edfc92330fa. The tests are host-only planner tests on synthetic fixtures. They ran on CPU in a Linux container on a DGX Spark, and no GPU was used. The base moved from 648dd75 while the work ran; the moved files do not touch placement or model code, and the final test ran on the new base.FAIL-first, with the original
Plan::plan_atplanted back in place of the fix (rc 101 in every case):cargo test -p bloomery-placement --lib plan_room_uses_the_host_and_unified_limits_once: the returned room assertion failed,left: 1610612936, right: 1073741724.cargo test -p bloomery-model --lib nvme_room_is_capped_by_the_unified_pool:test result: FAILED. 0 passed; 6 failed; 0 ignored; 0 measured; 465 filtered out. The six callers (GLM trunk, NextN and node-owned, Qwen, Qwen node-owned and DeepSeek) failed withPoolOverorHostOver.cargo test -p bloomery-model --lib unified_room_still_refuses_an_unserved_nvme_tier: the shared hybrid caller returnedBroken(PoolOver)where the explicitNoNvmeTierrefusal is expected.reserve_besidecall removed fromloaded_routed, the GLM node-owned test failed withPoolOver. With it removed fromplan_rule, the GLM trunk test failed withPoolOver.reserve_besidereplaced by wrapping arithmetic,a_pool_reserve_counts_local_cards_without_overflowfailed onassertion failed: plan.reserve_beside(reserve).is_err().Plan::plan_at, the changed GLM boundary testslot_plans_on_one_pool_count_the_bytes_beside_oncefailed:test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 470 filtered out.With the fix:
plan_room_uses_the_host_and_unified_limits_once:test result: ok. 1 passed.a_pool_reserve_counts_local_cards_without_overflow:test result: ok. 1 passed.nvme_room_is_capped_by_the_unified_pool:test result: ok. 6 passed; 0 failed.unified_room_still_refuses_an_unserved_nvme_tier:test result: ok. 1 passed.cargo test -p bloomery-model --lib arch::qwen35moe::place::tests::slots:test result: ok. 8 passed; 0 failed.cargo test -p bloomery-model --lib arch::glm5next::place::testson the final head:test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 454 filtered out.The first five results ran on
7eba55cd40ff57ee0176542df483d8ba5c679805. The later commits change one existing GLM boundary test and remove an unused import in the same file, and touch no production code, so those results carry over. The GLM module ran again on the final head.The new tests cover the room cap and the reserve sum in the placement crate, and the GLM trunk, NextN, node-owned, Qwen, DeepSeek and hybrid callers. The tests that take a rank count run it at 1, 2 and 4 ranks on one host. That is a local planner simulation, not a run on several machines.
Not run: clippy,
t0, the full workspace test run, the device-linked CLI--planpath and any GPU gate. No CUDA kernel, launch or device arithmetic changed, so I ran no timing comparison or model generation.Reproduction
What I ran into
This does not block the PR. A fixture that can never fit still goes through the existing 64 retry rounds in
plan_in_poolbefore it is refused. Failing earlier when the floor stops moving would save startup work, but it needs a way to tell that apart from a floor that moves late, so I left the retry loop as it is.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.