Commit 41d7f8d
committed
test(metal): pin the S5 reference-tier contract, and record the MLX provider A/B
`test_metal_backend.cpp` still asserted the PRE-S5 contract: that
`GetOp(kMoeCombine, kMETAL)` throws for an op Metal has no native kernel for.
Since af0b21b that is wrong. Metal is unified-memory, so `ReferenceTierEligible`
holds and the portable CPU tier installs lazily on the miss, and `GetOp` returns
a working (correct but slow) kernel instead of throwing. The suite was red on any
Apple host: 19361/19362 assertions, one failure, unrelated to MLX (it reproduces
with `VT_OP_PROVIDER_DISABLE=mlx`).
Assert the CURRENT contract instead of deleting the check, and keep the intent
the old assertion had. `OpRegistered` stays false, because it means a NATIVE
kernel exists and the tier is a fallback, so a later row still cannot quietly
claim more than it implements. Added on top: the selection is the reference tier
BY NAME and `GetReferenceTierHits()` moved, so a Metal op silently running on the
CPU path can never pass for a native kernel (Risk 7). `> 0` rather than a strict
per-call increment is deliberate: Resolve() caches the winner in the slot and
ResetOpProviderStats does not clear that cache, so a second resolution of the
same (op, device) never re-counts.
Verified on the M4 (Apple M4, 16 GiB, macOS 26.5.2): 17/17 test cases,
19367/19367 assertions, and the `[vt reference-tier] op=15 device=2` line
confirms the portable path is the one that served it.
Public checkpoint, per the same-change obligation: docs/BENCHMARKS.md gains the
first measurement of what the optional MLX GEMM provider is WORTH, which is the
question study §5.4 left open. One binary, arms toggled by
`VT_OP_PROVIDER_DISABLE=mlx`, Qwen3-1.7B-bf16 p=512 g=128, 2 reps, arm order
alternated. MLX wins every axis: 1.5x to 2.2x aggregate throughput, 2x to 3x
faster TTFT, no memory cost, and NMSE-identical (in fact bit-identical) output on
all six parity shapes. It does NOT close BACKEND-GATE-METAL-MLXLM: still ~4.8x to
~5.5x behind the mlx_lm floor, which is what M3c and a simdgroup GEMM are for.
INDICATIVE, not binding: the three actions.runner LaunchAgents were verified
idle, booted out and restored, and the whole A/B ran inside one lockf /tmp/gpu,
but com.localai.worker and the aerial wallpaper stayed up (no passwordless sudo).
FOLLOWING_AGENTS_PROTOCOL
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude Code:claude-opus-5 [ClaudeCode]1 parent 361189a commit 41d7f8d
3 files changed
Lines changed: 95 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2230 | 2230 | | |
2231 | 2231 | | |
2232 | 2232 | | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
2233 | 2306 | | |
2234 | 2307 | | |
2235 | 2308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | | - | |
| 201 | + | |
| 202 | + | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
208 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
209 | 226 | | |
210 | 227 | | |
211 | 228 | | |
| |||
0 commit comments