Rust-GPU / rust-gpu

🐉 Making Rust a first-class language and ecosystem for GPU shaders 🚧
https://rust-gpu.github.io
Apache License 2.0
980 stars 27 forks source link

Related project: LLVM SPIR-V backend? #33

Closed Ekleog closed 1 month ago

Ekleog commented 1 month ago

Hey! I'm coming across rust-gpu, and saw that you're reimplementing a full rustc backend.

Would it make sense to add, in the readme's "related projects", LLVM's SPIR-V backend?

For people like me, who have literally no idea about GPU rust and looked into it only to properly evangelize rust to people who do GPU development, it'd be very helpful to have an idea about why LLVM's backend doesn't match the needs for Rust development.

Anyway, thank you for the work you put into rust-gpu, and feel free to close this issue if you think it doesn't make sense!

Firestar99 commented 1 month ago

The LLVM SPIR-V backend (mostly) targets OpenCL, not vulkan. The confusing part is that they both share the same SPIR-V as a binary IR (intermediate representation), but with different capabilities allowing them to interact with the hardware very differently. While officially they do have a vulkan target triple, if you look at the supported extensions, most of these are OpenCL-specific extensions not available in vulkan (hard to spot if you're not familiar with the space). So I'd expect their vulkan support to be very bare bones. But feel free to have a look the few months old Vcc - the Vulkan Clang Compiler