Skip to content

Enable passing in a GPU architecture string via env var#3176

Merged
angeloskath merged 2 commits intomainfrom
gpu_arch
Feb 27, 2026
Merged

Enable passing in a GPU architecture string via env var#3176
angeloskath merged 2 commits intomainfrom
gpu_arch

Conversation

@angeloskath
Copy link
Member

We tend to use this string for routing to kernels and so on and it can be helpful to test different pathways quickly. See for instance with or without NAX and so on.

Copy link
Member

@jagrit06 jagrit06 left a comment

Choose a reason for hiding this comment

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

Looks good! Should work as expected on the gemm kernels

@angeloskath angeloskath merged commit d7a553c into main Feb 27, 2026
16 checks passed
@angeloskath angeloskath deleted the gpu_arch branch February 27, 2026 19:37

inline const std::string& metal_gpu_arch() {
static std::string gpu_arch_ = get_var("MLX_METAL_GPU_ARCH", "");
return gpu_arch_;
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if some sanity checks should be done here? E.g., we use .back() on the arch name in a number of places...

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops overzealous merging.

Well there is the assumption that device_->architecture()->name()->utf8String() can't be the empty string. Given that the PR fixes the error of accessing positions -3 and -2 and also assuming these were in 0-9.

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