Skip to content

Detect the Apple GPU as an integrated GPU - #5

Merged
Bekhouche merged 1 commit into
mainfrom
apple-metal-igpu
Nov 24, 2026
Merged

Bekhouche merged 1 commit into
mainfrom
apple-metal-igpu

Conversation

@Bekhouche

Copy link
Copy Markdown
Owner

What this does

Detects an Apple GPU as an integrated GPU, so a Mac can run LemonMatrix with --engine igpu --backend llamacpp-metal and the other -metal backends.

Why

Lemonade reports an Apple GPU under devices.metal, and LemonMatrix only read amd_gpu and nvidia_gpu.
A Mac therefore looked like a CPU-only machine, so the run was refused, and a forced run is always marked invalid.

How

  1. available_compute_engines counts an available metal device as igpu, since Apple silicon shares memory with the CPU;
  2. _classify_gpus records the metal device as the profile's igpu and takes its driver version;
  3. both sit in the shared checks, so every modality that validates its engine and backend accepts a -metal backend without per-command changes;
  4. the README has an Apple silicon section, and CI now also runs the tests on macos-latest (Python 3.12).

Testing

Unit tests use the real devices block from an Apple M5 running Lemonade 2026.47.1: 442 tests pass on macOS, including three new ones.

Live runs on that machine, with the patched code: Qwen3-1.7B (96.3 tok/s decode), Qwen3-Embedding-0.6B, Whisper-Tiny and kokoro-v1.
All four result files pass lemonmatrix validate-submission.
validate_combo_against_profile returns no issues for the Metal combination of each recipe family (text generation, speech-to-text, text-to-speech, image generation) and for onnxruntime-cpu.

What this does not cover

Lemonade reports kokoro on this Mac as running on the CPU, so --engine igpu --backend kokoro-metal is still marked invalid by the existing device check; that is Lemonade's report, not detection.
Only an Apple M5 was tested; no other Apple chip was run.

Fixes #4

Lemonade reports an Apple GPU under devices.metal, which LemonMatrix did not read.
A Mac therefore looked like a CPU-only machine, so every llamacpp-metal run was refused, and a forced run was always marked invalid.

1) available_compute_engines counts an available metal device as igpu, since Apple silicon shares memory with the CPU;
2) profile discovery records the metal device as the profile's igpu and takes its driver version;
3) both changes sit in the shared checks, so every modality that validates its engine and backend (model, speech, image, audio, embeddings, rerank, classify, 3D, omni) accepts a -metal backend;
4) the README describes the Apple silicon case, and CI runs the tests on macOS as well as Linux.

Tested with the real devices block of an Apple M5 running Lemonade 2026.47.1, and with live runs on that machine (model, embeddings, speech and text-to-speech), whose results pass validate-submission.

Fixes #4.
@Bekhouche
Bekhouche merged commit 0a39310 into main Nov 24, 2026
4 checks passed
@Bekhouche
Bekhouche deleted the apple-metal-igpu branch November 24, 2026 06:21
@Bekhouche Bekhouche mentioned this pull request Nov 24, 2026
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.

Apple silicon GPU is not detected, so Metal runs are refused

1 participant