Can Rust be used also for compute? It would be a great way to dislodge CUDA lock-in, since something in Rust could be a lot better option than either CUDA or OpenCL.
Can Rust be used also for compute? It would be a great way to dislodge CUDA lock-in, since something in Rust could be a lot better option than either CUDA or OpenCL.
It can, but it's worth noticing that the programming paradigm is different. For this reason, I would assume you are still writing a DSL within Rust which can use Rust's type checker to help you figure out what to write and how, but Rust in itself cannot represent the same semantics as-is that is required to write efficient parallel code. So, you still need to be a domain expert. But, automating the bytecode writing is alleviated by Rust's ability to provide packages etc.
I refactored some OpenMP code to run on SPIR-V using the Vulkan API the OP project uses, and I must say that I cannot see myself doing it in any other language than Rust.
I use CUDA, but DirectCompute is OK too.
> I often see complaints about it
People complain about all technologies they use. The more popular the technology is, the more complaints on the internets you gonna see.
My largest complaint about graphics compute is inability to spawn threads in runtime. DispatchIndirect and append buffers often help to workaround, but still limited, not really an equivalent to CUDA’s dynamic parallelism.
> rather than anything better or worse about either model
Not sure what do you mean by that?
CUDA exposes more stuff (dynamic parallelism mentioned above, intrinsics to shuffle data across threads, and a few others) but still, the model is pretty much the same. These CUDA’s triple angle brackets directly map to Dispatch arguments, and [numthreads] values in HLSL.
The better or worse comment was more about having a heterogeneous environment vs using a graphics API to dispatch compute. I agree that generally speaking they are the same though, after all it's the same hardware.
Basically, I'd like there to be something that's ergonomic, using Rust and can eventually help get rid of CUDA lock-in.