Zig gpu kernel for macOS (via spirv) Developer Danielkonge published a Zig example on Codeberg that runs GPU kernels on macOS by compiling through the spirv64-vulkan target and converting to Metal with spirv-cross. The developer reported the build system was straightforward, but the main difficulty was finding a clean way to use slices inside the kernel, a limitation that does not arise when compiling directly for amdgcn-amdhsa-none or nvptx64-cuda-none. The developer noted the setup should work cross-platform if spirv-cross is used only to produce .metal files without compiling them via xcrun, and pointed to spirv-cross's recent addition to allyourcodebase as a possible way to simplify the build steps. I finally got some time to look at this a bit more, see here. https://codeberg.org/Danielkonge/mac gpu example.zig LLM disclosure: I got lazy with comments and docstrings, and some of the setup was done with LLM help, since I didn’t want to really focus on writing a proper SHA256 implementation without slices that I could use. What I was interested in was just playing with mac GPU kernels in zig code. The build system stuff ended up all being pretty easy, and the main annoyance was actually that I couldn’t find a nice way to use slices in the kernel. When compiling directly for amdgcn-amdhsa-none or nvptx64-cuda-none you don’t run into this, but going through spirv64-vulkan it is a problem. Overall I thought the setup worked pretty well, and if you only use spirv-cross to get .metal files and don’t compile them with xcrun , I guess everything should work well cross platform too. As an aside, I saw recently that spirv-cross was added to allyourcodebase, so the build steps might be nicer with that now: https://codeberg.org/allyourcodebase/spirv-cross https://codeberg.org/allyourcodebase/spirv-cross