News: 0001584061

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

CLUDA Posted For Mesa: Gallium3D API Implemented Atop NVIDIA CUDA Driver API

([Mesa] 5 Hours Ago Mesa CLUDA)


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 API 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 [1]this open merge request .



[1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37831



[War] is instinctive. But the instinct can be fought. We're human
beings with the blood of a million savage years on our hands! But we
can stop it. We can admit that we're killers ... but we're not going
to kill today. That's all it takes! Knowing that we're not going to
kill today!
-- Kirk, "A Taste of Armageddon", stardate 3193.0