metal: Fix dimension constraint violation in matmul2d descriptor#21048
Merged
ggerganov merged 1 commit intoggml-org:masterfrom Mar 27, 2026
Merged
Conversation
Updates Metal tensor API test probe to fix the dimension constraint violation in the matmul2d descriptor (at least one value must be a multiple of 16).
4 tasks
|
A fix for this issue was also included in #20962 |
Contributor
Author
excellent. i'll let the owners decide what to do with this then. |
ggerganov
approved these changes
Mar 27, 2026
Member
|
Thank you for helping with this. I'll merge this for now. @Developer-Ecosystem-Engineering I saw your PR. I'm looking forward to playing with it soon. My M5 Max should arrive in about 2-3 weeks. |
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.
Updates Metal tensor API test probes to fix the dimension constraint violation in the matmul2d descriptor (at least one value must be a multiple of 16).
Overview
Some investigation detailed here #16634 (comment) indicated that the test probes for the metal tensor API fails to compile successfully on macOS 26.4, leading to the tensor support in the metal backend being disabled erroneously. This is due to a change in the Apple APIs between the time #16634 was tested and merged by @ggerganov and today. They now require that at least one of the dimensions
MandNbe a multiple of 16.Notably, the actual kernels used already respect this constraint (obviously, as they are compiling successfully today), and it is only these test probes which violate it.
I verified this by turning on verbose logging in the calls to
ggml_metal_library_init_from_source()and observed the following output whenllama-serverstarts up. Noticeggml_metal_device_init: has tensor = falsein the output, which is unexpected on a device with an M5 chip.Metal compilation error
With the change in this branch the error no longer reproduces and the following output is observed:
Successful initialization of metal backend
Additional information
Tests Performed
test-backend-ops: OKRequirements