Skip to content

parts, ctx_ask: a folder load's refusal of a paged plan is short on the host, so auto and the context fit plan below it - #1062

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-fix-auto-page-short
Oct 31, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-fix-auto-page-short

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

--parallel auto, --parallel 8 같은 설정이 NVFP4 폴더에서 "paged plan" 거부로 멈추던 문제를 고쳐서, 호스트 메모리 부족으로 읽고 더 작은 계획을 찾게 했습니다.

What and why

On a DGX Spark, a checkpoint-folder start whose plan pages routed experts to the NVMe tier stopped with parts::load: blk.0.ffn_down_exps.weight is placed on Card(0) and Host and Nvme .... A folder load serves no NVMe expert tier, so OnCard::of_in_place refused the plan as a shape error, and the context fit did not read that error as "the host is short". --parallel auto, --parallel 8 and a set --ctx-size whose share pages all stopped there instead of planning below the paged plan. With the MTP draft unset, the same error made the draft search yield, so the server silently dropped the MTP draft (--parallel 5 on NVFP4).

placement::ctx_ask gains Unpaged, which names the paged plan's need and room and converts to Short { on: Host, .. }. OnCard::of_in_place raises it first, so every placed folder load names it. short_in in crates/gpu-gates/src/generate.rs finds it anywhere in an error's source chain, so the seats' fit reads it as a host short and searches below it. The NVFP4 value in docs/contrib/dgx-spark.md section 2.3 is filled in from the head's --plan.

Release notes: Fixed: --parallel auto, --parallel 8 and a --ctx-size that needs paged experts now fit or are refused by name on a checkpoint folder instead of failing with parts::load, and the MTP draft stays on at --parallel 5 on NVFP4.

Code shape

The review reads these first. A box left unticked needs one line of why.

  • No second copy. Logic two models (or two call sites) share has one common owner; I lifted it there instead of
    copying it (AGENTS.md "Common code first", docs/rust-quality.md R14). Where I found an existing copy, I
    named it below.
  • Model code holds only architecture facts. A model's own files carry only what its architecture forces
    (tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
  • Dead code is gone. Nothing I made unused is left behind (functions, flags, gate clauses, docs).
  • No silent failure. Undefined input is a named error or panic, never a defined-looking output.
  • Comments state what is true now. No dates, issue numbers or how a bug was found (tools/check-comments.sh).
  • No relaxed gate. No band, tolerance or lint moved to make a check pass; a re-pin carries PIN(YYYY-MM-DD):
    and its reason.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up.

Duplication found or removed (path:line), or "none": none. Unpaged sits beside HostShort in ctx_ask.rs and is raised in the one shared folder check, so no seat or family carries its own copy. The hybrid families' PlaceError::NoNvmeTier is a plan-time variant that names its engine and is a different case.

What I ran

Tested base 008876af1, head b37100fb0, on a GB10 with NVIDIA GB10, 595.84, sm_121a. Each row is bloomery-serve --plan on the NVFP4 folder (nvidia__Qwen3.8-Flash-Next-NVFP4), which prints the start's records and exits before it loads anything. Base and head binaries were built from the same tree and run back to back, with BLOOMERY_REF_MODEL set to the folder.

Metric (--plan, NVFP4) Base Head
--parallel auto exit 1, placed on Card(0) and Host and Nvme exit 0, ctx rule=target ctx=262144 slots=3, from=auto
--parallel 8 exit 1, placed on Card(0) and Host and Nvme exit 0, ctx rule=fitted ctx=57344 slots=8
--parallel 6 --ctx-size 1572864 exit 1, placed on Card(0) and Host and Nvme exit 80, a slot holds at most 94208 here; ask 565248 or less
--parallel 5 draft yield card_bytes=3449063852 with=0 without=110592, ctx rule=fitted ctx=110592 slots=5 ctx rule=fitted ctx=98304 slots=5, draft keep

On the FP4-Local folder (nvidia__Qwen3.8-Flash-Next-FP4-Local) the head prints ctx rule=target ctx=262144 slots=3 for --parallel auto, ctx rule=fitted ctx=65536 slots=8 for --parallel 8 and ask 589824 or less for --parallel 6 --ctx-size 1572864; the base refuses the last two with placed on Card(0) and Host and Nvme and placed on Card(0) and Nvme. The drafted fit at --parallel 5 on NVFP4 is exact at the 1,024 step: BLOOMERY_DRAFT=mtp --parallel 5 --ctx-size 491520 prints ctx rule=set ctx=98304 slots=5, and --ctx-size 496640 exits 80 with a slot holds at most 98304 here.

Tests that cover the change (cargo oxide test --arch sm_121a -- -p <crate> --release ...):

test parts::tests::a_paged_plan_is_short_on_the_host ... ok
test generate::tests::a_wrapped_unpaged_refusal_is_short_on_the_host ... ok
test serve_seats::qwen38::tests::a_folder_plan_holds_its_reads_on_the_arena_floor ... ok
test serve_seats::qwen38::tests::auto_slots_keep_the_fitting_host_plan ... ok
test result: ok. 8 passed; 0 failed; 2 ignored   (-p bloomery-gpu --lib parts::tests)

No kernel, decode or prefill path changes.

Hardware (if the change is for a machine)

DGX Spark (GB10), driver 595.84, sm_121a, one card, one unified memory pool. --plan reads its room from MemAvailable, so the fitted contexts above move by a few thousand positions with the host's free memory at each start.

AI help

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

…he host, so auto and the context fit plan below it
@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 31, 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: The paged-plan refusal reaches context fitting as a host shortage; no blocking defect was found.

Non-blocking

⚠ Supply FAIL-first and gate evidence: crates/gpu/src/parts.rs:1539 and crates/gpu-gates/src/generate.rs:3026.
The body reports passing tests and --plan runs, but no FAIL-first failures or selected just gate-* commands with output, as requested by CONTRIBUTING.md.
Remove the new admission guard and source traversal separately, then attach each failing assertion, the restored passes, and the gate results selected by just affected.

Checked

Duplicates: 13 new declarations checked, including test types and implementation methods; no duplicate requiring consolidation. The existing NoKv was moved and reused. Dryer reported zero pairs; gpu-gates was checked manually.
Complexity: crapper flagged no function.
Silent failure: four refusal/fallback sites followed. Saturation still rejects the plan; absent room uses machine capacity; zero paged bytes retains row validation; unclassified errors propagate to the caller.
Tests, static mutation audit: removing parts.rs:575's guard fails the typed-refusal assertion; omitting ctx_ask.rs:243's paged-byte addition fails need equality; removing generate.rs:315's source traversal fails the wrapped-short assertion. Tests were not executed in this review.
Gates: no existing threshold, tolerance, test or case removed or relaxed.
Escape catalog: no pattern matched.
Adversarial checks: paged experts are refused before row admission; the actual GpuError::Plan exposes its source; row-gathered NVMe tables do not trigger the expert refusal; unrelated planning errors remain errors.
Performance: load planning only; no hot path changed.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/generate.rs, crates/gpu/src/parts.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 bb8ad14 into midagedev:main Oct 31, 2026
7 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 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.

1 participant