Skip to content

bug(mlx): nax capability warning false-positives on non-Neural-Accelerator hardware (fires on every CI build) #250

Description

@Pushkinist

Found by the CI run of #249 itself — a case that cannot be reproduced on the dev machine.

Problem

The build-time nax capability probe fires its loud warning on GitHub's macos-14 runner:

warning: rmlx-mlx@0.3.0: MLX at /opt/homebrew/opt/mlx (mlx 0.31.2, mlx-c 0.6.0_2)
  ships no steel_gemm_fused_nax kernels in lib/mlx.metallib.
warning:   Those are the Neural-Accelerator GEMM path. Without them GPU matmul throughput
  measured ~3.8x lower and prefill 2.2-3.7x slower on Neural-Accelerator-class hardware…

Two things are wrong there:

  1. False positive. The Neural Accelerator is M5-only; macos-14 runners are M1. The kernels are legitimately absent and their absence costs that machine nothing. We now emit an alarming warning on every CI build, twice (clippy + build).
  2. The message contradicts itself (hard rule 7). The runner is on 0.31.2 — our pinned "good" pair — yet the warning says "ships no … kernels" and then "rMLX pins the validated pair mlx 0.31.2 + mlx-c 0.6.0_2, whose metallib ships them." Both cannot be true. On that bottle, they aren't.

What this reveals (worth folding into #216's thesis)

The pin does not guarantee the kernels — the bottle does. brew 0.31.2 on this M5 dev box ships 145 distinct nax kernels; brew 0.31.2 on the M1 CI runner ships 0. So bottle contents vary by runner arch/OS/toolchain, which strengthens the "bottling/toolchain regression, not an MLX regression" conclusion (see the kept depends_on xcode: ["15.0", :build] note) — but it means "pin 0.31.2 ⇒ fast GEMM" is only true for this machine's bottle.

Fix directions

Gate the loud warning on hardware that actually has a Neural Accelerator (M5-class) — on anything else the kernels are irrelevant and their absence should be silent (or at most a one-line informational note). Detect the host capability rather than inferring from version/bottle: the probe already answers "are the kernels present?"; it needs a companion "does this machine want them?".

Keep the current behaviour where it matters: on NA-class hardware, missing kernels stay loud.

Also fix the self-contradiction — the "whose metallib ships them" clause must not assert a property of a bottle we didn't inspect.

Test

  • Simulate/assert: NA-class host + kernels missing → loud warning (today's behaviour, keep).
  • Non-NA host + kernels missing → silent (or a brief note), and no contradictory "the pin ships them" clause.
  • Kernels present → silent either way (already true).
  • CI must build clean without the alarm.
  • Warn-not-fail preserved in all cases (a public user on any layout must build).

Related: #216 (the pin + probe), #248.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions