>_ DevTrendsen

Language

Home

Languages

Sections

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Embedded Security
Python

How to Build ROCm Without Losing Your Mind

If you've ever tried to deploy the ROCm (Radeon Open Compute) stack for neural network work on AMD GPUs, you know it's quite an adventure. Usually it ends either with installing massive binary packages that drag half of the system's dependencies along, or trying to compile everything from source, which turns into an endless quest to find the right library versions.

Recently I stumbled upon the TheRock repository from the AMD team. It's an attempt to make the HIP and ROCm build and deployment process human-friendly. The project is currently in early preview status, but it already looks like a lifeline for those who want to use the latest PyTorch or JAX features on AMD hardware without waiting for official distribution releases.

What's Inside This "Stone"

TheRock (The HIP Environment and ROCm Kit) is a lightweight build platform. Essentially, it's a massive CMake project that can pull in the required ROCm components, patch them, and build them into a single cohesive unit.

The main value here isn't in the code per se, but in the infrastructure. The folks at AMD have released the tools that, judging by everything, they use themselves for daily builds.

Here's what the project offers right now:

  • Nightly builds of ROCm and PyTorch. If you need a fix that landed in master just yesterday, this is your path.
  • Support for building PyTorch and JAX from source specifically for ROCm.
  • Cross-platform compatibility. Works on various Linux distributions and, surprisingly, natively on Windows 11.
  • Fine-grained customization. You can strip out everything unnecessary (like debuggers or specific communication libraries) and build only what you need for your specific task.

How It Works in Practice

The project uses Python scripts for environment preparation and CMake for the actual build. An interesting detail: DVC (Data Version Control) is used to manage heavy binary data (like compiled MIOpen kernels). This really saves time during compilation since you don't have to rebuild everything from scratch.

To get started on Ubuntu 24.04, the process looks something like this:

After that, the CMake magic begins. You can specify your GPU architecture using the flag. If you don't know which "head" you have, there's a script in the repository that will suggest the right target.

Build Flexibility

TheRock implements a modular flag system. If you're not doing distributed training on clusters, you probably don't need communication libraries like RCCL. You can simply turn them off:

The list of components is impressive: from the compiler and runtime to video processing libraries (rocDecode, rocJPEG) and profiling tools. There's even emulation support via ROCjitsu, which is useful if you're writing code for a GPU you don't have on hand right now.

Speeding Up the Process with ccache

Building LLVM and heavy ML libraries takes a long time. The TheRock developers understand this and added scripts for configuring ccache. Moreover, they've accounted for the specifics of compiling code for AMDGPU (the flag), which can sometimes make regular ccache act up.

On Linux, this is enabled with a single command:

After that, repeated builds go much faster.

Who Will Benefit from This

I see three main scenarios where TheRock is really useful:

  1. Researchers and ML engineers: when you need to run the latest PyTorch with support for new ROCm features that haven't yet made it to stable Docker images.
  2. Library developers: if you're writing something on top of HIP, TheRock provides a convenient sandbox with all the debugging tools (ROCgdb, rocprofv3).
  3. Windows users: ROCm support on Windows is still catching up to Linux, and having a clear build guide via VS 2022 is a big plus.

The TheRock project isn't "just another installer" — it's more like a professional workbench. Yes, it requires understanding how CMake works and what dependencies your system needs. But in return, it gives you full control over the ROCm stack.

If you're tired of fighting package conflicts in your system or want to squeeze the maximum out of your Radeon for machine learning tasks, take a look at this repository. Just keep in mind that the project is in early access — bugs are possible, but the community and AMD developers are quite active there.

You can check the nightly build status and documentation on their

Related projects