Performance of llama.cpp on AMD ROCm (HIP) #15021
Replies: 71 comments 131 replies
RX 7800 XT (Sapphire Pulse 280W)ggml_cuda_init: found 1 ROCm devices:
build: 00131d6 (6031) ggml_vulkan: Found 1 Vulkan devices:
build: baad948 (6056) Notes:
|
|
Happy to replicate: ggml_cuda_init: found 1 ROCm devices:
build: 9c35706 (6060) On Linux |
RX 7600 XTggml_cuda_init: found 1 ROCm devices:
build: 9c35706 (6060) Running on Linux 6.12.32, mainline amdgpu, ROCm 6.4.1. ggml_vulkan: Found 1 Vulkan devices:
build: 9c35706 (6060) |
|
AMD MI60. Happy to contribute.
I will post FA=1 and vulkan results once I have time during the weekend. |
MI100Using ./llama-bench -m llama-2-7b.Q4_0.gguf -ngl 99 -fa 0,1 -sm none -mg 0
build: 9c35706 (6060) I'm running Ubuntu 24.04.2 and ROCm 6.4.1 |
AMD Instinct MI300Xroot@0-4-9-gpu-mi300x1-192gb-devcloud-atl1:~/llama.cpp# ./build/bin/llama-bench -m llama-2-7b.Q4_0.gguf -ngl 99 -fa 0,1
build: 2bf3fbf (6069) Ref: #14640 |
Pro V620Why does FA slow down the V620 so much? Been a question I've been trying to answer for a while now.
build: 03d4698 (6074) Linux, ROCm 6.4.1 ( will try upgrading soon) |
Powercolor Hellhound RX 7900 XTX (400W power limit)Opensuse tumbleweed system with rocm packages from
build: 5c0eb5e (6075) Sapphire Nitro 7900 XTX (400W power limit)In a different PC unfortunately because these GPUs are too chonky to fit in a regular case
build: 9c35706 (6060) |
Powercolor Red Devil 7900XTXAdrenalin 25.8.1 just came out, so time to test again
ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 ROCm devices:
Device 0: AMD Radeon RX 7900 XTX, gfx1100 (0x1100), VMM: no, Wave Size: 32
build: 2572689 (6099) Still lower than the historical highs on May 26th (3599 and 3743), and a loss and a win against July 22nd (3529 and 3598). |
|
RX 7900 XTX (ASUS TUF)
build: 6c7e9a5 (6118) |
RX 6800 (16GB 203W)ROCm 6.3.4 on Ubuntu 24.04 in a Docker container
build: 79c1160 (6123) Bonus benchmarksI ran these to compare ROCm versions on various models. Obviously the results are specific to my RX 6800 and shouldn't be used to make any judgments about ROCm performance in general, especially on RDNA3 and later gpus. I use 6.3.4 because I don't care about LLama 3 8B. Note how fast the new MoE models are - gpt-oss-20B even at Q6_K_XL is faster than this 7B Q4_0 model. (Do make sure that you have a fixed version because the original gpt-oss releases had some issues - I used https://huggingface.co/unsloth/gpt-oss-20b-GGUF). ROCm 6.3.4
ROCm 6.4.3
|
|
RX 7900 XTX (ASUS TUF a bit overclocked for 100 mhz for core and VRAM) ./build/bin/llama-bench -m /home/vk/Downloads/llama-2-7b.Q4_0.gguf -ngl 99 -fa 0,1
build: 648ebcd (6146) |
|
RX 6900 XT AMD Reference Card (Stock clocks) Debian Testing llama.cpp version: gguf-v0.17.1-386-gfd1234cb
|
|
GigaByte R9700
|
Radeon RX 9070 (non-XT)
build: 65349f2 (6183) I tried to enable the use of rocwmma with Still surprising that these numbers are better than the 9070 XT. |
|
ROCm 7.2.3 /workspace/llama.cpp/build/bin/llama-bench -m /data2/llm/models/llama-2-7b.Q4_0.gguf -ngl 99 -fa 0,1 -p 512 -n 128 --device ROCm0
build: 046e284 (9085) 2 card on PCI 4
build: 046e284 (9085) |
|
rocm Version : 7.13.0a20260508-1
|
Radeon 890M
Running the more detailed test of: Getting results of:
build: 338ea1e (9127) |
|
A data point from the image-diffusion side, since the rocWMMA flash-attn numbers here are (understandably) all LLM token-generation. Diffusion attention is a different shape — non-GQA ( Setup: AMD Radeon AI PRO R9700 (Navi 48 / RDNA4 / gfx1201, 32 GB),
So ~6% on the attention kernel, ~2.5% on total wall, output verified correct at the same seed. Two things worth noting for other AMD/diffusion users:
The small gain is consistent with this workload being memory-bandwidth-bound at 1024² (O(n²) over 4096 tokens), not matmul-FLOP-bound — matrix cores help, just not a lot here. The same card sees a bigger relative benefit at smaller, more compute-bound configs. Happy to run more diffusion points (resolutions/steps/other RDNA cards) if it's useful to the rocWMMA tuning work in #16827 — it's a fixed-context, non-GQA stress case the LLM benchmarks don't cover. |
|
Quick follow-up to my earlier diffusion numbers — the rocWMMA flash-attn win on RDNA4 turns out to be strongly config-dependent, which lines up nicely with the LLM results others have posted in this thread. Same setup as before (R9700 / gfx1201 / ROCm 7.0.2 / rocWMMA 2.0, FLUX.1 Krea Q4,
So at small / compute-bound configs the matrix-core path is a big win (~2.4×), but as resolution grows the attention becomes memory-bandwidth-bound (O(n²) K/V streaming) and the gain shrinks to a few percent. Same shape as the LLM side here — large on long-context prefill, modest on short prompts / decode. Net for image-diffusion users on RDNA4: definitely worth building with rocWMMA fattn on (ROCm 7 / rocWMMA 2.0) — just be aware the upside is very workload-dependent. For reference, with FA on the R9700 lands right next to an A6000 (CUDA) at the same diffusion recipe. |
|
OS: CachyOS
build: ba5b911 (9518) Just for gigs, Vulkan, it is quite a bit faster.
|
PowerColor AMD Radeon AI PRO R9700Using ./build/bin/llama-bench -m models/llama-2-7b.Q4_0.gguf -ngl 99 -fa 0,1 -sm none -mg 1 (which seems to be the fastest of the 4 cards I have)
build: 6e9007a (9641) I'm running Ubuntu 24.04.4 and ROCm 7.2.4 |
|
Updating Mi210 it seems overall better than before. Thermals are just ok for this run at 53C idel. ggml_cuda_init: found 2 ROCm devices (Total VRAM: 131040 MiB):
build: 6e9007a (9641) |
|
Going to wave this flag, just so not missed. :) I have an AMD Instinct MI25. At 16GB, it could in theory run decent-sized models. In the present hyper-overpriced world, the MI25 can be had for under $100. This is older hardware. Not (remotely) what you would use for commercial research. Not what you would use for production. But if you care less about time, do not want to burn tokens, and do not want to send data into the cloud - looks like a useful alternative. Seems this old card wants ROCm 5.4.3 (which I have). Seems the present llama.cpp does not work with this old card. The infallible AI (Microsoft Copilot) eventually came to the conclusion that this is impossible. As a recently retired software guy, I have other things to do, so care less if the LLM runs a bit longer. Before wandering off to try other approach, going to put the question in front of llama.cpp folk, to be sure this is a choice. :) |
|
im used https://github.com/lemonade-sdk/llamacpp-rocm
officialy bin https://github.com/ggml-org/llama.cpp/releases/download/b9994/llama-b9994-bin-ubuntu-rocm-7.2-x64.tar.gz works bad
|
RX 9070 XT (gfx1201) — Vulkan vs ROCm/HIP on Fedora 44Hardware
Software
Note: Fedora is not an officially validated distro for ROCm. ROCm 7.1.1 is the version available in Fedora 44 official repositories (ROCm 7.2 added official gfx1201 support, but 7.1.1 works on Fedora without Build flagsVulkan: ROCm/HIP: Benchmark resultsModel: Vulkan (3 runs):
ROCm/HIP (3 runs):
ObservationsToken generation (tg128): Vulkan is consistently ~23% faster than ROCm/HIP (220 vs 179 t/s). Both are very stable across runs. Prompt processing (pp512): ROCm is remarkably stable across runs (<1% variance). Vulkan shows high variance between runs — the first run after a cold start is fast (~7500 t/s), subsequent runs drop to ~5600 t/s. This is likely related to radv shader pipeline cache warm-up behavior. gfx1201 on ROCm 7.1 (Fedora): The GPU is correctly identified without Fedora note: ROCm is not officially supported on Fedora, but the packages available in Fedora 44 official repos (rocm-runtime 7.1.1) work correctly for llama.cpp inference on gfx1201. This may be a useful data point for anyone running RDNA4 on a non-Ubuntu distro. Post structure and formatting assisted by Claude (Anthropic). All benchmarks, system configuration, and observations are my own. |
|
For those who are wondering about gfx90c. ROCm Vulkan |
Strix Halo (AMD AI Max 395+, gfx1151) with ROCm 7.14The standard benchmark numbers that show somewhat ~10% improvement, compared to the current numbers. Built |
|
Strix Halo ROCm (HIP) numbers, measured head-to-head against Vulkan on the same machine. Hardware: Ryzen AI MAX+ 395 / Radeon 8060S (gfx1151) / 128 GB LPDDR5X UMA, Ubuntu 24.04.4, kernel 6.17. Method: llama.cpp master (2026-08), separate ROCm (HIP) + Vulkan (RADV) builds, llama-bench + llama-server, single request serial, ±5%/cell. Decode throughput (tok/s):
On this box ROCm trails Vulkan: bare −2~−25% (dense 27B only Full matrix + scripts: https://github.com/JJJJJovi/strix-halo-benchmark |
|
llamacpp version: b10590 llamacpp compiled with; Card Setting: GPU1 (Core up to 3000mz, vram up to 2650mz, power up to 350W) Card Setting: GPU1 + GPU0 (Core up to 3000mz, vram up to 2650mz, power up to 350W) -sm layer,tensor Tensor + fa 0 - doesn't work run with fa 1 only Interestingly, split tensor for such a small model makes it worse instead of helping. For comparison gemma 4 31B Q8: Tensor + fa 0 - doesn't work run with fa 1 only Very nice performance for dual gpu with tensor split (about +50% for generation is impressive, the boost in processing is less impressive - but it's still nice). |


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This is similar to the Performance of llama.cpp on Apple Silicon M-series, Performance of llama.cpp on Nvidia CUDA and Performance of llama.cpp with Vulkan, but for ROCm! I think it's good to consolidate and discuss our results here.
We'll be testing the Llama 2 7B model like the other thread to keep things consistent, and use Q4_0 as it's simple to compute and small enough to fit on a 4GB GPU. You can download it here.
Instructions
Either run the commands below or download one of our ROCm(HIP) releases. If you have multiple GPUs please run the test on a single GPU using
-sm none -mg YOUR_GPU_NUMBERunless the model is too big to fit in VRAM.Share your llama-bench results along with the git hash and ROCm info string in the comments. Feel free to try other models and compare backends, but only valid runs will be placed on the scoreboard.
If multiple entries are posted for the same device I'll prioritize newer commits with substantial ROCm updates, otherwise I'll pick the one with the highest overall score at my discretion. Performance may vary depending on driver, operating system, board manufacturer, etc. even if the chip is the same. For integrated graphics note that your memory speed and number of channels will greatly affect your inference speed!
ROCm Scoreboard for Llama 2 7B, Q4_0 (no FA)
ROCm Scoreboard for Llama 2 7B, Q4_0 (with FA)
More detailed test
The main idea of this test is to show a decrease in performance with increasing size.
All reactions