AMD Quietly Funded A Drop-In CUDA Implementation Built On ROCm: It's Now Open-Source

Written by Michael Larabel in Display Drivers on 12 February 2024 at 09:00 AM EST.

There are some known limitations though like currently only targeting the ROCm 5.x API and not the newly-released ROCm 6.x releases.. In turn having to stick to ROCm 5.7 series as the latest means that using the ROCm DKMS modules don't build against the Linux 6.5 kernel now shipped by Ubuntu 22.04 LTS HWE stacks, for example. Hopefully there will be enough community support to see ZLUDA ported to ROCM 6 so at least it can be maintained with current software releases.

Radeon GPU running CUDA-Z on Ubuntu

ZLUDA was also mostly tested against RDNA2 (Radeon RX 6000 series) hardware during its development given its timing. Though my testing of RDNA3 (Radeon RX 7000 series) hardware with ZLUDA has been working out well for not being the primary target. My main source of issues was with the wrong ROCm device being automatically selected given the differences between ROCm and CUDA device selection. With ROCm and testing from the Ryzen 9 7950X, the CPU, the integrated graphics, and the discrete GPU were all being detected by ROCm and in turn exposed by ZLUDA and in turn the CUDA software not automatically selecting the desired target. Making use of ROCm's HIP_VISIBLE_DEVICES=[UUID] environment variable and specifying the GPU's UUID via the rocminfo output I found to work well for ensuring the targeted CUDA device was in fact the discrete GPU desired. I'm told that GFX9 and RDNA1 may work as well with some bugs but given their age and my limited time, I focused on the newer and more relevant RDNA2/RDNA3 GPUs.

Radeon GPU running V-RAY GPU CUDA

Using ZLUDA is as easy as building the code (or grabbing the release) and then using the $LD_LIBRARY_PATH environment variable to specify the path to ZLUDA's various CUDA library drop-in replacement files. From there launching CUDA software should "just work" if all goes well. Among the CUDA-enabled software that's been tested by Janik includes Geekbench, Blender CUDA, 3DF Zephyr, Llama.cpp, Arnold, LuxCore, LAMMPS, OpenFOAM, XGBoost, NAMD, and other software packages. Some of these software packages have since adopted native ROCm/HIP support but keep in mind this ZLUDA on Radeon effort has been in the works now for 2+ years.

All of my testing has been under Linux but this ZLUDA for AMD GPUs is said to work as well on Microsoft Windows.

ZLUDA Radeon Benchmarks

With a few RDNA2 and RDNA3 graphics cards I ran ZLUDA with ROCm 5.7 on Ubuntu 22.04 LTS while comparing the performance to some similar NVIDIA RTX 30/40 series graphics cards on its NVIDIA 550.40.07 driver on the system system.


Related Articles