What this is about
A graphics card does nothing by itself. A program has to tell it what to do, and that talk goes through layers of software. For AMD cards, the main layer for compute work is called ROCm. It includes the driver pieces, the compilers and the libraries that AI programs call.
For Nvidia cards, the matching layer is called CUDA. If you have read about one, ROCm is AMD's answer. This article explains in plain words what it does, what tends to go wrong, and how we handle it.
Why it matters
On an AMD card, the software layer is part of whether your model runs at all, and how fast. Version mismatches, missing support for a card, and tools that crash are everyday problems. If you know the parts, you know where to look.
We use an RX 7900 XTX. Its chip family is called RDNA3, and its code name for the software is gfx1100. That name matters, because tools list which chip names they support.
The parts, from top to bottom
- Your program. A model engine, such as ours, or a picture program such as ComfyUI.
- Libraries. Ready-made math, such as the matrix multiplies a model needs. AMD's is hipBLASLt.
- The compiler. It turns code into the instructions the card runs. The tool
hipccdoes this for programs written in HIP, AMD's version of the CUDA style. - The runtime and driver. They move data to the card, start work on it and report back.
- Tools for measuring. A profiler shows what the card did. AMD's is
rocprofv3.
Our own engine is written in Mojo and builds its card kernels itself, so it leans less on the libraries and more on the compiler and runtime. We still run on the same driver. Our engine needs ROCm 7.2.
What tends to break
Support differs by chip. AMD's library tuning is concentrated on its datacenter chips. Gaming chips such as ours get a thinner share. That is why a hand-written kernel can beat the vendor library on our card at some sizes. It is also why some flags you find online either do nothing or break things on a gaming card. When we tried one experimental flag for picture work, the server aborted on the second run. Another, called fast mode, made one picture job 8 percent slower. A third tuning step cost a 200-second wait for no gain.
Tools crash. This is the story we most want you to read.
The profiler that crashed for the wrong reason
For four days we believed hardware counters could not be used with our Mojo kernels. The profiler crashed with a C++ error and then hung in a way that ordinary termination could not stop. Our notes said: counters are dead for our kernels.
That was wrong. A plain C++ program, with no Mojo anywhere in it, crashed the same way. The common factor was our machine. Every crash log held one line right before the error, about a second GPU that the profiler could not handle. It was the small graphics unit built into our Ryzen processor, which shows up as a second GPU to the software. It is named gfx1036.
We tried hiding it with an environment setting. That did not hide it from the profiler. When we unbound it from the driver, the same plain program ran, and the counter for waves read 32,768 for a kernel with 1,048,576 threads, which is exactly right at 32 threads per wave.
A second problem hid behind the first. With the crash gone, a counter for bytes read showed 0 for a kernel that reads 4 MB. The card's power setting was cutting off the counters. After setting it to a fixed standard level, the counters read right, 32,768 or 32,769 requests for 4 MB in 128-byte pieces.
The rule we took: a crash in the instrument is not a result about the thing measured. Before you read anything into a failure, run the instrument on a program whose answer you know to the digit.
What the fix cost
- The unbind has a side effect. A background service that applies our card's power limits crashed and stopped applying them. A reboot undoes it.
- The two steps that need administrator rights must happen before the job enters our queue, because queued jobs cannot ask for those rights.
- Times measured under the fixed power level are not comparable with normal ones.
- We lost four days to a wrong note, and then about twenty minutes redoing work we had already written down, because we did not search our own notes first. We logged that as a mistake.
One more caution. This is one machine, one ROCm version (7.2.4), and one profiler version. On a Mojo program, we still have no passing counter run. So for Mojo kernels we use two other tools: counts of instructions, and timings from a trace.
How we keep it working
- Check on the CPU first. Our engine's preflight needs no card.
- Read the card's state from the system files. Our small library, mojo-amdgpu, reads memory use, power and temperature without needing ROCm at all.
- Write down what each test could and could not see. Our "falsified" label once covered more than the test could reach.
- Pin versions. We note the exact versions in each result.
Words you may not know
- ROCm: AMD's software layer for running compute programs on its cards.
- gfx1100: the software name for our card's chip family, RDNA3.
- HIP: AMD's programming style for card code, close to CUDA.
- Profiler: a tool that shows what a program did on the card, and when.
- Counter: a number the card keeps about its own work, such as waves started.
- Driver: the software that lets the operating system talk to the card.
- Integrated GPU: a small graphics unit built into the processor.
Try it
- Read card telemetry without ROCm using mojo-amdgpu. It prints used and free memory, busy percent, power and temperature. It has since moved into our
mojo-libscollection. - See what a stall profiler shows on the card with wavewait. Its page lists what it needs, including
hipccandrocprofv3, and a doctor script that says what your machine lacks. - Before you trust a crash, run your tool on something with a known answer.
Read next
- The profiler crashed because the CPU has a GPU, the whole debugging story with its two updates.
- A Z-Image picture in 1.7 seconds, where several flags on this layer helped or hurt.

Komentarze
Brak komentarzy.
Zaloguj się aby skomentować.