Remix.run Logo
conorbergin 2 days ago

Zig is becoming a real do-everything tool for me. I was learning gpu programming recently and found you could compile it to SPIR-V!

AndyKelley 2 days ago | parent [-]

Oh yeah, everyone is sleeping on this use case. Plenty of work to go before we can advise people to try it out yet, but being able to share packed structs, enums, and compile-time logic across CPU and GPU code is going to be, quite literally, a game changer.

miki123211 2 days ago | parent | next [-]

Is this just for graphics programming, or are ML / scientific computing use cases (compiling to Cuda / SASS) considered too?

sgt 2 days ago | parent | prev | next [-]

Forgive my ignorance but what would be some practical use cases for this, for someone who hasn't been doing any GPU programming to understand? I guess Machine Learning?

wiz21c 2 days ago | parent [-]

currently, when you want to write a sahder, you have to use a specific language for that (gl/sl or some other). That's a pain because that language is C-like and most likely pretty close to your host language (C,Rust,Zig whatever). Moreover, you must pass information to these shaders (uniforms) and it means you have to write code to copy from you haost lang data structures to the data strctures of the shaders (which , once again, are pretty close to those in your host language). Shader languages don't usually have "import" mechanism, so building with them is painful. And their syntax is very light, so having syntactic sugar coming from the host language would be cool.

So yeah, writing shader in something else than Gl/SL, wgsl would make our life so much easier...

andyfleming 2 days ago | parent | prev [-]

Is that similar to the functionality they're targeting with Mojo?