Skip to content

For Apple silicon, add separation between architecture and Metal API selection#96

Open
BradLarson wants to merge 1 commit into
modular:mainfrom
BradLarson:apple-silicon-detection
Open

For Apple silicon, add separation between architecture and Metal API selection#96
BradLarson wants to merge 1 commit into
modular:mainfrom
BradLarson:apple-silicon-detection

Conversation

@BradLarson

Copy link
Copy Markdown
Member

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.

@Ahajha Ahajha Jun 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BradLarson Happy to land this, just want a reply here.

@pprovins

Copy link
Copy Markdown

... 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"

@Ahajha

Ahajha commented Jun 16, 2026

Copy link
Copy Markdown
Member

I wouldn't think it's too late, go for it. But I also don't know how involved the actual change would be.

@BradLarson

Copy link
Copy Markdown
Member Author

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.

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.

3 participants