GPU rendering in Blender with ROCm HIP on Linux
Updated for ROCm 6.3.1.
To enjoy the Blender rendering accelerated by an AMD GPU we have to use ROCm. Unfortunately few distributions are officially supported by ROCm, only Ubuntu is on the consumer side. A good practice is therefore to create an Ubuntu container using Distrobox and Podman, install the ROCm part that interests us and launch Blender with this container.
The point being that ROCm sometimes breaks the retro-compatibility and that we can keep using the latest working version with Blender for as long as needed. If you use others programs using ROCm − like IA −, it allows to have multiple different ROCm versions in parallel, each adapted to each program. And also to switch from one container to another to test the newer ROCm versions, so as to rollback quickly if needed.
Add the user to the groups video
and render
The execution of ROCm requires the use to be in the video
and render
groups. We start by create the groups before adding our user:
sudo groupadd video
sudo groupadd render
sudo usermod -aG video,render $LOGNAME
It will be necessary to disconnect the user or reboot the computer for it to takes effect.
Creating the Ubuntu container
Creation of an Ubuntu 24.04 container named "rocm63": distrobox create -i ubuntu:24:04 -n rocm63
We then enter into the newly created container: distrobox enter rocm63
We then update Ubuntu and we install some dependencies:
sudo apt update && sudo apt upgrade
sudo apt install build-essential libsm6
Adding the official AMD ROCm repo
We add the repo PGP key: wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
We add the repo to APT:
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.3.1 noble main" \
| sudo tee --append /etc/apt/sources.list.d/rocm.list
echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' \
| sudo tee /etc/apt/preferences.d/rocm-pin-600
Installation of HIP
HIP is the ROCm part required by Blender for the GPU rendering. It's an interface that convert the CUDA instruction to code supported by ROCm.
We start by updating the repos sudo apt update
then we install HIP sudo apt install hip-runtime-amd
Launch Blender by the container
On the command line it comes down to distrobox enter rocm63 -- /path/to/blender
Via a file blender-rocm63.desktop
duplicated from the original, this will require to modify these few lines:
[Desktop Entry]
Name=Blender (HIP 6.3)
[...]
Exec=distrobox enter rocm63 -- ./blender
Path=/path/to/blender/
TryExec=distrobox
It's advised to download Blender from the official website as to easily have different versions in parallel and create a symbolic link blender
to the desired version directory as to no have to modify the .desktop
file on every Blender update.
Enable HIP in Blender
In Preferences/System/HIP tab
check the GPU. Then in the Render Properties
of the scene, after having choose the Cycles
engine, select under as Device
the option GPU Compute
. Enjoy the speed ! 👌