Well, here is a weekend surprise… Red Hat engineer and Rusticl lead developer Karol Herbst has opened a Mesa merge request for “CLUDA” as a compute-only driver that implements the Gallium3D API atop the NVIDIA CUDA driver API. Wow.
Mesa’s CLUDA proposal implements the Gallium3D API atop the CUDA driver API and in turn is enough for compute-only workloads like Rusticl for Rust-based OpenCL. OpenCL so far at least is the main focus for CLUDA. For now CLUDA is at least a placeholder name.
Gallium-over-CUDA was just hacked about in recent days and is already running Mesa OpenCL atop the NVIDIA CUDA proprietary driver. Karol Herbst explained in this weekend’s pull request:
“”Somebody” mentioned to me at XDC (yes, I started this project like last week once I got home and got access to an Nvidia GPU) that implementing OpenCL on top of CUDA in mesa could help out with something. I can’t really talk about that something here, but rest assured it wasn’t me having this idea. But anyway, if somebody wants to run OpenCL against the propriety driver and they miss a few OpenCL extension that are super important to them, they could use this OpenCL implementation I guess? Or add more extensions if they wanted to? I dunno really. Anyway, this is my first project targeting CUDA, and so I also learned about CUDA and PTX quite a bit here.”
Interesting.
This Mesa CLUDA driver targets the NVIDIA CUDA driver APU within libcuda.so. CLUDA involves lowering Mesa’s common NIR to NVIDIA PTX for consumption then by NVIDIA’s proprietary compute stack. For now at least the testing has been with NVIDIA RTX 40 / Ampere hardware.
Performance is remarkably good for being such a young project. With LuxMark on this CLUDA driver is a score of 57,702 for a NVIDIA RTX A6000 while with the proprietary NVIDIA driver stack is a score of 64,009. Approaching 90% of the performance already of NVIDIA’s proprietary bits. Karol estimates that the NIR-to-PTX conversion costs some performance and other differences.
In any event those wishing to learn more about this “CLUDA” effort for Mesa’s Gallium API implemented atop the NVIDIA CUDA API can learn more via this open merge request.