Repository navigation
gpu-gates: retry nvread eviction over the whole shard - #356
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: The shard retry preserves the zero-resident requirement and propagates eviction errors.
Non-blocking
⚠ Test the probe's retry call: crates/gpu-gates/src/bin/probe_nvread.rs:561.
The extended hardware test:820 calls evict_shard directly. Deleting the probe's retry leaves those assertions unchanged; retained pages then make prove_instrument reject the run.
Add a probe-level regression with a retained edge folio that requires the retry to reach zero resident pages.
Checked
- Duplicates: 1 new method checked; shard eviction reuses
advise_pagesandfadvise_dontneed. dryer reported 0 pairs. - Complexity: crapper flagged no changed function.
drop_partsadds a conditional retry;evict_shardis linear orchestration. - Silent failure: 0 new default/error-discard sites; 7 added fallible calls followed. Errors reach the named probe exit. Remaining resident pages still cause rejection or bounded redraws.
- Tests: static mutation analysis of crates/engram/src/rows.rs:225: omitting file-cache eviction leaves warmed pages resident and violates the added assertions. Limiting eviction to the stack violates the neighbour assertion. The hardware test remains
hw_-prefixed and ignored. - Gates: no pin, tolerance, assertion or redraw bound relaxed. Retry and logging precede all arm timers; no engine hot path changed.
- Escape catalog: C1–C4 do not match.
Notes
dryer did not scan gpu-gates; its changed code was checked manually. Tests were not executed during this review. The PR lacks the nvidia-smi line and just gate-* output required for GPU evidence.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/probe_nvread.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)
|
The review is done and the contribution check passed, so I'm merging this. |
Closes #137.
What and why
probe_nvreadstops on a DGX Spark with ext4 when its per-part page-cache eviction leaves pages resident. The probe drops each part withevict_rowsand then checks withmincore.evict_rowsonly drops folios that lie wholly inside the requested range. On ext4 the page cache holds large folios, so a folio that crosses an expert or tensor boundary stays, andmincorereports its pages as resident. The instrument then fails with "after an eviction mincore finds 34 of 226 pages ... resident".The fix adds
SplitTable::evict_shard, which drops the whole shard mapping and asks the kernel to evict the file's page cache to its end. It reuses the existing page advice andfadvisecode.probe_nvreadcalls it only whenmincorestill finds resident pages after the exact eviction, and it prints the retry to stderr (path, expert, resident and total pages). The retry runs before the timed arms, so it is not inside any measured time. The resident-is-zero requirement, the redraw bound and theMADV_NORMAL, cache, direct1, directN and drive arms are unchanged. Pages held by another process still force a redraw.Release notes: Fixed:
probe_nvreadno longer fails its eviction check on ext4 when a large folio crosses a row boundary; it retries over the whole shard and says so.What changes:
crates/engram/src/rows.rs: publicSplitTable::evict_shard.crates/engram/src/lib.rs: theSAFETYnote ofadvise_pagesalso covers a whole-file mapping range. Nounsafeblock is added.crates/gpu-gates/src/bin/probe_nvread.rs: the conditional retry and its stderr line.crates/engram/tests/engram.rs: the existing eviction contract test now also checks that the whole expert and its neighbouring tensor leave the mapping.docs/contrib/dgx-spark.md: the open item that called the cause unproven now states the current behaviour.The retry also drops the other cached tensors of that shard, which the stderr line makes visible. No timed arm changed, so this PR claims no speed change. I found no safe NVMe read speedup that this fix could carry, so there is no speed commit.
What this PR does not do
lease=false, so they check function and are not timings.Code shape
evict_shardreusesadvise_pagesandfadvise_dontneed. No other shard-wide eviction existed.evict_shardhas one caller, the probe's retry.?; the retry prints a line each time it runs.cargo fmtwas run on the changed files with the pinned nightly;git diff --checkis clean. I did not runcargo clippyon this head.Duplication found or removed (
path:line), or "none": none.What I ran
The head is
20bfbc90, one commit onac66556d(upstream/mainwhen I branched). The runs used the Qwen3.8-Flash-Next UD-Q4_K_XL split GGUF already on the machine.ac66556d:probe_nvread --threads 3 --ks 49 --range-from 256, three runsafter an eviction mincore finds 34 of 226 pages of ...-00003-of-00004.gguf expert 256 residentretrying eviction over whole shard ...: expert 256 kept 29 of 226 pages, passes the eviction and populate checks, and ends at the intended--ks 49: a batch draws from distinct layers, and the model has 48rejection (rc 1 is expected there); the original error is goneprobe_nvread --ks 1,3,16 --range-from 256 --batches 16 --warmup 1 --range-batches 2at--threads 3and--threads 8, two runs eachredraws=0, final lineREGRESSION-passed; 424 retry lines were printed across the instrument and probe runs, so the fallback was usedcargo test -p bloomery-engram --test engram hw_engram_expert_stack_evicts_and_reads_back -- --ignored --exact --nocapture1 passed; 0 failedcargo test -p bloomery-gpu-gates --bin probe_nvread5 passed; 0 failedcargo build --release -p bloomery-gpu-gates --bin probe_nvreadjust mac-static,clippy,just affected, fullcontrib-check t0To reproduce, build the probe and run the first command above against the split GGUF's first shard.
The first wrapper script for the post-fix runs exited rc 2 after the tests and build had passed, because its
grep -q "--ks"read the pattern as an option. I reran only the runtime part with--before the pattern; the passing tests and build are not repeated.Hardware (if the change is for a machine)
One DGX Spark with an NVIDIA GB10, driver 595.84, Linux 6.17.0-1032-nvidia, ext4 for the model files, a CUDA 13.3.1 container and
rustc 1.100.0-nightly (e457a7b0d 2026-08-27).probe_nvreadreads files and does not launch a kernel, so the card only identifies the machine. The runs are not under the lease (lease=false), so the rates in the logs are not measurements and are not cited.What I ran into
This does not block the PR. The retry line appears for the parts the instrument and probe runs touched, so on this machine the exact eviction alone did not clear them. I did not measure the folio sizes directly, and I ran no kernel other than 6.17.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.