Repository navigation
Use mx.fast.gated_delta_update on GPUs without Metal, including Apple Silicon under Mesa/Vulkan. - #1961
Open
joshuaswarren wants to merge 1 commit into
Open
Use mx.fast.gated_delta_update on GPUs without Metal, including Apple Silicon under Mesa/Vulkan.#1961joshuaswarren wants to merge 1 commit into
joshuaswarren wants to merge 1 commit into
Conversation
… Silicon under Mesa/Vulkan.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: On GPUs without Metal (including Apple Silicon running via Mesa/Vulkan),
gated_delta_updatealways usesgated_delta_ops, which loops over tokens in Python. MLX already providesmx.fast.gated_delta_update, which backends can implement natively. The Vulkan backend for Apple Silicon on Linux does, butmlx-lmdoesn't it on non-Metal GPUs.Change: When the default device is a GPU and Metal is unavailable, call
mx.fast.gated_delta_updateif it exists. Otherwise, keep the existing fallback. The Metal code path and its head-dimension check remain unchanged.Result: Qwen3.5-9B, 4-bit quantization, 512-token prefill, M1 Max running Linux sees substantial speed improvements.
Tests: Added
test_non_metal_gpu_uses_native_op, which fails before the change and passes afterward. The full suite has no new failures, andtest_gated_delta.pypasses on macOS.AI usage disclosure: I understand it is strictly prohibited to use AI to write PR description. I drafted this by hand. Opus 5.5 assisted in the diagnosis of the performance issues I was seeing that led to this change.