AMD Specific Patches for Llama.cpp

162 points - today at 5:11 PM

Source

Comments

rao-v today at 5:59 PM
Early in 2025 a bunch of folks realized that AMD made a bunch of cards with mediocre compute but incredibly fast HBM2 memory in their circa 2018 gfx906 datacenter series, so you could get 32GB VRAM capable of incredible 1 TB / s bandwidth for $200 (the closest in today’s cards is north of $3000)

There has been a rich little ecosystem of folks optimizing llama.cpp for these odd cards (no tensor cores, no native bf16 etc.) including my little personal repo https://github.com/kinchahoy/llama-of-vega.cpp. Stuff like this focused on more modern RDNA doesn’t help us at all.

It’s been interesting to see how much each new frontier model can figure out in terms of optimizing for these GPUs and what they can’t!

Fable and Astra will regularly run out of ideas until I point them to someone’s actually thoughtful repo and then they’ll diligently incorporate ideas.

The optimization wins are huge (I was initially skeptical that per model kernel optimizations would be worth much). 27B at a pristine Q8 quant goes from base llama.cpp at some 250 pp / 25 tg to 600 pp / 40 tg even before speculative decoding.

dofm today at 5:42 PM
I saw some blurb a while ago that described llama.cpp as a “model zoo”, which is a great description of its utility and generality.

In the last couple of days I have been playing with Erik Paperniuk’s M1 port of Inco’s Splash, which has completely transformed the speed of Qwen 3.8 27B and Inkling 2 Mini; it has essentially tripled the speed of the former and more than doubled the speed of the latter.

This means the Qwen model is fully viable on an M1 Max, where before I had found it a bit of a waiting game. And it arguably transforms the utility of Inkling 2 Mini; extra speed means it can be left to reason for longer, the downside of needing to do more tool use for search to patch its knowledge is reduced, and it provides a good rough chat model (though this is not its area of greatest strength).

I have not yet found anything that can boost Muse Glimmer to the same extent; I would still prefer that.

But for me I now find that only the rather slow prefill speed really holds the M1 Max back; I suspect these new custom kernels have made the M5 Pro Mac Mini a really cost-effective option if you want to tinker with local AI.

fiddlerwoaroof today at 7:10 PM
I have a MI100, and I managed to get Claude to double or triple the performance of Qwen3.8 by aggressively optimizing the AMD code and porting some of the Nvidia kernels to ROCm: https://github.com/fwoar-greenhouse/vicuna.cpp

I've been running this for a while and it seems pretty stable, plus I had Claude validate the ported kernels against the originals to make sure they were reasonably close numerically to the validated implementations.

rsolva today at 5:26 PM
Interesting! I have had Claude improve llama.cpp the last few days to get Inkling 2 Mini to fly on my 7900XTX, the improvement has been dramatic both for decode and prefill!

https://forge.dmz.skyfritt.net/ruben/llama-inkling-2-mini

d3Xt3r today at 6:59 PM
Julian, are you also able to benchmark Strata, HaloPFX and Hipfire please? All of these are optimised for AMD and perform much better than vanilla llama.cpp.
woadwarrior01 today at 5:27 PM
Incidentally, llama.cpp is now owned by NVIDIA (via their Huggingface acquisition).
newusertoday today at 7:53 PM
does anyone maintains patches like this for intel? intel's xmx engine is strong on paper but lags behind due to improper utilization of hardware especially on linux. Even on llama.cpp coopmat for vulkan is only enabled on windows for arrow lake.
mszcz today at 7:48 PM
It's sort of astonishing seeing the contrast of what last bit of performance people are squeezing out of all kinds of GPUs, old & new & weird, because there's a shortage vs. how the apparently abundant resources are being used in an "electron app" (the disk space, the RAM, the compute!).

I know it's apples to oranges but the difference I'm talking about is in the attitude and approach.

pixelesque today at 5:24 PM
I know it's not completely trivial to do this given how stochastic they are with normal (non-0-temperature) settings, but is anyone actually checking the output quality of the tokens with some of these optimisations, or just chasing pure speed like some of the projects at least appear to be doing?
pyrolistical today at 5:36 PM
Why won’t llama.cpp take these as PRs?
hypercube33 today at 5:57 PM
If I'm not mistaken there was/is an lm studio for strix halo. seems like it quit working but it was able to punch Qwen 3.6 as fast as the 8060s when it worked.

There is also a llama fork for Ryzen AI and Radeon cards but I'm on mobile.

peter_d_sherman today at 6:33 PM
>"Some examples of these new inference engines* are Strata, Basalt, RustingStrata, etc…

These new forks generally all have a few things in common:

o They focus on a specific subset of models and/or hardware

o They use a frontier model to vibe-code the entire thing

o They chase ever-higher token generation speeds

… and the results are stunning! Strata is able to run a heavily-quantized model of Qwen 3.8 Flash Next, a 180B parameter model, on a 16GB VRAM graphics card, and 16GB system RAM, and have it generate tokens at a surprisingly high rate.

Nice!

Hardware specific optimizations are definitely one key to faster local tokens, algorithmic optimizations (i.e., all of the academic papers published about different Matrix/Tensor algorithm optimizations as pertains to LLMs) are another...

Anyway, great article!

0xbadcafebee today at 7:20 PM
I've tried patches like this for my gfx1103, and I got a 15% boost to pp, 3% boost to tg... but it also couldn't use all my VRAM (unified memory), only the BIOS GART reserved mem - so I couldn't load larger models anymore, and had to go back to Vulkan.
bugbound today at 6:00 PM
[dead]