@debugging
Hi everyone
I have just started solving “Mojo GPU Puzzles”. However, I failed to compile puzzle 1 with this error.
/Users/<user>/mojo-gpu-puzzles/problems/p01/p01.mojo:24:5: error: function instantiation failed
def main() raises:
^
/Users/<user>/mojo-gpu-puzzles/problems/p01/p01.mojo:24:5: note: call expansion failed with parameter value(s): (...)
oss/modular/mojo/stdlib/std/gpu/host/info.mojo:2257:9: note: function instantiation failed
oss/modular/mojo/stdlib/std/gpu/host/info.mojo:2266:43: note: call expansion failed with parameter value(s): (...)
oss/modular/mojo/stdlib/std/gpu/host/info.mojo:2482:5: note: function instantiation failed
oss/modular/mojo/stdlib/std/gpu/host/info.mojo:2515:5: note: constraint failed: GPU architecture 'metal:2-metal4' is not supported.
Supported GPU architectures:
NVIDIA: sm_52 (Maxwell), sm_60/sm_61 (Pascal), sm_75 (Turing), sm_80 (Ampere A100), sm_86 (Ampere A10), sm_87 (Orin), sm_89 (Ada L4/RTX4090), sm_90/sm_90a (Hopper H100), sm_100/sm_100a (Blackwell B100/B200), sm_110 (Jetson Thor), sm_120/sm_120a (Blackwell RTX5090), sm_121 (DGX Spark)
See: https://developer.nvidia.com/cuda-gpus
AMD: gfx90a (MI250X), gfx942 (MI300X), gfx950 (MI355X), gfx1030 (Radeon 6900), gfx1100 (Radeon 7900), gfx1101 (Radeon 7800), gfx1102 (Radeon 7600), gfx1103 (Radeon 780M), gfx1150/gfx1151/gfx1152 (Radeon 8xx), gfx1200 (Radeon 9060), gfx1201 (Radeon 9070)
See: https://rocm.docs.amd.com/en/latest/release/gpu_os_support.html
Apple: metal:1 (M1), metal:2 (M2), metal:3 (M3), metal:4 (M4)
I tried to find oss/modular/mojo/stdlib/std/gpu/host/info.mojo so I can change the string that checks the architecture as the exact architecture is detected as ‘metal:2-metal4’ but I couldn’t find it on my system. Moreover, I found the find on GitHub. So, I believe maybe the file is already compiled on my environment(?), which is set up by pixi.
Please help me finish my set up. Can’t wait to get my mojo stickers
There was a temporary problem with GPU detection for Apple silicon GPUs on macOS 26 in the nightlies that was recently resolved. It looks like the Mojo GPU puzzles are pinned to the nightly version just after that was introduced and before it was fixed. We’ll see about updating those to the latest version.
In the meantime, you can work around this by changing the version line in pixi.toml to read
max = "==26.3.0.dev2026042105"
and then deleting the pixi.lock and doing a
pixi clean
The next time you run, it should pull a good version of Mojo / MAX that has the support fixed for Apple silicon GPUs on macOS 26.
I was already on the verge of recompiling stdlib But you have already resolved it. Thank you!
It didn’t fix it and compiler asked me to report a bug, which I did.
opened 09:01PM - 28 Apr 26 UTC
bug
mojo
Needs Triage
### Bug description
### Actual behavior
When I attempted to run the the first p… uzzle of Mojo's GPU programming Puzzles on a MacBook with M2 architecture, by invoking:
`pixi run -e apple p01`
I got the following output:
`✨ Pixi task (p01 in apple): mojo problems/p01/p01.mojo
/Users/alibahrani/mojo-gpu-puzzles/problems/p01/p01.mojo:1:1: error: Metal Compiler failed to compile metallib. Please submit a bug report.
from std.memory import UnsafePointer
^
/Users/alibahrani/mojo-gpu-puzzles/.pixi/envs/apple/bin/mojo: error: failed to run the pass manager
alibahrani@Alis-MacBook-Air mojo-gpu-puzzles % `
I already had other problems expressed in the [forum](https://forum.modular.com/t/mojo-puzzles-fail-to-compile-on-a-supported-architecture-apple-m2/3008)
### Expected behavior
It should print either the challenge is passed or failed without error
### Steps to reproduce
- Please paste or attach the .mojo files that are needed to reproduce the issue.
- If you are able to reduce the reproduction steps to a small example, this would be much appreciated!
- Please quote the command line you used to compile and/or run the example.
- If you see a crash or an error message, please paste it in the "actual behavior" above.
- If using the Godbolt / Compiler Explorer, share the example link.
- Include anything else that might help us debug the issue. Your insights and observations are welcome!
### System information
- Provide the system information by running `pixi info`.
- Provide version information for MAX (includes Mojo) by pasting the output of `pixi list max`.
Make sure you’ve run
xcodebuild -downloadComponent MetalToolchain
to install the proper Metal compilation tools first. When I did the above steps, pixi run -e apple p01 compiles correctly on my Mac with the same configuration as yours.
That fixed it. Thank you.
out: HostBuffer([10.0, 11.0, 12.0, 13.0])
expected: HostBuffer([10.0, 11.0, 12.0, 13.0])
Puzzle 01 complete ✅
Thanks @BradLarson ! The mojo gpu puzzles are now updated to the latest nightly that includes the fix for Apple silicon GPU detection.