Repository navigation
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: no behavior bug found, but the diff adds a duplicate --ctx parser, a duplicate PAGE constant and three unneeded elements.
Must fix
1. --ctx is parsed twice
generate_metal.rs:797 in plan_run repeats the parse and the "a cache of no rows" rule that parse already holds at generate_metal.rs:284. A change to one rule will miss the other. One function removes about 16 lines from plan_run and 10 from parse.
Fix: add this next to default_ctx, use let ctx = ctx_flag()?; in parse, and in plan_run replace the whole let ctx = match flag("--ctx") {…}; with let ctx = match ctx_flag() { Ok(c) => c, Err(e) => { eprintln!("generate_metal: {e}"); return ExitCode::from(2); } };
/// The `--ctx` value: absent, or a count of at least one row.
fn ctx_flag() -> Result<Option<usize>, String> {
match flag("--ctx")? {
None => Ok(None),
Some(s) => {
let c: usize = s.parse().map_err(|e| format!("--ctx {s}: {e}"))?;
if c == 0 {
return Err(format!("--ctx {s}: a cache of no rows"));
}
Ok(Some(c))
}
}
}2. PAGE has two owners
check.rs:52 adds pub const PAGE: u64 = 16 * 1024. The gate already has the same constant at resident.rs:47, and this PR makes the same file compare against the plan's paged bytes. Two page sizes can drift, and then the gate's bound and the plan's bound disagree.
Fix: delete const PAGE in resident.rs and write buffers as u64 * check::PAGE at line 52. check is already imported there.
3. Unneeded elements in check.rs
- check.rs:1159
Checked::ctx()has no caller (Grep over the repo). - check.rs:1152
Checked::mixers()is called only by one test assertion (line 1477). - check.rs:408
session_shapewrapssuper::session::refuseand has two callers.
Fix: deletectx()andmixers()and themixers()assertion. Replacesession_shape(x)withsuper::session::refuse(x)at lines 386 and 530, then deletesession_shape. Keepdelta_heads;bytes()uses it.
Non-blocking
⚠ The buffer list in Checked::bytes (check.rs:1166) mirrors Arena::open by hand. No lib test pins the kv, state, scratch or rows classes. Mutant: drop one 1 from the scratch list. Lib tests stay green. Only r_resident on a Mac turns red, through the buffer count.
⚠ check::read (complexity 18, new function) does the summary, the plans, the head, the layers and the final assembly in one body (check.rs:512). Moving the Summary build into fn summarize(split, &spec) -> Summary would be a cheap first cut.
Checked
- Duplicates: 38 new items checked. Hits:
--ctxparse,PAGE. Threerefusecopies exist already in arena, rows and session; a fourth incheck.rshas its ownwhat, so it is left alone. Dryer pairs:refusex3 is the same shape with a differentwhat, not a finding.deltaagainstattentioninarena.rsshares only a shape. - Complexity:
RowsLens::of26 is even growth, a flat field list.plan_run19 is a flag-check chain, and its duplicate is finding 1.read18 is a new function (⚠ above).ffn_checks18 andrender16 are new and flat.r_resident19→22 adds one comparison. - Silent failure: 9 sites followed (
unwrap_or,map_or).refused_sitesshape defaults only feed the type check. TheSummarydefaults are display only.checked_or_firstnames its empty case. - Order of refusals: read against the old
Arena::openandlayerorder; it matches. - Tests: the
old_plan_errorcomparisons turn red if an item's text or order changes. No lib test coversn_v, the rope base, the experts shape orMAX_SEGMENTS. The PR body says the lab mutants cover them; I could not run the lab. - Gates: no pins moved.
r_residentgains a clause. - Escape catalog: no match (no shell changes).
Notes
- The PR body names an M1 Pro but gives no commit hashes and no command output. I did not judge it on the author's card. No CUDA evidence is needed; the diff is Metal only.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
The open's checks ran inside the loader and stopped at the first refusal, after the weights were mapped. They move to one pure function over the header and tensor table (arch/qwen3moe/check.rs) that returns every refusal in the open's order, or the layout the loader copies. The open stops at its first item with the same text as before; generate_metal --plan [--ctx C] reads only the header (a truncated data section is fine), prints every item, the bytes the open would allocate, the device's working set and the host's free memory, and exits 0 (opens), 3 (refused) or 64 (unreadable header). r_resident also pins the plan's buffer count and byte bounds against the live residency set. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q5zTV27LbaVZFTjnkdmTjJ
…ed::bytes Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Since the last review:
- Duplicate
--ctxparsing: fixed by generate_metal.rs:370, used by both modes. - Duplicate
PAGE: fixed at resident.rs:49, which uses the existing owner. - Unneeded elements: fixed.
Checked::ctx,Checked::mixers, andsession_shapewere removed. - Buffer-class coverage: fixed by check.rs:1486.
- Summary extraction advisory: fixed by check.rs:508.
Verdict: CLEAN: The earlier must-fix items are resolved, and the new commit preserves validation and refusal behavior.
Checked
- Duplicates: 6 new functions/constants checked; no actionable duplication. All 5 dryer pairs read: refusal constructors and distinct mixer loaders, unchanged by this interdiff.
- Complexity:
readis now 16 after extracting the summary.RowsLens::of26,ffn_checks18,render16 andr_resident19→22 belong to the already reviewed patch; no new branch growth in this commit. - Silent failure: 3 sites followed. The two summary defaults reach display only; an empty refusal list still returns a named error.
- Tests: static mutation checks. Removing the cache tally at
check.rs:1186fails the new KV equality; dropping scratch's ticket atcheck.rs:1216fails its scratch equality. Removing a weight addition atcheck.rs:1159fails the modified clean-table test's weight-byte equality. - Adversarial checks: zero, malformed and missing context values retain their error paths. Header errors return before summary construction. The empty-refusal fallback remains an error.
- Gates: no thresholds moved; the residency tolerance uses the same page size. The removed accessor assertion was replaced by class accounting assertions.
- Performance: load-time checks, CLI parsing and test accounting only; no decode or prefill work added.
- Escape catalog: no matching pattern.
Notes
Metal tests were not run here; the gates require Apple Silicon and macOS. The PR reports an M1 Pro run but supplies neither commit hashes nor captured command output.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
…del-path reader); model-tax row lowered to 2 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Since the last review:
- Context parsing: fixed; both modes use crates/metal/src/bin/generate_metal.rs:373.
- Duplicate page constant: fixed through crates/metal/src/bin/gate_metal_qwen35moe_e2e/resident.rs:49.
- Unneeded elements: fixed; crates/metal/src/arch/qwen3moe/check.rs:331 retains only plans and layout;
session_shaperemains absent. - Buffer-class coverage: fixed by crates/metal/src/arch/qwen3moe/check.rs:1486.
- Summary extraction advisory: fixed by crates/metal/src/arch/qwen3moe/check.rs:508.
Verdict: CLEAN: The incremental changes preserve model-path validation, error text and exit codes.
Checked
- Duplicates: 1 new function checked.
model_pathreplaces two copies; existing fixture and GPU gate readers have different contracts. All 5 dryer pairs read: four short refusal-constructor pairs and two distinct mixer loaders; unchanged by these commits. - Complexity: crapper flags
RowsLens::of(26),ffn_checks(18),read(16),render(16), andr_resident(19→22) belong to the previously reviewed patch. None changes in this incremental diff. - Silent failure: 1 model-path match followed through 2 callers. Missing or empty values produce the same named error and exit 2.
- Tests: no new or changed tests; no new mutation check applies.
- Adversarial checks: absent, empty, non-Unicode and nonexistent paths retain their previous handling. Both callers propagate the helper's error. The non-macOS refusal remains outside the changed module.
- Gates: no runtime thresholds or tests moved; the model-tax count decreases with the grouped imports and shared error text.
- Performance: CLI setup only; no decode or prefill work changes.
- Escape catalog: no matching pattern.
Notes
Metal gates were not run; they require Apple Silicon and macOS. The PR reports an M1 Pro run without both commit hashes or captured command output. It does not meet the GPU evidence requirements.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
Part of #593 (Phase 1a in
docs/research/metal-all-models.md, #802).The Metal open checked a file inside the loader and stopped at the first refusal, after mapping the weights. The checks move to one pure function over the header and tensor table (
arch/qwen3moe/check.rs). It returns every refusal in the open's order, or the layout the loader copies. The open stops at the first item with the same text as before.generate_metal --plan [--ctx C]reads only the header (a truncated data section is fine), prints every item, the bytes the open would allocate, the device's working set and the host's free memory, and exits 0 (opens), 3 (refused) or 64 (unreadable header).Evidence (lead M1 Pro 32 GB):
just lab-metal: PASS, 38 lib tests, 125 mutants each red on its clause.just lab-metal-e2e: PASS.r_residentnow also pins the plan's buffer count and byte bounds against the live residency set.--planon 24 MB header cuts of Hub files: MiniCPM-V Q4_K_M and Ornith Q4_K_Mplan: opens; Qwen3.6 UD-Q4_K_XLplan: refused, 350 items(every Q8_0, Q5_K and F32 site); Qwen3-30B-A3B refused at the architecture.Written with AI help (Claude Code).
🤖 Generated with Claude Code
https://claude.ai/code/session_01Q5zTV27LbaVZFTjnkdmTjJ