Skip to content

[0.17.1] Fix Metal on iOS and macOS before 26; check kernels on the oldest OS - #153

Merged
leehack merged 6 commits into
mainfrom
fix/metal-source-os-floor
Oct 31, 2026
Merged

leehack merged 6 commits into
mainfrom
fix/metal-source-os-floor

Conversation

@leehack

@leehack leehack commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Fixes #154 and #155. Metal initializes on iOS and macOS before 26 again, and a new check keeps it that way. Needed for a v0.8.0-1 rebuild; blocks leehack/llamadart#1645.

Policy exception for the maintainer: this carries a llama.cpp patch. Upstream #31360 has the fix but no stable release does.

Changes

  • Patch 0004 applies the #31360 edit to the embedded source in ggml-metal-device.m at load, because a patch cannot change a .metal file (patches/llama.cpp/README.md). It retires when the pinned upstream has #31360.
  • metal_os_floor.yml loads the backend through ggml's loader on macos-15, macos-26 and the oldest iOS simulator on macos-15. It reports the bfloat GPU families, since a runner's paravirtual device reports family Apple5 and no bfloat and so skips the failing code. It also gates native_release.yml.
  • apple_markers, upstream_fix_path and required_text extend the patch series for Apple-only sources and for an edit whose own literal cannot show it matched.
  • verify_release_provenance.py honors upstream_fix_path and pins the floor: the check-apple step, the --bf16 runs, and no way to turn a job off or let it fail.

Evidence

Check Without 0004 (run, cf5cbbc) With 0004 (run, cd9043a, before the runner move)
macOS 14.8.9, BF16 on fails passes
macOS 15.8.2, BF16 on fails passes
macOS 26.6.2, BF16 on passes passes
iOS 17.0.1 simulator, BF16 on fails passes
iOS 18.6 simulator, BF16 on fails passes
iPhone 16 Pro iOS 18.3, Firebase fails Metal loads, auto and explicit, 25/25 layers
iPhone SE 3 iOS 18.4, Firebase fails Metal loads, auto and explicit

Firebase used the 0.17.1 XCTest bundles with only llama.framework/llama replaced by a local v0.8.0 plus 0004 build. Validation results match the same case list as 0.17.0; C06.history fails on capitalization in every run, CPU and 0.17.0 included.

macOS 14 and iOS 17 are one-time results: GitHub retires macos-14 by 2026-11-02, so the gate no longer runs them.

Not covered: macOS 13, below the 14.0 companion floor though the dylib's minimum is 13.3, and iOS 16. No runner has iOS 16, and Firebase's iPhone 14 Pro iOS 16.6 reports an asset issue before the test starts, with or without this change.

No release is dispatched here.

ggml compiles embedded Metal source on the user's device with that OS's
compiler, so a build on a current runner cannot see a kernel that older OS
versions reject. This check is expected to fail until the unary kernels are
repaired: v0.8.0 fails on macOS 14 and 15.
A simulator runtime brings its iOS version's Metal compiler: iOS 17 and 18
reject the v0.8.0 unary kernel as the devices do, on the same host where iOS 26
accepts it. macOS 14 runners have no default Metal device; ggml falls back to
MTLCopyAllDevices there, and so does this check.
Extracting the embedded kernels misses what the loader does to them, and a
runner's paravirtual device reports no bfloat, so loading on it skips the kernel
that fails. This loads the backend from the dylib with the bfloat families
reported. Expected red on macOS 14 and 15 and on the iOS 17 and 18 simulators
until the unary kernel is repaired.
llama.cpp #31146 made the bfloat4 specializations of ggml_metal_unary_cast
constexpr. Metal compilers before iOS and macOS 26 reject the vector subscript in
one of them, so Metal fails to initialize on devices with bfloat. Upstream #31360
drops constexpr and is in no stable release. A patch cannot edit a .metal file,
so 0004 makes the same edit to the embedded source as ggml loads it.

Patches of Apple-only sources get apple_markers, checked on Apple bundles, and
upstream_fix_path, because the upstream fix is in another file. The release
gates on metal_os_floor.yml.
@leehack leehack changed the title [0.17.1] Compile Metal kernels on the oldest OS; carry the unary kernel fix [0.17.1] Fix Metal on iOS and macOS before 26; check kernels on the oldest OS Oct 31, 2026
GitHub retires macos-14 by 2026-11-02, and the floor gates releases, so it moves
to macos-15, macos-26 and the oldest iOS simulator on macos-15. macOS 14 and iOS
17 stay as recorded one-time results; macOS 13 and iOS 16 are disclosed as
uncovered.

The provenance verifier now honors upstream_fix_path and pins the floor: the
check-apple step, the --bf16 runs, and no way to turn a job off or let it fail.
A required_text entry makes patch 0004 not fit when the text its runtime edit
needs is gone, since its marker cannot show that. check-apple fails on a bundle
without the library, and --bf16 fails unless ggml logs that it has bfloat.
@leehack
leehack marked this pull request as ready for review October 31, 2026 09:36
@leehack
leehack merged commit f950319 into main Oct 31, 2026
77 checks passed
@leehack
leehack deleted the fix/metal-source-os-floor branch November 7, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Metal context fails on iOS and macOS before 26 with v0.8.0: unary kernel does not compile

1 participant