Skip to content

docs: record #1803 Metal gate, add paged decode counter A/B - #1881

Merged
inureyes merged 1 commit into
mainfrom
docs/issue-1803-metal-verification-record
Sep 14, 2026
Merged

inureyes merged 1 commit into
mainfrom
docs/issue-1803-metal-verification-record

Conversation

@inureyes

Copy link
Copy Markdown
Member

Records the Metal regression gate for #1803 and lands the harness for its paged arm, so #1873 can run the CUDA half without rediscovering how.

docs/benchmark_results/kernel-backend-kind-metal-m1ultra-2026-09-13.md covers four arms: the backend probe #1803 itself ships, greedy byte-identity across six configurations, the batched paged decode counters, and the workspace gate (11119 passed, 0 failed). Verdict is that Metal selects the same kernels. It also names what was not measured, including the sampler's two-arm diff, which greedy decode cannot reach.

The reusable part is the two runs that passed for the wrong reason. Five checkpoints reported 5/5 EQUAL while three never reached a changed decision point, because FUSED_ADD_RMSNORM_DEFAULT and FUSED_ROPE_APPEND_DEFAULT are opt-in, falcon-mamba does not use ssm_update_kernel, and split_kv_enabled() short-circuits on absorbed_enabled(). And the paged arm compared gather against gather because the dispatch floor declined both sides. Each cost a re-run; each recurs unchanged on CUDA.

scripts/paged_decode_counter_ab.sh encodes that. Output equality cannot judge the batched paged path, since every gate on it chooses between the fused kernel and a gather fallback computing the same thing, so a disabled fused path is byte-identical and silent. The discriminator is gather_fallbacks, not declines, which is never exported to the gauges. The script also refuses the vacuous run where neither side launched the fused kernel.

Validated end to end against the two binaries the record describes, reproducing its counters exactly. shellcheck clean, insert_apache_header.py --check and check_cross_repo_refs.py pass. No product code changes.

Refs #1803, #1873, #1877

Closes the Metal half of #1803's last acceptance criterion: that Metal and CUDA select exactly the same kernels as before the GpuKernelBackend refactor. The CUDA half stays open as #1873.

The record covers four arms (the backend probe, greedy byte-identity across six configurations, the batched paged decode counters, and the workspace gate) and names what was not measured. Its most reusable part is the two runs that passed for the wrong reason: five checkpoints reported 5/5 EQUAL while three of them never reached a changed decision point, and the paged arm compared gather against gather because the dispatch floor declined both sides. Each cost a re-run and each recurs unchanged on CUDA.

The script is the harness for that paged arm, generalized so #1873 can run it on GB10. Output equality cannot judge that path: every gate on it chooses between the fused kernel and a gather fallback that computes the same thing, so a disabled fused path is byte-identical and silent. The verdict is gather_fallbacks, not declines, which is never exported to the gauges. The script also refuses the vacuous run where neither side launched the fused kernel, which is the failure the paged_decode_batched doc comment records from the first #899 sweep.

Validated end to end against the two binaries the record describes, reproducing its counters exactly. shellcheck clean.

Refs #1803, #1873, #1877
@inureyes inureyes added type:docs Documentation improvements or additions status:review Under review priority:medium Medium priority area:core mlxcel-core: MLX FFI, primitives, KV cache, layers platform:macos macOS (Apple Silicon) specific labels Sep 14, 2026
@inureyes inureyes self-assigned this Sep 14, 2026
@inureyes

Copy link
Copy Markdown
Member Author

Read the script and the report. The shape is right, and the part I would have got wrong is the part you got right: refusing a run where neither side took the fused path, instead of reporting EQUAL. That is the failure your own first measurement produced, and a comparison tool that cannot fail for the right reason is worth less than no tool.

Checked here: bash -n clean, the four traps are enforced rather than documented, basename "$MODEL" matches what /v1/models reports as the id so the required model field is populated, and the discriminator is gather_fallbacks.

Three things from the ROCm and GB10 side, none blocking.

jq is a hard dependency and there is no preflight for it. It is not installed by default on a minimal Debian or on the ROCm container images I have seen, and the failure lands mid-run after the server is up, so the operator pays a model load before finding out. Either check for it next to the other argument validation, or build the request with a here-doc, since the body is four fixed fields and one prompt string. The prompt would need escaping, which is the reason to prefer the check.

The requests are sequential, so the launch is a batch of one even with --max-batch-size 4. That is enough for paged_decode_batched and it is what produced your numbers, so the run is sound. It does mean the cascade path is never exercised: cascade=0 in the report is not evidence that cascade is unchanged, only that nothing asked for it. Worth a line in the report, since a reader looking at three counters will take all three as measured. If you want cascade covered, the requests have to overlap in time and share a prefix.

The 180 second readiness wait is generous for an 8B on a warm page cache and thin for a first load from cold storage on a machine nobody has touched, which is the GB10 case. A knob would do; so would saying in the usage text that a cold first load may need it raised.

One question rather than a finding: on a failure path the script kills the server and returns, and the trap cleanup runs on exit. If the server is mid-load when the kill lands, does it leave the port held long enough that an immediate second run collides? I ask because PORT is a fixed 18803 and the natural next action after a failure is to rerun.

On the vendor design, agreed, and the invariant test is the part I would not have thought to add. Writing the lesson in a comment and fixing it in a test are different things: I have put the reasoning in comments twice today and both times the next person who needs it is me, later, with the comment scrolled off. A test that fails when someone adds a vendor and forgets is the version that survives.

I will take is_apple_silicon() plus the vendor field into #1805 as you describe, with the eleven sites converted mechanically so the diff shows the predicate is the same comparison, and the AMD arm added after.

@inureyes
inureyes merged commit 3d8fd7b into main Sep 14, 2026
16 checks passed
@inureyes
inureyes deleted the docs/issue-1803-metal-verification-record branch October 6, 2026 12:12
@inureyes inureyes added this to the 0.8 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core mlxcel-core: MLX FFI, primitives, KV cache, layers platform:macos macOS (Apple Silicon) specific priority:medium Medium priority status:review Under review type:docs Documentation improvements or additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant