RFC: Adding a native AMD ggml-hrx backend #27219
Replies: 9 comments 7 replies
|
Is there a document that describes the architecture of the backend? because looking at the code files it seems that the backend optimizes by model architecture. Would be interested to know how it is done without looking through the code. |
That's crazy amazing! |
|
Sounds great! Will it also support clustering more than one Strix Halo system? With Nvidia Spark and Apple being competitors offering RDMA tensor parallelism, this is an important aspect. |
|
For those interested in building and running: To execute you will need access to a W7900 or AI Max+ 395. You can observe the available device via the llama-cli when built with the HRX backend enabled. |
|
I had to adapt the build so that it took the clang from rocm The build took me 1m and 6s. Because I have only a GFX1150 iGPU I cannot test if it would work. |
|
So close, yet so far on 7900XT. |
|
We have a newer version with support for llama 3 across multiple quantization formats and This is more generalized so we should have a good cadence for increasing model coverage while moving away from the qwen focused implementation. |
|
Tried it out on my Strix Halo 395+ / 128GB. Based on some quick testing with my local coding harness, can confirm that this is definitely on the right track. The results also matched what I observed as a test just summarizing paragraphs with each directly in llama.cpp. Great stuff! HRX vs HIP — Qwen3-30B-A3B-Instruct-2507 Q4_K_M, gfx1151 (Radeon 8060S / Strix Halo)Both backends built from llama.cpp
Notes
|
|
I really appreciate the smaller size, I always disliked the waste from the huge ROCm install, and I look forward to seeing how it compares on performance to https://github.com/warpfront/hipfire in the future. |
Uh oh!
There was an error while loading. Please reload this page.
(see draft PR: #27218)
At AMD, we are actively optimizing AMD GPU performance in llama.cpp under the existing Vulkan and HIP (CUDA-derived) backends. However, as ROCm matures on client systems, we have repeatedly run into the costs of not having AMD native backends and optimized client libraries that can be independently optimized for the best possible performance of the GPUs and NPUs on our silicon. In addition, as ROCm was originally developed primarily to service the datacenter market, it often faces headwinds when trying to integrate and deploy to client operating systems in a way that best meets the needs there. As a result, we have been working on a lighter, more focused subset of ROCm that is optimized for these use cases. We call this HRX, and we have been co-developing it with the needs of a dedicated llama.cpp backend for a couple of months, for eventual inclusion into ROCm proper as a focused, redistributable set of libraries.
While the work is still early, we wanted to discuss with the community the possibility of finishing this work and landing it as a new ggml-hrx backend in llama.cpp. While we have done a lot of experimental work to optimize this backend for a wide swath of models and use cases, we decided that for an initial debut and discussion, we would focus the contribution on a minimal kernel library sufficient to run the unsloth/Qwen3-30B-A3B-Instruct-2507-GGUF Q4_K_M model performantly on RDNA3 (W7900) and RDNA3.5 (Strix Halo). This RFC PR carries that minimum set, and we will continue to develop the branch for wide model, operating system, and system coverage.
HRX Technology
The HRX technology that underpins the ggml-hrx backend is optimized for client deployment use cases:
Performance
We are not going to cite absolute performance comparisons on this early work. Our existing published metrics and deployment paths remain our recommended way to get the best performance from llama.cpp on our hardware as this backend continues to evolve.
With that said, the performance benefits of this new technology are real. Compared to the faster between the existing Vulkan and HIP ggml backends, we are routinely achieving on the order of:
Further, the simplicity and vertical integration of the HRX stack makes exploiting performance advantages of specific cards much easier, compared with attempting to isolate performance improvements in the existing ROCm stack, which often has different historic optimization goals and many more software layers.
As we land more of the work for coverage and features, we will publish absolute benchmark claims. For now, this boilerplate PR was formulated to have the bare minimum to meet functionality and demonstrate single model/use-case performance on Strix Halo and W7900 to show viability without trying to land a full-coverage backend in one patch.
Build and Size
All in, the ggml-hrx backend presently adds ~32MiB on-disk/stripped above a CPU-only llama.cpp backend. It is standalone, requiring no additional software installation beyond AMD GPU drivers. We expect this number to decrease as some of the ROCm driver interface components are optimized for this use case.
On a 16-core/32-thread Ryzen AI MAX+ 395, a clean, uncached Release build with the HRX backend enabled completes in approximately one minute. This includes libhrx, the Loom compiler, ggml-hrx, llama.cpp itself, and kernel bundling for the JIT compiler. We expect that these numbers will grow upward somewhat with full coverage of models and systems, but the delta should be incremental.
At this footprint and build time, ordinary contributors can work across all of our software, directly as part of the final project, without high end build systems or the overheads and distribution complexity traditionally assumed to come with depending on software like ROCm.
Next Steps
We have biased this initial submission to be structurally minimal. As such, once landed, much of the work involves landing pre-work that has already been done for other models and GPUs:
Disclosure on AI Use
Per project policies, we are disclosing that significant portions of this project have been built with the assistance of AI. Specific models vary by contributor, but Codex with Sol was most commonly used for the ggml-hrx backend itself. The code was meticulously reviewed, revised and tested by hand in order to produce an implementation that should fit in with the rest of the project and that the contributors can explain and defend in detail. The kernels were heavily tuned and optimized through many rounds of our automated kernel tuning technology, which we will share more about at a later date.
Co-authored-by: Rob Suderman Robert.Suderman@amd.com
Co-authored-by: Ben Vanik Ben.Vanik@amd.com
Co-authored-by: Aryaman Vasishta Aaryaman.Vasishta@amd.com
Co-authored-by: Stella Laurenzo slaurenz@amd.com
All reactions