Repository navigation
placement: validate card layouts only for uploads - #801
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: The card layout check still rejects valid routed stacks placed entirely on the host.
Must fix
1. Validate routed layouts at their card destination
crates/placement/src/placement.rs:2669 checks every routed stack before choosing its destination. On a machine with no expert tiers, call plan_host_routed with an NVFP4_ROWS stack, dims=[160,4,8] and file_bytes=2880. That planner passes routed=None (placement.rs:2633), so every expert belongs on the host. Nevertheless, the preflight returns Nvfp4Planes upload refuses because 160 is not divisible by the card's 64-value block. The host accepts 32-value blocks (crates/qdot/src/lib.rs:353). This valid host placement is refused before placement runs.
Fixing this sibling path here avoids a second placement fix and regression-test round.
Remove the preflight check. Actual card segments already validate through card_segment_as → card_bytes → card_buffers. Replace the tensor loop with:
for (i, t) in model.tensors.iter().enumerate() {
if t.role == Role::RoutedExperts {
stacks[layer_of(t, model.layers)?].push(i);
} else {
rows[i] = Some(place_whole(i, t, &stages, model)?);
}
}Extend the existing test with this 160-wide routed stack under plan_host_routed, asserting successful host placement. Its current routed stacks remain Q4_K/256. Retaining the preflight check must make the added case fail.
Checked
Duplicates: diagnostics report 0 dryer pairs; the new test reuses existing fixtures.
Complexity: diagnostics report no flagged functions.
Silent failure: no error defaults added; card segments still validate through card_segment_as and card_bytes.
Tests: static mutation analysis confirms that restoring the global preflight rejects EngramTable/160, and removing the planes' 64-value guard defeats the card/160 rejection assertion. The new test omits the host-routed case above.
Gates: no pins or tolerances moved; the card's 64-value guard remains.
Escape catalog: no patterns matched. The changed code runs at load time.
Notes
Static validation; tests were not run. The PR body reports CPU FAIL-first/pass output before the final rebase and no just gate-* run.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
05f9431 to
3485f71
Compare
There was a problem hiding this comment.
Since the last review: must-fix 1 is fixed. The routed preflight is removed, and placement.rs:5235 checks successful host placement and named card refusal for the 160-wide stack.
Verdict: CLEAN: The host-routed placement failure is fixed, and card destinations retain layout validation.
Checked
Duplicates: 0 new named items in the interdiff; the existing regression test is extended. Dryer reports 0 candidate pairs.
Complexity: crapper flags no functions.
Silent failure: 2 existing sites followed; missing row width produces a named refusal, and deferred card-buffer errors propagate from Footprint::at.
Tests: static mutation analysis confirms that restoring the preflight before placement.rs:2667 fails host success; removing card.rs:612's block-size guard fails card rejection.
Gates: no pins, bands or tolerances moved. The PR supplies FAIL-first output for the added routed case.
Escape catalog: no C1–C4 patterns matched. The change affects load-time planning.
Notes
Static review; tests were not run independently. The PR reports 197 CPU tests passing on this head and no GPU gate run.
🔨 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. |
Placement 계획이 카드에 올리지 않는 텐서까지 카드 업로드 형식으로 검사해 거절하던 문제를 고칩니다.
What and why
plan_rulechecked every tensor against the card upload layout before it knew where the tensor would live. TheNvfp4Planes upload needs whole 64-value blocks, so a tensor such as a 160-wide NVFP4_ROWS table was refused even when
it stays on the host or NVMe, where 32-value blocks are fine. A routed expert stack kept whole on the host hit the
same error:
host-routed 160: tensor experts 0: 32 rows of 160 values: the Nvfp4Planes upload refuses them.This change removes that early check from
plan_rule(crates/placement/src/placement.rs). A tensor is now checkedfor the card layout only when a card segment is built for it. Routed experts get the check in
routed_row_on_as -> card_segment_as -> card_bytes -> card_buffers, and the expert rule's load computation gets it inFootprint::at -> card_buffers. The card check now uses the format the plan'sRoutedRulesupplies. The refusal fortensors that do go to a card is unchanged and still names the tensor.
Release notes: Fixed: A 160-wide NVFP4 table or routed expert stack that stays on the host or NVMe is no longer refused with a card-upload layout error.
Code shape
card_bytes.cargo fmtandcargo clippyare clean on what I touched.Duplication found or removed (
path:line), or "none": none.What I ran
On a CPU-only machine, on this head:
The new case in
only_card_uploads_require_the_card_layoutcovers both widths (64 and 160) for each tensor role anddestination, plus the routed stack:
rows.weightandNvfp4Planes upload refuses.dims=[160,4,8]plans throughplan_host_routedand its row has oneDevice::Hostsegment.experts 0andNvfp4Planes upload refuses.With the early check still in place and the routed case added, the new test stopped at the routed case with:
cargo clippyon thebloomery-placementcrate finished without warnings.I did not run any GPU gate or a model load: the change touches only placement planning, not a GPU path or device
arithmetic. I expect plans for checkpoints whose routed stacks already fit the card layout to be unchanged, since
the removed check accepted them; I did not re-run such a checkpoint for this change.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.