Repository navigation
metal: one build opens every registered instance; the host's geometry is a value the open resolves - #850
Conversation
…), held by Kernels and written into build.rs's header; the kernels read it, not HOST Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ld, each clause at its row's geometry Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s Geometry, so one build opens every registered instance Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st shims are gone Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Verdict: MUST_FIX: one unneeded element (ExpertsGeom::folded_blocks); the behavior I traced is correct.
Must fix
1. ExpertsGeom::folded_blocks has no reader
crates/metal/src/kernels/geom.rs:102 adds a field that only its own test reads (geom.rs:298). No launch, no header #define and no gate uses it. The function behind it, experts_geom.rs:39, is only read by the assert at line 49. That assert states the function's own body (slots * (k / BLOCK_VALUES)), so it can never fail. The base's FOLDED_BLOCKS assert compared against a literal 256; this one does not.
Cost: the field and the function are two names, a test and an assert for a fact nothing consumes.
Fix: delete the field (geom.rs:102-103), its init (geom.rs:197), its test assert (geom.rs:298-302), the function (experts_geom.rs:36-41) and the assert line (experts_geom.rs:49). Keep the is_multiple_of and shared_slot asserts.
Non-blocking
⚠ Two names for one value in Geometry: geom.rs:175 delta.groups and delta.partials_stride are both value_heads * PARTIALS_PER_HEAD; delta.group_threads is head_cols; router.k is hidden; router.partials is rows. Each pair is pinned by a test that restates the definition. If you touch this again, keep one name per value where only one reader needs it. Do not add anything for it.
⚠ Removed test has no dated reason in the diff: the removal of a_file_of_another_instance_than_the_host_is_refused_by_name (check.rs) says "carries its date and reason" in the PR body, but I found no date in the diff. Confirm the commit message holds it. The behavior it pinned (host-only open) is gone, so the replacement test is the right owner.
Checked
- Duplicates: about 60 new items checked (
Geometry, four*Geomstructs and their methods,sources_of,source_at,row_*,instance_named). One hit:folded_blocksabove. Dryer's 3 pairs read:dequant_k_for/dequant_v_forandattn_f16/attn_q8keep the shape the base already had (K vs V, f16 vs q8);refuse_slots/refuse_kguard two different facts. None is a duplicate.oracle_attention::scale_ofis the oracle's own copy of the rule, as in the base. - Complexity:
run_row(39) is the oldmainbody moved, a flat run of early returns, not new branching.pair_weights_for(26) ispair_weightsplus a geometry parameter.delta_boundsandmetal_scan::rungrew by 1: even growth. - Silent failure: 9 sites followed.
geom?incheck::readstaysNoneonly when an item is already pushed (cleanis false), so no default reaches the arena. Session open compareschecked.geomwithkernels.geom()and refuses by name. The 30B has no shared expert, andSessionalready turns the rows arm off then (session.rs:794), so the prompt pass does not reachshared_of. - Hot path: decode and prefill launches read
&self.geom.*(aCopystruct held inKernelsandArena). No allocation, launch, copy or sync is added per token; no sum order orptx-scan-class change. - Tests:
each_registered_instance_is_judged_at_its_own_geometry. Mutant:checkbuildsGeometry::of(HOST)for every file. Thechecked.geom == Geometry::of(inst)assert and the head-width refusal turn red on the non-host row.the_header_is_the_geometrycatches a header#definethat drifts from the struct.each_geometry_is_its_rowmostly restatesGeometry::of; thegqa,lane_dimsandsimd_groupsasserts are independent. - Gates: no band, tolerance or
KNOWN_DIVERGENCEmoved; no PIN needed. - Escape catalog: no match (no shell changes).
Notes
gpu.jsonis false: the evidence is an M1 Pro run, not thenvidia-smievidence list. This is a Metal-only change.- The session open of a 30B file on a default build is covered by unit tests only; the e2e gate is barred, as the PR says.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
| /// Blocks of K' of the fold. | ||
| pub folded_blocks: usize, |
There was a problem hiding this comment.
Nothing reads this field except its own test; remove it (and its init and test assert).
| /// Blocks of K' of the fold. | |
| pub folded_blocks: usize, |
| shared_slot: experts_geom::shared_slot(inst), | ||
| has_shared: slots > routed_ids, | ||
| k: key.moe.expert_ff as usize, | ||
| folded_blocks: experts_geom::folded_blocks(inst), |
There was a problem hiding this comment.
Remove with the field.
| folded_blocks: experts_geom::folded_blocks(inst), |
…s them Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Fixed in ade0c5c: the field, its init, its test assert, |
There was a problem hiding this comment.
Verdict: CLEAN: the new commit removes ExpertsGeom::folded_blocks as asked and adds nothing else.
Since the last review:
- Must fix 1 (
folded_blockshas no reader): fixed. The field, its init, its test assert,experts_geom::folded_blocksand the self-evident assert inholdsare gone. Grep finds no remainingfolded_blocksorFOLDED_BLOCKSincrates/. - ⚠ Two names for one value in
Geometry: still open at geom.rs:175. It was advice only and the new commit does not touch it. - ⚠ Removed test has no dated reason in the diff: not answered in the PR text I can see. Keep the date and reason in the commit message that removes
a_file_of_another_instance_than_the_host_is_refused_by_name.
Checked
- Duplicates: the new commit adds no item. The dryer pairs were read in the first review; none lies on lines this commit adds.
- Complexity: no function in the new commit changed in complexity. The
holdsfunction lost one assert. - Silent failure: no site added.
holdsstill assertsis_multiple_of(BLOCK_VALUES)and the shared-slot relation.geometryandInstanceare still used inexperts_geom.rs, so no unused import. - Tests: the removed assert restated
slots * (k / 256), the definition of the removed function. No contract is lost; no mutant escapes that another assert caught. - Gates: none moved. Escape catalog: no match.
Notes
gpu.jsonis false: the evidence is an M1 Pro run, not thenvidia-smievidence list. This is a Metal-only change.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
Before this change a Metal build was compiled for one host instance: the launch grids and buffer lengths read that instance's axes as constants, so a default build refused a Qwen3-30B-A3B file and the 30B needed the
host-qwen3moe-a3bfeature (#849).Now the open resolves a
Geometry(Geometry::of(&Instance), a const fn) from the file's instance:Kernels::geom()andSession::geom()hold it; build.rs writes its MSL header from the same function.open_asrefuses a library whose geometry is not the checked file's.REGISTEREDrow in one build, each clause at its row's geometry. It refuses a row the table does not cover.Four steps, one commit each (R1, R2a, R3, R2b), plus the removal of a shim nothing reads. The rest of the host shims,
instance::HOSTand the feature go in a follow-up (R4: the probes and the e2e gate).Evidence (second M1 Pro, macOS 27.0.1).
crates/metalhere is byte-identical to the tree these ran on:gate_metal_qwen35moe_kernels: PASS (2 instances)from one default build.--mutants-all: Qwen3.6 row 155 mutants, 30B row 29, each red on its clause.-D warningsrc 0: default,pipeline-scan,encode-trace,host-qwen3moe-a3b.metal-compareagainst the 30B decode instance (metal: Qwen3-30B-A3B's decode as a second build-time instance #849): rc 0, 181 pipelines the same, encode trace equal at depth ~0 and 600, ids equal. No kernel and no launch moved.A test that pinned the old refusal (
a_file_of_another_instance_than_the_host_is_refused_by_name) is replaced byeach_registered_instance_is_judged_at_its_own_geometry; the removal carries its date and reason.just affectedselects 0 of 247 gate recipes. The e2e gate is not run: it is barred on the maintainers' Macs.AI use: written and checked with Claude Code.
🤖 Generated with Claude Code