Repository navigation
metal: MLX 8-bit and F16-scaled folders open on Apple Silicon - #1057
Conversation
…vec modes, GEMMs, routed pairs, experts, head and embedding — with its kernel-gate clauses and three mutants Co-Authored-By: Claude Opus 5.5 <[email protected]>
…H), and every MLX affine kind opens a session Llama and Mistral MLX folders store each group's scale and bias as F16; the Qwen folders store BF16. Two kinds hold the F16 pair as stored (MLX_A4H 2006, MLX_A8H 2007): gguf's dequant takes the pair type, the planner places a weight by its companions' dtype (a weight whose scales and biases disagree is refused by name), a plain F16 tensor widens to F32 exactly. On Metal the A4 and A8 decode owners take the pair as a parameter (A4T<Pair>, A8T<Pair>), so the H kinds are instances on every launch kind A4 and A8 have. The open path (chain sites, the session's launched and projected sites, the open's checks, model-hf's MLX type maps, the router's host dequant) takes MLX_A8, MLX_A4H and MLX_A8H. Kernel-gate clauses for the H kinds and mutants half_scale_as_bf16, half_bias_as_scale, half_widen_as_bf16. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…spelling, is read at default Co-Authored-By: Claude Opus 5.5 <[email protected]>
…serving parses tool calls by the model's family Co-Authored-By: Claude Opus 5.5 <[email protected]>
… one None arm is Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e value; one missing-fixture owner, no plane wrapper, one make branch 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.
Since the last review:
- Fixed: non-finite fixture values fail before requantization.
- Fixed: missing-fixture clauses reuse
clauses_a4::with. - Fixed: expert planes call
Fixture::rows_asdirectly. - Fixed: one
makebranch handles both scale pairs. - Still open: Metal proof at
crates/metal/kernels/quant.metal:703.
Verdict: CLEAN: the new commits resolve all earlier must-fix items and introduce no proven defect.
Non-blocking
⚠ Reproducible Metal proof: crates/metal/kernels/quant.metal:703 routes the existing A4 calculation through template pair methods. The body reports changed scan entries and timing summaries, but supplies no reproducible program-equivalence comparison. Attach that comparison for the renamed existing programs, both full commit hashes, and commands with output for the reported gates and A/B.
⚠ Protect the fixture refusal: crates/metal/src/bin/gate_metal_qwen35moe_kernels/fixture.rs:308 rejects non-finite values before matrix and expert requantization, reporting tensor, row and column. The new commits add no regression case for this fix. Add NaN and infinity fixture inputs and assert the named refusal; deleting this guard must turn the case red. This protects the gate from accepting invalid fixtures again.
Checked
Duplicates: no new functions, types or constants in the interdiff. The changes reuse clauses_a4::with, remove the plane wrapper and merge the make branches.
Complexity: with_geometry gains three pipeline names; pair_weights_for replaces forwarding calls. The fixture refusal adds one branch.
Silent failure: the new refusal returns a named error through both matrix and expert callers; a clause error makes the gate fail.
Tests: no tests added or changed in the interdiff. No regression case found for the fixture refusal. Device gates were not run during validation.
Gates: no bands, thresholds or pins move in the interdiff. All three new pipeline names have existing SCALED_SEG_ENTRIES instantiations.
Performance: the new pipeline lookups run at construction; the interdiff adds no per-token allocation, copy, launch or synchronization.
Escape catalog: C1–C4 do not match. No ledger lessons are in force.
Card check: needs-gpu. This pull request changes crates/gpu/src/site.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)
Supersedes #1050: the same change, rebased on main after #1047, with #1050's review fixes. It also names the
<q>_norm_nextentries #1047 added for A8, A4H and A8H.What and why
The Metal backend opened only MLX folders quantized to 4 bits with BF16 scales (MLX_A4). Many MLX folders hold other
kinds:
This adds MLX_A8 on every launch kind MLX_A4 has. It also adds MLX_A4H/MLX_A8H (ids 2006/2007, F16 scale and bias),
and opens a session on all four kinds. A4 and A8 are each one template owner over the scale pair (
A4T<Pair>,A8T<Pair>,Pair=AffineBf16orAffineF16). Two config keys are now read:rope_parameters.type;tool_parser_type.Release notes: Added — Apple Silicon opens MLX 8-bit folders, mixed 4/8-bit (DWQ) folders, and folders with F16 scales.
Code shape
cargo fmtand clippy are clean; the lint count did not go up.Duplication found or removed: none.
What I ran
All on an M1 Pro (32 GB, macOS 27.0), the second maintainer Mac.
Gates, on the rebased head:
cargo test -p bloomery-metal --lib: 115 passed. One test fails the same way on main and is skipped:model_arg::tests::a_cached_checkpoint_repo_is_its_folder_with_nothing_fetched.gate_metal_device: PASS.gate_metal_qwen35moe_kernels: PASS on all 6 instances.gate_metal_qwen35moe_kernels --mutants-all: PASS (qwen35moe_a3b 226, qwen3moe_a3b 98, gdn48 24, gqa6 34, gqa4 34,lfm3_attn 20). It includes three new mutants:
half_scale_as_bf16,half_bias_as_scale,half_widen_as_bf16.gate_metal_qwen35moe_e2e: PASS on 4 rows. e2e--mutants-all: PASS (qwen35moe 12, qwen38d 3, lfm3 3).just mac-static origin/main: green aftertools/hf-arch-check.pylearned to read the new or-pattern arm(
MlxA4 | MlxA8 | … => None). Everytools/check-*.shis green on the rebased head.metal_scan --compareagainst main 904266c: added=123, removed=0, changed=59. The changed entries are the existingA4 programs; their names are now the template's (archive +96 B each). On Qwen3.8-27B MLX 4-bit, base and this branch
gave:
--logits-hash 32bit for bit the same (79b3c52ec6067bd4);decode_rest_ms111.66 / 112.04 (base) and 111.65 / 111.60 (this branch), interleaved.Real folders (
generate_metal):renowned for …"; a
fibonaccibody).by 0.25.
lfm3, so there are noreference ids.
Hardware
Apple M1 Pro, 32 GB, macOS 27.0.
AI use: written with Claude Code (Sonnet and Opus rounds implemented it; the maintainer's lead session reviewed and ran
the gates).
🤖 Generated with Claude Code