Skip to content

fix: align Metal runtime controls with the built backend - #1990

Merged
inureyes merged 2 commits into
mainfrom
fix/issue-1988-metal-runtime-switch
Sep 26, 2026
Merged

inureyes merged 2 commits into
mainfrom
fix/issue-1988-metal-runtime-switch

Conversation

@inureyes

@inureyes inureyes commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Summary

A plain macOS Cargo build enabled MLX Metal but compiled the runtime QMV setter as a no-op because its bridge used the optional Cargo feature instead of the actual backend setting. This explains the reported automatic-retry failure despite a fresh MLXCEL_QMV_WIDE=0 process passing.

  • Resolve Metal once for CMake and both bridge controls, preserving explicit Metal-OFF and native non-macOS behavior.
  • Preserve initial and retry verdicts in warnings and cached decline reasons, including operator-pinned and unavailable-backend cases.
  • Document the old-binary workaround and add build-policy tests plus a real runtime-control probe.

Test plan

  • Full local make verify: passed; after the final test-only adjustment, the affected 16-test suite passed with QMV unset, pinned to 0, and pinned to 1.
  • Release build without --features metal,accelerate: real QMV false/true and command-buffer control assertions pass.
  • Gemma 31B QAT: automatic retry and fresh narrow startup pass; 64 generated tokens match each other and the explicit-Metal release baseline. Acceptance is 33/84 in both fixed arms.
  • Qwen 3.8 MTP: both startup modes pass at block 3; 64 generated tokens and acceptance 35/52 match.

Runtime validation used M5 Max. The user's original failure and fresh-narrow pass were on M5 Ultra; the corrected binary has not been run there. Cross-host compilation and physical Metal-OFF/CUDA execution remain unvalidated. This changes build wiring and diagnostics, not attention arithmetic.

GB10-only CI remains unverified because its runner is unavailable; merge follows the user-approved exception for this investigation.

Closes #1988

Refs #1987.

Resolve the macOS Metal backend once and use that decision for both the
MLX CMake build and its C++ runtime-control bridge. Preserve both exactness
probe verdicts so failed and skipped QMV retries report what actually ran.

Add build-policy coverage, a live runtime-switch probe, and installation
guidance for plain Cargo builds and affected older binaries.

Validation:
- cargo fmt --all -- --check
- Plain release Metal runtime-switch probe passed for QMV and buffer budget
- Gemma 4 31B QAT auto retry and pinned narrow runs produced identical output
- Qwen 3.8 auto retry and pinned narrow runs produced identical output

Refs #1988
@inureyes inureyes added status:review Under review type:bug Bug fixes, error corrections, or issue resolutions priority:high High priority area:inference Generation, sampling, decoding (incl. speculative, DRY) platform:macos macOS (Apple Silicon) specific labels Sep 26, 2026
Make the exactness retry tests honor ambient QMV operator settings and verify
that backend-unavailable diagnostics never claim an unmeasured narrow arm.

Add English and Korean technical reports for the Metal bridge mismatch, its
runtime behavior, real-model evidence, and remaining host coverage limits.

Validation:
- Full make verify passed before the test-only isolation adjustment
- Focused suite passed 16/16 with QMV unset, pinned to 0, and pinned to 1
- cargo fmt --all -- --check

Refs #1988
@inureyes inureyes added status:done Completed and removed status:review Under review labels Sep 26, 2026
@inureyes
inureyes merged commit 4dcf518 into main Sep 26, 2026
14 of 20 checks passed
@inureyes
inureyes deleted the fix/issue-1988-metal-runtime-switch branch September 26, 2026 15: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:inference Generation, sampling, decoding (incl. speculative, DRY) platform:macos macOS (Apple Silicon) specific priority:high High priority status:done Completed type:bug Bug fixes, error corrections, or issue resolutions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: diagnose automatic QMV retry failure on M5 Ultra

1 participant