For Apple silicon, add separation between architecture and Metal API selection#96
For Apple silicon, add separation between architecture and Metal API selection#96BradLarson wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
This seems like a lot of hardcoding around Metal 4 specifically, is Metal 4 special in some way? What is the intended route for people to update this in the future?
There was a problem hiding this comment.
@BradLarson Happy to land this, just want a reply here.
|
... I think a lot of this stems from Mojo choosing to name "Apple M2" as "metal2". Is it too late to change that name to something like "agx-m2" -> "apple graphics gpu m2" |
|
I wouldn't think it's too late, go for it. But I also don't know how involved the actual change would be. |
|
The big thing here is I want to make sure we align how we detect and describe the architecture / API version internally with how we do it in Bazel. If we do rework how we describe the architecture string, we may want to do that first internally, then reflect it in Bazel once that lands. This was just matching our current internal behavior for special-casing the Metal 4 API level. I imagine we'll want the flexibility for 4.1, etc. API capabilities in the future and may want a more general solution for the architecture / API matrix. |
Bazel currently detects only the Metal SDK API version for Apple silicon GPUs, passing that as the architecture string. This results in M2 GPUs running macOS 26 being reported as
metal:4, which is different from how Mojo internally detects this hardware (metal:2-metal4). This leads to Bazel-run tests reporting different architecture support than Mojo does when not built via Bazel.This should at least align the hardware architectures with the correct listings (adding a new listing for M1 hardware), and then detect if the Metal 4 API is present to append to the hardware string.