Repository navigation
placement: reject overflowing card reserve and set-aside sums - #359
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: The checked card floors still feed an unchecked pool sum.
Must fix
1. Check the pool accumulation
crates/placement/src/placement.rs:3743 Two distinct stage cards covering 0..1 and 1..2 (head on the second), each with usable_bytes = u64::MAX, a 1 << 63 reserve, zero context/scratch/margin, and no free or budget cap, pass the individual floor checks. With layered(2) and NoKv, their combined total exceeds u64.
Debug builds panic here. Release builds wrap; on a unified pool of u64::MAX, pool_need repeats the wrapping sum and misses PoolOver. The new tests use one card and do not catch this remaining overflow path.
Checking this sum in the current overflow fix avoids another correction to the same totals owner.
Replace the accumulation with:
if machine.unified().is_some() {
pool_cards = pool_cards
.checked_add(used - card.context_in_free())
.and_then(|bytes| bytes.checked_add(card.margin_bytes))
.ok_or_else(|| card.bytes_past_u64())?;
}Add this two-card case to the regression: require a named refusal on a unified machine and successful planning on a machine with separate card memories.
Non-blocking
⚠ Complete the fix evidence: crates/placement/src/placement.rs:4533. The body lists green runs but no FAIL-first output. It also describes a separate release consumer that the diff does not retain. Include the failing run and retain the reproducer in existing tools, or explain how the fix supplies the required debugging layer.
Checked
Duplicates: 4 new items checked (three functions and the error variant); no duplicate owner. Dryer reported 0 pairs.
Complexity: WholeNeed::fmt 13→17 adds overflow rendering; totals 15→17 and plan_rule 34→35 add error propagation. These changes do not require a split.
Silent failure: 8 handling sites followed. Overflow reaches a named error or explicit “past u64 bytes” text; the two production expect sites follow checked floors.
Tests, static mutation: wrapping the addition at reserve_bytes breaks the new boundary assertions; restoring the sentinel at whole_need breaks the new refusal assertions.
Migrated tests: drop reserve insertion (2 tests), batch scratch (2), set fixed costs to zero (1), or drop the all-expert refusal (1): assertions turn red.
Gates: no existing pin, tolerance or test removed or relaxed.
Escape catalog: C1–C4 do not match. The changed production path is load-time planning.
Notes
Rust tests were assessed statically, not executed. The pool-overflow arithmetic was checked separately.
Dryer skipped gpu-gates; its changed callers were checked by Grep.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/beside.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)
Filed outside this PR: #363
|
Combined verification record: https://github.com/Burntgogi/bloomery/blob/ce8398216da51ae2d1e0b2c42ddb8dfda76c7460/docs/contrib/evidence/native-roadmap-20261015/refresh-20261016/results.json . Placement strict clippy passes with --no-deps; the dependency-inclusive strict attempt remains red on four existing chunks_exact_to_as_chunks warnings in unchanged gguf/quant.rs:1296,1351. No lint level was relaxed. Integrated metadata, public release consumer and complete recipe check pass; the incidental localized FIFO assertion cleanup is separate #367. |
There was a problem hiding this comment.
Since the last review:
- Must-fix 1: fixed at crates/placement/src/placement.rs:3743. Shared-pool accumulation is checked; separate card memories skip it.
- Evidence request: still open at crates/placement/src/placement.rs:4596.
Verdict: CLEAN: The incremental change closes the reported pool overflow and adds assertions for both memory configurations.
Non-blocking
⚠ Complete the fix evidence: crates/placement/src/placement.rs:4596. The body still lists green runs without FAIL-first output, and the separate release consumer is not retained. Include the failing regression run and retain the reproducer in existing tools, or explain how the named error and its context provide the debugging layer. This makes recurrence checks repeatable.
Checked
Duplicates: 1 new item checked, the regression test; no duplicate contract found. Dryer reported 0 pairs.
Complexity: crapper flags totals 15→19; this increment adds a unified-pool guard and checked accumulation. WholeNeed::fmt 13→17 and plan_rule 34→35 predate this increment. No complexity finding.
Silent failure: 1 new error-propagation site followed; either checked addition returns CardBytesPastU64. The subtraction is bounded by the context already included in the checked floor.
Tests, static mutation: wrapping the addition at line 3745 defeats the named-error assertion; removing the unified guard makes the separate-memory success assertion fail. Checked the two-card arithmetic independently.
Gates: no existing pin, threshold or test removed or relaxed.
Escape catalog: C1–C4 do not match. The changed path is load-time planning.
Notes
Rust tests were assessed statically, not executed. The body carries no GPU gate evidence.
Dryer skipped gpu-gates; this increment does not change that crate.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/beside.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)
|
@Burntgogi Thanks for the contribution. The review is done, so I'm merging this. |
|
Post-merge caller cutover: #359 merged its earlier The minimal repair is #372 at Final combined integration Immutable final evidence and distinct merged-versus-validation source heads: |
Problem
Fixes #349. Reserve-list and context/scratch additions could overflow before the checked floor; shared-pool accumulation could also panic in debug or wrap in release. These paths could fabricate available space instead of a named refusal.
This PR merged
5e3f139fdb7cfe2c18cd4453f85475a1c9034347as3781737c6df9b721045c11a493ca6505cc2f1ec8during verification. Later branch62ea287is a subsequent rebased validation head, not this PR's merged head. Its #339 caller compatibility repair is submitted separately as #372.Change
Card::reserve_bytesandset_aside_bytesnow returnOption<u64>;floor_bytespropagatesNone.PlacementError::CardBytesPastU64.u64::MAXsentinel.No kernel, allocator geometry, numeric band or placement retry policy changes.
Exercised evidence
62ea287641c702b2ffd2147b79e8f6bf53254b0f:cargo test -p bloomery-placement: 138 passed.cargo test --release -p bloomery-placement card_sums: 3 passed; scopedcargo clippy -p bloomery-placement --all-targets --no-deps -- -D warningspasses.CardBytesPastU64naming the offending card.cargo test -p bloomery-placement pooled_card_sums_are_checked_only_for_shared_memoryand its--releaseform.stage1in the error. This named card and error category provide the debugging context; the throwaway public consumer is not a second production tool.09bd728, including merged main and fix(gates): supply split prefill referee cache origin #370/fix(qwen): consume checked Card reserves after merged context policy #372, passes workspace/all-targets, all-feature GPU-test metadata and 124 host-library tests (3 ignored). These are not CUDA device execution.Immutable fail-first output, owner/consumer logs, merged-head attribution and post-merge integration log.
NVIDIA device-consumer acceptance remains unrun; an A6000 maintainer run is still needed. Dependency-inclusive strict clippy remains blocked by four existing
ggufdiagnostics; no lint level was relaxed. No GPU or performance result is claimed for this PR.