Repository navigation
metal gates: the shader validation reader counts macOS 26.5's report form, and has one owner - #1180
Conversation
…form, and has one owner row_tail_reads and gemm_a4_store counted only "Invalid Metal usage" blocks between "=====" lines. On macOS 26.5.1 (an M5 Pro) the layer writes each report as a paragraph opened by "Invalid device load at offset N, executing kernel function: ...", with no such block, so both controls read zero reports and the clauses were red with "nothing was checked" although the layer had reported the control's read (18 reports for tail_read, 4 for gemm_weight_edge). The child run, the report reader and the control-then-own verdict move from the two clause files into common.rs (one copy). The reader takes either form; validation_reports_reads_both_forms holds it to both, and to a stderr that reports nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@yulmucoffee Sorry for the slow reply. This sat three days without a look. Thank you for the fix and for moving the reader into one owner. I merged it with #1187 into one tree and am running (Written by an AI coding agent.) |
…erged tree is the one lab-metal ran green on the second Mac) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X1hsQdxdmvvQpg1WFwxmEf
|
I merged main (with #1187) into this branch; the merged tree is the same tree lab-metal ran green on the M1 Pro. I will merge once contrib-check passes. Its earlier failures were GitHub download errors (apt 404, release 504), not this change. (Written by an AI coding agent.) |
There was a problem hiding this comment.
Verdict: CLEAN: the two clause copies become one owner in common.rs with semantics preserved, and the reader's new report form is guarded by the control, so an unknown form stays red.
Checked
- Duplicates: 4 new items (
Validated,under_validation,validation_reports,reads_inside) checked by grep; the only other child runner,mutants_allin mac.rs:853, reads exit codes and stdout clause lines, a different fact. The two old copies are gone; net fewer elements. - Complexity: crapper did not run; read by hand,
validation_reports(common.rs:435) andreads_inside(common.rs:469) are each well under 15; a new function, no growth elsewhere. - Silent failure: 3 sites followed. A layer form the reader misses makes
checked.reports == 0and the clause red ("nothing was checked"), never green (common.rs:476). A mixed stderr with a realInvalid Metal usageblock counts ≥ 1, so the own run goes red.unwrap_or_defaultonfirstfeeds only a message built when a report exists.blocks.len()vs the old string-match count differs only when one block holds the string twice; every check (>0, ==0) gives the same verdict. - Semantics kept:
reads_insidecompared line by line with both base copies (clauses_gemm.rs:880-905andclauses_matvec.rs:226-265at the base sha): same checks, same order (started, control count, own reports,own.exit?), verdict text unchanged; matvec's red message gains the launches name. Child args at both call sites carry exactly the flags the old copies passed,--instanceand--mlx-fixtureincluded. - Tests:
validation_reports_reads_both_formsholds both forms and the zero case; the paragraph branch removed turns it red (FAIL-first output in the body), the blocks branch removed turns the first assert red. - Gates: no band, tolerance or pin moved; the reader widened to a second form of the same report, with the failure shown first.
- Escape catalog: C1 to C4 are shell-script patterns; this diff touches no script.
Notes
dryer and crapper did not run (ModuleNotFoundError in diagnostics.md), so the duplicate and complexity checks above are grep and hand reads. The PR body carries the Metal gate evidence (Mac, hashes, commands with output); there is no nvidia-smi line, this change being Mac-only, so the gpu label is false.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
Merged. The last red was mine, not this change: a (Written by an AI coding agent.) |
There was a problem hiding this comment.
Verdict: MUST_FIX: the new commit's direction is right (GNU stat first, as in box.sh, oxide-host.sh and lease-probe.sh), but it edits three separate copies of one rule instead of the file's declared single owner for it.
Since the last review: the last review was CLEAN with no must-fix or ⚠ items, so nothing to carry. The three metal files are unchanged from that review (reads_inside at clauses_gemm.rs:813 and clauses_matvec.rs:155, validation_reports and the both-forms test in common.rs, all as reviewed). The new commits touch only tools/mac-remote.sh: the three mtime probes become GNU-stat-first. On macOS stat -c fails into the BSD branch, so no Mac behavior changes; on Linux (the self-test runs the lock flow there, line 1042) the GNU branch is the live one.
Must fix
1. The remote mtime probe has three owners; this diff edits each separately
tools/mac-remote.sh:151, tools/mac-remote.sh:249, tools/mac-remote.sh:525. One rule — "GNU stat, else BSD stat, else now" — is written three times: inline in SURVEY, in RMTIME, and in the run script's own mtime(). RMTIME's comment declares it "The remote scripts' one mtime" and LOCKS and CLONES already splice it in (lines 259, 298); SURVEY and the run script bypass it. The cost is in this diff: SURVEY's copy had drifted before (no GNU branch at all), so this one rule change needed three edits and had silently lost a branch. Cost of fixing now: the next stat-rule change is one edit instead of three and cannot drift again.
Fix — three edits, net two copies fewer:
- Move lines 248-249 to just above
SURVEY='{(host strings spliceRMTIMEwhen they are defined, so it must be assigned first) and make the fallback self-contained — SURVEY and the run script define nonow; LOCKS (258) and CLONES (297) do, and differ fromdate +%sonly by the listing's own runtime:
# The remote scripts' one mtime: a path's modification time in seconds, GNU or BSD stat, or now when neither reads it.
RMTIME='mtime() { stat -c %Y "$1" 2> /dev/null || stat -f %m "$1" 2> /dev/null || date +%s; }'- In SURVEY, add the splice after
mkdir -p "$base"(line 132) and shorten the probe:
'"$RMTIME"' echo "LOCK=${l##*/.lock-} $(cat "$l/owner" 2> /dev/null || echo ?/0) $alive $(( $(date +%s) - $(cat "$l/heartbeat" 2> /dev/null || mtime "$l") ))"- Replace the run script's own definition (line 525) with the same splice:
'"$RMTIME"'Checked
- Duplicates: grep
stat -[fc]over tools/ — the GNU-first order now matches box.sh:181, oxide-host.sh:192 and ref/lease-probe.sh:86; the in-file triplication is must-fix 1. The barestat -f %mat 1243/1251 runs only in the macOS-guarded flow self-test (line 1214); no sibling copy left behind by this fix. - Complexity: crapper did not run (see Notes); the diff adds no function, nothing to split.
- Silent failure: 3 probe chains followed to their consumers (SURVEY 151 → lock_note 173; LOCKS 275; run script 529); each ends in
date +%s/now, so an unreadable heartbeat and failing stats read age 0 — pre-existing shape, unchanged by the reorder, not this diff's. - Tests/gates: no band, tolerance or pin moved; the earlier commits' reader is untouched.
- Escape catalog: C1 to C4 none — the
||chains consume exit codes (not C1), no heredoc body or process matching changed,mtimecallsstat, not itself.
Notes
- The PR body says "This branch does not touch
tools/" and describes no run for the mac-remote change; the body predates this commit. - dryer and crapper did not run (ModuleNotFoundError in diagnostics.md); the duplicate check above is grep and hand reads.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
What and why
row_tail_readsandgemm_a4_storerun a child of the kernel gate under Metal's shader validation and count its reports. They count onlyInvalid Metal usageblocks between=====lines. On macOS 26.5.1 (an M5 Pro) the layer writes each report as a paragraph that opens withInvalid device load at offset N, executing kernel function: "…", with neither string. So both controls read 0 reports, and the clauses were red with "nothing was checked", although the layer had reported the controls' reads (18 fortail_read, 4 forgemm_weight_edge). Found while running #860 (report); it touches #868.This change makes the reader take both forms. It also moves the child run, the reader and the control-then-own verdict, which were one copy in each of the two clause files, into
common.rs.Release notes: internal — the Metal kernel gate's two shader-validation clauses check again on a Mac whose layer writes its reports as paragraphs; no engine change.
Code shape
common.rs(reads_inside); both clauses call it.Commandimports they needed, are removed.cargo fmtandcargo clippyare clean on what I touched (just mac-metal-lintrc 0).Duplication found or removed:
crates/metal/src/bin/gate_metal_qwen35moe_kernels/clauses_matvec.rs:142-204(Validated,row_tail_under_validation) andclauses_gemm.rs:786-863(Validated,gate_under_validation), atc7f21a7d2, plus the verdict inrow_tail_readsandgemm_a4_store.What I ran
All on the Mac below, at this branch (one commit on
c7f21a7d2) unless it saysmain.validation_reports_reads_both_formsholds the reader to both forms and to a stderr with no report. The paragraph sample is cut from this Mac's stderr. The block sample has only the two strings the old reader keyed on, since I have no stderr from a Mac that writes that form. With the paragraph branch removed (the old rule), the test is red:just lab-metalatmain(c7f21a7d2):gate_metal_qwen35moe_kernels: FAIL (qwen35moe_a3b, qwen3moe_a3b). The only red clauses arerow_tail_reads(once) andgemm_a4_store(twice), each "shader validation reported nothing for the control". 412 clause lines PASS, 2 SKIP (metallib_equals_source, no Metal Toolchain). The recipe stops before--mutants-all.just lab-metalon this branch, rc 0:tail_readred onrow_tail_readsandgemm_weight_edgered ongemm_a4_storeamong them.just mac-metal-lint: rc 0.main. The commit rebases onto1a7bba264with no conflict; the three files are unchanged there sincec7f21a7d2. On that tree,cargo test -p bloomery-metal --bin gate_metal_qwen35moe_kernels: 2 passed (validation_reports_reads_both_forms,every_mutant_finds_its_text_as_often_as_it_names).cargo clippyon the bin: no warnings.cargo fmt --check: clean. I did not rerunjust lab-metalthere.just contrib-check --tier t0:DONE tier=t0 total=40 red=1 wall=532s red: check-recipes. The red block is thetools/mac-gate.shself-test,a gate that ignores TERM is KILLed with 137: FAIL (rc 124, wanted 137). The same run at unchangedmainends the same way (DONE tier=t0 total=40 red=1 wall=556s red: check-recipes), with that same line red and three more: the mac-gate self-test'sthe child of a gate the bound ended is gone, theref/leaseself-test'strace-free-by-waiter, and a Python tool test that needs numpy in this Mac'spython3(SetError: predict needs numpy). Run alone,bash tools/mac-gate.sh --self-testpasses 27 of 27 three times on each tree. So I read it as a timing case under the parallel run on this Mac, not this change. This branch does not touchtools/.just mac-static'slintandcombosstop with 69 here (no~/opt/bloomery-mac-env.sh: no CUDA headers or Linux sysroot). The changed code is in the gate'smac.rstree, which the Linux build does not compile.Hardware (if the change is for a machine)
Apple M5 Pro (16-core GPU), 24 GB (
hw.memsize25769803776),Mac17,9, macOS 26.5.1 (25F80), on AC power. Rust 1.99.1 (rust-toolchain.toml). No Metal Toolchain, sometal-lib: path=source.gemm: architecture=applegpu_g17s metal4=true matrix-units=true engine-path=tensor. Fixtures fromfixture fetch qwen35moe/qwen3moe, and the two-mlxsplitsplits fromtools/mlx-fixture.py make(mlx 0.32.4) with theconfig.jsonofmlx-community/Qwen3.6-35B-A3B-4bit(38740b84) andmlx-community/Qwen3-30B-A3B-Instruct-2507-4bit(e9675aa3), thenprepare.🤖 Generated with Claude Code