[PR #2388] [CLOSED] metal: build supports_metal4() without the macOS 26 SDK #4020

Closed
opened 2026-11-07 15:32:32 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2388
Author: @nullspeech
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: mtl4-enum-fallback


📝 Commits (1)

  • 8e308cd metal: name the Metal4 GPU family for builds without the macOS 26 SDK

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 metal/src/mtl_rt.mm (+4 -1)

📄 Description

What breaks

mtl_rt.mm's supports_metal4() names MTLGPUFamilyMetal4, which is declared only in the macOS 26 SDK headers. On a Mac still on macOS 15 the only SDK you can get is 15.x, so the Metal engine does not compile at all — and there is no prebuilt Mac engine in the release assets, so this is the first wall a macOS 15 user hits, before anything runtime-related.

Fix

Declare the same numeric family and cast it at the single call site. 5002 is what the repo's own vendored metal-cpp already uses (third_party/metal-cpp/Metal/MTLDevice.hpp:193: GPUFamilyMetal4 = 5002), and the @available(macOS 26.0, *) gate is untouched, so a 26-SDK build emits the identical call and cannot change behaviour there.

metal/src/mtl_rt.mm | 5 ++++-

Measured (this machine)

M2 Max, 96 GB, macOS 15.8, engine at main (296b59d2, 0.1.44.1), IQ3_S:

  • engine compiles and starts, serves 131072-context requests;
  • prompt read 58-59 tok/s, decode 31-40 tok/s, MTP drafts ~85% accepted;
  • gdn_parity prints max 512 threads per threadgroup and passes for GDN_NTOK 1..8 (that's the #2323 fix, verified here).

Scope, so nobody reads too much into it

This only unblocks the C++ build. It does not make MPP runtime available on macOS 15: dense_mm.metal, moe_mm.metal, qsa_prompt.metal, prompt.metal and mm_bench.metal include <MetalPerformancePrimitives/...> unguarded, and Context::compile() answers a failed shader compile with std::exit(3). A macOS 15 Mac therefore still has to run STRATA_METAL_PROMPT=window with COOP_K4=0. The natural follow-up is __has_include on that header plus a GPU-family probe, so window mode becomes the engine's own choice rather than something the user has to know about — happy to write that up if you want it here rather than in #2323.

Context: https://github.com/Niko1221/Strata/issues/2323#issuecomment-6158924728


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2388 **Author:** [@nullspeech](https://github.com/nullspeech) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `mtl4-enum-fallback` --- ### 📝 Commits (1) - [`8e308cd`](https://github.com/Niko1221/Strata/commit/8e308cdd99c6d7357f8aeef1ed6771d84a18240c) metal: name the Metal4 GPU family for builds without the macOS 26 SDK ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `metal/src/mtl_rt.mm` (+4 -1) </details> ### 📄 Description ## What breaks `mtl_rt.mm`'s `supports_metal4()` names `MTLGPUFamilyMetal4`, which is declared only in the macOS 26 SDK headers. On a Mac still on macOS 15 the only SDK you can get is 15.x, so the Metal engine does not compile at all — and there is no prebuilt Mac engine in the release assets, so this is the first wall a macOS 15 user hits, before anything runtime-related. ## Fix Declare the same numeric family and cast it at the single call site. `5002` is what the repo's own vendored metal-cpp already uses (`third_party/metal-cpp/Metal/MTLDevice.hpp:193`: `GPUFamilyMetal4 = 5002`), and the `@available(macOS 26.0, *)` gate is untouched, so a 26-SDK build emits the identical call and cannot change behaviour there. ``` metal/src/mtl_rt.mm | 5 ++++- ``` ## Measured (this machine) M2 Max, 96 GB, macOS 15.8, engine at `main` (296b59d2, 0.1.44.1), IQ3_S: - engine compiles and starts, serves 131072-context requests; - prompt read 58-59 tok/s, decode 31-40 tok/s, MTP drafts ~85% accepted; - `gdn_parity` prints `max 512 threads per threadgroup` and passes for `GDN_NTOK 1..8` (that's the #2323 fix, verified here). ## Scope, so nobody reads too much into it This only unblocks the **C++ build**. It does not make MPP runtime available on macOS 15: `dense_mm.metal`, `moe_mm.metal`, `qsa_prompt.metal`, `prompt.metal` and `mm_bench.metal` include `<MetalPerformancePrimitives/...>` unguarded, and `Context::compile()` answers a failed shader compile with `std::exit(3)`. A macOS 15 Mac therefore still has to run `STRATA_METAL_PROMPT=window` with `COOP_K4=0`. The natural follow-up is `__has_include` on that header plus a GPU-family probe, so window mode becomes the engine's own choice rather than something the user has to know about — happy to write that up if you want it here rather than in #2323. Context: https://github.com/Niko1221/Strata/issues/2323#issuecomment-6158924728 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:32:32 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4020
No description provided.