Skip to content

placement: refuse a host page size outside the row room - #408

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-p1-page-size-guard-refuse-a-page-size-other-than-4096-by-name
Oct 17, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-p1-page-size-guard-refuse-a-page-size-other-than-4096-by-name

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

What and why

Part of #53: refuse a host page size the placement row-room calculation does not support.

The host-room reader now checks host_lock::page_bytes() against ROW_PAGE before reading the machine's room or accepting BLOOMERY_HOST_ROOM. The existing sysconf(_SC_PAGESIZE) reader supplies the actual size, and the error names both sizes through the existing host-room refusal path.

Release notes: Added: A named refusal when the host base page size differs from placement's 4096-byte row-page unit.

Code shape

  • No second copy. Reuses host_lock::page_bytes(); no second system reader or page-size constant.
  • Model code holds only architecture facts. No model-specific path changed.
  • Dead code is gone. No new production helper, flag or dependency.
  • No silent failure. An unsupported page size returns an error before a supplied room can bypass it.
  • Comments state what is true now.
  • No relaxed gate. No band, tolerance or lint changed.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up. Clippy was not run here.

Duplication found or removed: none.

What I ran

Delivery head: 30dc7fa19af640ed776c1e833dfb646f3c72aca1, rebased onto 8e05ce8f28f115450902a8214047b543bc1d97df. The patch is unchanged; the intervening main commit changes only profiling scripts.

Tested head: 08dc9d467e118e662440791a07c9d7503e844cf9. Tested base: b1eea0413738d36f0a5ea595e06995492b610fd3. Those native page-size results carry because the host-room reader, its page-size reader and the regression are unchanged.

On each host, built the library test executable with:

cargo test -p bloomery-model --lib --no-run --message-format=json

Then ran placement::workstation::tests::host_room_refuses_another_row_page --nocapture with the native page size and with a syscall shim reporting 16384 or 65536 bytes. Each size was tested with a machine-read room and with BLOOMERY_HOST_ROOM=1G. The shim was loaded into the test executable only, after compilation.

Host Host-room result
Linux aarch64 4096 B accepted; 16384 B and 65536 B refused
Linux x86_64 4096 B accepted; 16384 B and 65536 B refused

Difference: native 4096 B reads still pass; a 65536 B reading with a supplied room is now refused instead of accepted.

Both hosts passed all six cases. On the base production code with only the regression test added, the 65536-byte case with a supplied room failed: the room was accepted as (1073741824, Given).

just affected b1eea0413738d36f0a5ea595e06995492b610fd3 --no-box selected 167 of 184 gate recipes through the model crate. This lists affected gates; it does not run them. Full contributor checks and the selected GPU gates were not run here.

Reproduction

Build the test executable normally, then run it under a small LD_PRELOAD shim that overrides only sysconf(_SC_PAGESIZE):

#define _GNU_SOURCE
#include <unistd.h>
#include <dlfcn.h>
long sysconf(int name) {
    if (name == _SC_PAGESIZE) return 65536;
    long (*real_sysconf)(int) = dlsym(RTLD_NEXT, "sysconf");
    return real_sysconf(name);
}

Compile the shim with cc -shared -fPIC page.c -ldl -o page.so. Use the test executable path from Cargo's compiler-artifact JSON row whose target name is model:

BLOOMERY_HOST_ROOM=1G LD_PRELOAD="$PWD/page.so" "$test_binary" \
  placement::workstation::tests::host_room_refuses_another_row_page --nocapture

The result is Err("sysconf(_SC_PAGESIZE) is 65536 B; row room requires 4096 B pages").

Hardware

DGX Spark with NVIDIA GB10 and driver 595.84, Linux aarch64; a Linux x86_64 CPU host without an NVIDIA GPU. Both hosts report 4096-byte base pages. Compiler: rustc 1.100.0-nightly (e457a7b0d 2026-08-27). No model file is needed.

What I ran into

The larger page sizes were injected syscall answers, not kernels booted with those page sizes. This does not block this PR: the test exercises the production reader and refusal, but does not claim full support for another page size.

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 model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja placement Placement planning: crates/placement 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: Unsupported page sizes are refused before the machine reading or room override is accepted.

Non-blocking

⚠ Automate the injected-page regression: crates/model/src/placement/workstation.rs:124.
At 4096 bytes, this test only asserts success, so deleting the production guard at lines 24–29 leaves its assertions satisfied.
Run the PR's documented 16384/65536-byte shim cases, with and without the room override, through an existing gate to catch recurrence automatically.

Checked

  • Duplicates: the new test is the only test of this host-page refusal found in the tree.
  • Complexity: the production reader gains one guard; the test branches on the host page size.
  • Silent failure: invalid page readings and mismatches return named errors; the placement caller propagates them through PlacementError::HostRoom.
  • Tests: static mutation analysis shows the native 4096-byte branch would miss a deleted guard. The PR reports failure on base code with a 65536-byte shim and supplied room.
  • Gates: no pins moved or cases removed.
  • Escape catalog: C1–C4 do not match the diff.
  • Performance: the change touches load-time room discovery; no decode or prefill work changes.

Notes

Validation was static; tests were not rerun. The PR reports CPU test runs and says full contributor checks and selected GPU gates were not run.

🔨 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 0fbde4d into midagedev:main Oct 17, 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 model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja placement Placement planning: crates/placement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant