r/ROCm
•
u/Look_0ver_There
•
Aug 14 '26
•
1
llama.cpp boosts for RDNA3+
---------------------------------
Edit: Important note @ 12:01am US EST 16th Aug 2026 - If you had downloaded a copy of my diffs before this time then please update them as soon as possible. A number of issues with MTP correctness were discovered both in the upstream mainline branch, as well as my own code, and a further decode correctness issue was uncovered for certain model sizes. These should all be addressed now. If anyone finds any further issues, just drop me a note and we'll try to get it sorted ASAP.
---------------------------------
With a lot of new model releases lately and Qwen3.8-27B right around the corner, I wanted to share a set of ROCm/RDNA focused speed up I've been working on. These largely exist as a set of diffs that can be applied cleanly on top of upstream llama.cpp, and my goal was to get ROCm up to parity with Vulkan, or as close as possible.
I have a 7900XTX, Strix Halo, and a machine with 3 x R9700's GPUs in it, so I've been testing my work against all three architectures. I want to share a bunch of graphs for the R9700's which shows the relative speedups achieved.
My git repo branch is here: https://github.com/stew675/llama.cpp/tree/rdna-boosts
I tested Qwen3.6-27B, Muse Glimmer 30B, and Gemma4-31B. For single cards I used the Q6_K quants of these models (except for Glimmer where Q8_0 did fit well), and for 2 or 3 cards I used the Q8_0 model weights.
One element of my changes is I targetted native BF16 support for the KV cache. I know that it came as a surprise to me that standard ROCm support in llama.cpp just maps BF16 to F16 for the KV cache, and this mapping both slows things down, AND gives zero precision benefit. There was literally no good reason to choose BF16 for KV cache, ever, with ROCm. The curious thing though is that for Vulkan, it DOES implement BF16 KV cache correctly.
As such, the graphed runs below are all with a BF16 KV cache, which is hardware supported, at least for the important vector dot product operations, on anything RDNA3+. Scalar BF16 support isn't properly there, but that doesn't matter here.
My test system runs Fedora44. My build sequence for standard Fedora ROCm is:
HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" cmake -S . -B build \
-DGGML_RPC=1 \
-DGGML_HIP=ON \
-DGGML_NATIVE=1 \
-DGGML_HIP_RCCL=1 \
-DHIP_PLATFORM=amd \
-DGGML_HIP_GRAPHS=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_BUILD_TYPE=Release \
-DGGML_HIP_ROCWMMA_FATTN=OFF \
-DCMAKE_CXX_COMPILER=clang++ \
-DGPU_TARGETS="gfx1200;gfx1201" \
-DCMAKE_INSTALL_RPATH="\$ORIGIN" \
-DAMDGPU_TARGETS="gfx1200;gfx1201" \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
-DCMAKE_HIP_FLAGS="-mllvm --amdgpu-unroll-threshold-local=600"
cmake --build build --config Release -j 16 -- VERBOSE=1and if you have ROCm 7.14 installed, it's this:
ROCM_714=/opt/rocm-7.14-gfx1201
[ -d "$ROCM_714" ] || { echo "error: $ROCM_714 not found" >&2; exit 1; }
export ROCM_PATH="$ROCM_714"
HIPCXX="$ROCM_714/lib/llvm/bin/clang" HIP_PATH="$ROCM_714" cmake -S . -B build \
-DGGML_RPC=1 \
-DGGML_HIP=ON \
-DGGML_NATIVE=1 \
-DGGML_HIP_RCCL=1 \
-DHIP_PLATFORM=amd \
-DGGML_HIP_GRAPHS=ON \
-DGPU_TARGETS="gfx1200,gfx1201" \
-DCMAKE_C_COMPILER="$ROCM_714/lib/llvm/bin/clang" \
-DAMDGPU_TARGETS="gfx1200,gfx1201" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER="$ROCM_714/lib/llvm/bin/clang++" \
-DCMAKE_INSTALL_RPATH="\$ORIGIN:$ROCM_714/lib" \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
-DCMAKE_HIP_FLAGS="-mllvm --amdgpu-unroll-threshold-local=600"
cmake --build build --config Release -j 16 -- VERBOSE=1All tests were done using llama-benchy against a live llama-server instance. I chose a generation size of 240 as that seems to align fairly closely with the typical tool-call generation size, and I chose a prefill size of 2520 to be representative of typical agentic coding input sizes.
As such, my test command invocation looks like so:
uvx llama-benchy --base-url http://localhost:8033/v1 --tg 240 --pp 2520 --model Muse-Glimmer-30B-Q8_0 --tokenizer meta-models/Muse-Glimmer-30B --depth 0 4096 8192 16384 32768 65536
I have a PR against upstream llama.cpp for some of this work, but it seems to be getting ignored, likely because it doing changes against the CUDA kernels, and so they (probably rightfully) don't trust some random yahoo like myself to be messing with that stuff. Still, I don't want to let that get in the way of sharing these tweaks with the ROCm community.
I hope people find this stuff to be useful. The speeds do apply to all 7xxx series cards, and the Strix Point/Halo architectures, but some speedups were only viable on RDNA4, so your results may be mixed depending on what you're using.
2
u/ExistingAd2066 Aug 14 '26
Is there any numbers vs vanilla llama.cpp/kyuz0/amd-strix-halo-toolboxes?
1
u/Look_0ver_There Aug 14 '26
The Vulkan and ROCm Standard lines on graphs 4 to 8 are vanilla llama.cpp
I didn't compare against kyuz0's toolboxes directly as I tend to run all my servers bare metal.
1
u/ExistingAd2066 Aug 14 '26
What are TP1-TP3?
1
u/Look_0ver_There Aug 14 '26
Tensor Parallelism. TP=1 is using 1 card, 2 => 2 cards, 3 is 3 cards
Vulkan doesn't support tensor parallelism though, and can only use layer parallelism. It's for this reason that even though it prefill speeds go up, its generation rates tank, whereas for ROCm with tensor parallelism, both prefill and generation speeds go up with more GPus.
1
1
u/rmyvct Aug 14 '26
Hey OP! This sounds like a very welcome improvement! If I understand correctly, you modified the implementation of ROCm KV cache management to be properly implemented like Vulkan does thus it results into a prompt processing and decode speeds greater or equal to vulkan values? I assume that if one uses a q8_0 value for kv cache flags, there is no improvement as it is a fp16 only improvement right?
2
u/Look_0ver_There Aug 14 '26
There's actually a whole host of changes in the change set. I'm in a rush at the moment (heading out), so if you'll excuse the AI generated summary. It doesn't do anything specifically to accelerate KV cache sizes other than BF16. There's other people who've covered that sort of thing so I didn't want to redo what's already been done.
rdna-boosts: CUDA/HIP performance work for RDNA (AMD) GPUs
Flash-attention (BF16 KV cache)
Read BF16 K/V natively in the flash-attn tile kernel with FP32 accumulation; merged the packed-BF16 tile path (BF16 Q + v_dot2) into the FP32-accum path so packed BF16 PV is the single native-BF16 VKQ path
Native-BF16 tile kernel now covers all head sizes with a BF16 KQ buffer; cleanups for KQ_cs 8, merged tile loads, head-112 test coverage
v_perm operand order verified on RDNA3/RDNA4
RDNA4 WMMA flash-attn + Q6_K prefill
Fixed a head-256 WMMA flash-attn combine race and tuned RDNA4 kernel configs; WMMA FA path enabled by default up to head 576 on RDNA4 (opt-out via GGML_CUDA_FA_WMMA_256=0; RDNA3/3.5 stay at head <= 128)
Folded Q6_K mmq sub-scales into the row base-scale to remove an int-mul from the WMMA result scale chain (Q6_K mmq ~40 -> 58 TFLOPS)
Verified on gfx1201: Q6_K pp512 d16384 759 t/s (Vulkan: 736), Gemma 4 31B (head 512, softcap 30) pp512 d4096 945 vs 804 t/s
Q6_K decode / mmvq
New VDR=2 Q6_K mmvq decode kernel processing both 8-element chunks per call (amortizes loads, ~halves loop iterations), bit-identical vs VDR=1
gfx1151 mmvq table with nwarps=2 for Q8_0 decode
Fuse paired mmvq matmuls (e.g. attention K/V projections) over a shared activation into one launch via a new dst_gate fusion argument
Kernel fusion / graph optimization
Fuse MUL_MAT + ADD through a view node; cache quantized Q8_1 matmul inputs per graph
Fuse SSM gate/beta projections into one kernel; fuse the SSM conv-output L2 norm pair
Fuse shared-expert output chain into one op; fold MoE topk-weights MUL into the down projection
Fold the norm-input Q8_1 quantize into the rms norm kernel; write Q8_1 in the gating-MUL kernel
Fuse IMRoPE + set-rows for BF16 KV cache
Reliability / correctness
Backed out the integrated-GPU host-buffer path on HIP (restored by PR #24233) after it corrupted full-model results on a Strix Halo iGPU under async execution (PPL 5.92 -> 8.5+ without HIP_LAUNCH_BLOCKING); forcing integrated=false restores async-safe operation
llama.cpp side
Skip the Meta device wrapper with a single GPU; align attn_gate TP split granularity with attn_q
Tooling/tests
GGML_CUDA_OP_TIMING now disables CUDA graph capture (event records are illegal during capture), plus per-op timing and new decode-shaped MUL_MAT perf cases
All kernel changes are verified bit-identical to the unfused paths and pass test-backend-ops (1194/1194 MUL_MAT, 4552/4552 FLASH_ATTN_EXT across three GPUs).
1
u/ImpressionFancy5830 Aug 14 '26
Nice, have you tested this against rocprof?
2
u/Look_0ver_There Aug 14 '26
rocprofv3 haunts my dreams 😄 (the answer is yes)
2
u/ImpressionFancy5830 Aug 14 '26
Nice, in a week I should be back to my beloved r9700 so I can test your PR
1
u/Maplesyrup000 Aug 14 '26
Hey OP, I recently bought an R9700 and plan on using it on the same machine as my 7900xtx, so I wanted to ask, have you tried mixing RDNA3/4 cards on the same rig? Any luck with ROCm or will only Vulkan work?
1
u/Look_0ver_There Aug 14 '26
I believe you should be able to mix safely. The RDNA4 specific stuff does actually run on RDNA3, it just gives no speed benefit. If it seg-faults, then try recompiling llama.cpp with only gfx1100 support (7900xtx) and see if that works.
In short, I haven't tried it specifically, but if you compile for the lowest common denominator it should work, but I cannot give guarantees
2
u/Maplesyrup000 Aug 17 '26
So I put the R9700 in my rig and results have been pretty decent. 38 tg and 1100 pp with Qwen 3.8 27B Q8 - ofc performances degrades as context grows but I thought this numbers were pretty good for mixed RDNA architecture. I’d be curious to know what your getting with just R9700s
2
u/blackhawk00001 Aug 15 '26 edited Aug 15 '26
Yes, it works and is faster than either gpu alone but is limited to layer splitting in llama.cpp. Install rocm for both gfx1101 and 1201 then compile llama.cpp local. Vulkan performance has been bad for me after moving to rocm 7.14 but rocm better after tuning. I set the R9700 to 210W and XTX to 300W both with a -75 undervolt. Q8_0 models worked best.
R9700 is gpu 0 and XTX gpu 1.
I'm still testing on the changes in this branch but these commands work well for me in the base llama.cpp.
./llama-server -m /home/dev/models/protoLabsAI/ThinkingCap-Qwen3.6-27B-MTP-GGUF/ThinkingCap-Qwen3.6-27B-Q8_0-MTP.gguf -md /home/dev/models/protoLabsAI/ThinkingCap-Qwen3.6-27B-MTP-GGUF/mtp-ThinkingCap-Qwen3.6-27B-head-Q8_0.gguf -fa on -c 131072 --fit on --fit-target 512 --no-mmap -b 2048 -ub 256 --temp 0.6 --top_p 0.9 --top_k 20 --min_p 0.0 --spec-type draft-mtp --spec-draft-n-max 3 -t 12 --parallel 1 --jinja --host 192.168.1.221 --port 5678 -ngl 999 -sm layer --tensor-split .4,.6 --cache-type-k q8_0 --cache-type-v q8_0 ./llama-server -m '/home/dev/models/huihui-ai/Huihui-Qwen3.6-35B-A3B-abliterated-MTP-GGUF/Huihui-Qwen3.6-35B-A3B-abliterated-ggml-model-Q8_0.gguf' --mmproj '/home/dev/models/huihui-ai/Huihui-Qwen3.6-35B-A3B-abliterated-MTP-GGUF/mmproj-model-f16.gguf' -fa on -c 204800 --fit off -ngl 99 --no-mmap -b 2048 -ub 256 --temp 0.7 --top_p 0.8 --top_k 20 --min_p 0.0 --presence_penalty 1.5 --repeat-penalty 1.0 --spec-type draft-mtp --spec-draft-n-max 3 --parallel 1 --chat-template-file /home/dev/models/huihui-ai/qwen_template_unsloth.jinja --host 192.168.1.221 --port 5678 -sm layer --reasoning auto --reasoning-budget 4096 --reasoning-budget-message "Thinking budget exceeded, let's wrap up and give the final answer now." -t 12 --tensor-split .46,.54 --main-gpu 01
u/Maplesyrup000 Aug 15 '26
Thank you. I will try this config later. I saw another guy who had the same GPUs but had more success with Vulkan, especially for MoE models.
1
u/superdariom Aug 15 '26
I don't understand the graph what sort of improvement is seen on 7900 for example?
1
u/Look_0ver_There Aug 15 '26 edited Aug 15 '26
All the graphs are Radeon AI Pro R9700 only. Their main point is to demonstrate how the Tweaked ROCm scales with 1 or more cards, and how the tweaked ROCm compares with stock ROCm and stock Vulkan.
The first 3 graphs are showing scaling with tensor parallelism for 3 different models for 1, 2, or 3 GPU's, when using the ROCm Tweaked backed.
The 4th, 5th and 6th graphs compare Qwen3.6-27B with different backends (Vulkan, stock ROCm, tweaked ROCm) at TP=1 for the 4th graph, TP=2 for the 5th, and TP=3 for the 6th graph
Graphs 7 and 8 show single GPU speed comparisons for Gemma4-31B and Glimmer-30B for various backends. It's trying to show that for generation that tweaked ROCm matches with Vulkan (which is generally the fastest for decode), and it also significantly faster than Vulkan for prefill.
There are no R9700XTX results shown. I didn't graph those yet, but the speedups are similar there.
Strix Halo speed up are also real, but on the Strix Halo the tweaked ROCm trails Vulkan for generation by 3-5% (as opposed to 10-40% with stock ROCm). Prefill speeds on Strix Halo are roughly equal between Vulkan and tweaked ROCm up to about 32K, after which time Vulkan falls away quickly while the tweaked ROCm only has a steady slow fall-off.
1
u/quackie0 Aug 15 '26
What's the difference between this and just turning on the hipblaslt?
2
u/Look_0ver_There Aug 15 '26 edited Aug 15 '26
Isn't HIPBLASLT disabled by default due to crashes and other issues in llama.cpp? Also I'm pretty sure it isn't activated any time when quantization is involved. (See next paragraph). The short answer is HIPBLASTLT doesn't intersect with my changes at all.
In any event, I decided to explore your suggestion just now. Exploratory test environment was using Qwen3.6-35B-A3B-Q8_0 on a Strix Halo.
When HIPBLASTLT is enabled, just 0.4% of all kernel calls took the HIPBLASLT library path (80 out of 21252 total calls). Those 80 calls account for 1.7% of the total GPU work when HIPBLASLT is disabled, and 1.1% of the total GPU work when it is enabled. I also verified that NONE of my code changes any of the code that those 80 GEMM calls that were routed to the HIPBLASLT library.
ie. you can run my code, AND turn on HIPBLASTLT, and the code-paths taken are completely independent of each other. Absolutely zero cross-over. So if enabling HIPBLASLT gives you some benefit, then that benefit would be over and above what my code is providing.
I then ran a performance benchmark of llama.cpp with my changes compiled for ROCm-7.14 on a single R9700Pro GPU. This is running Qwen3.8-27B-Q8_0, BF16 KV-cache, 72K context. That fits comfortably on a single card when MTP is diabled. I compared against standard llama.cpp compiled for ROCm-7.14 and enabled
My Tweaked ROCm:
| model | test | t/s | peak t/s | ttfr (ms) | est_ppt (ms) | e2e_ttft (ms) | |:-----------------|----------------:|---------------:|-------------:|-----------------:|-----------------:|-----------------:| | Qwen3.8-27B-Q8_0 | pp2520 | 1128.30 ± 2.08 | | 2234.38 ± 4.51 | 2234.05 ± 4.51 | 2234.38 ± 4.51 | | Qwen3.8-27B-Q8_0 | tg240 | 20.12 ± 0.02 | 21.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d4096 | 1151.68 ± 0.67 | | 5745.55 ± 3.77 | 5745.22 ± 3.77 | 5745.55 ± 3.77 | | Qwen3.8-27B-Q8_0 | tg240 @ d4096 | 19.96 ± 0.00 | 20.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d8192 | 1144.22 ± 0.28 | | 9363.62 ± 2.67 | 9363.29 ± 2.67 | 9363.62 ± 2.67 | | Qwen3.8-27B-Q8_0 | tg240 @ d8192 | 19.79 ± 0.07 | 20.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d16384 | 1084.24 ± 5.50 | | 17436.62 ± 88.92 | 17436.28 ± 88.92 | 17436.62 ± 88.92 | | Qwen3.8-27B-Q8_0 | tg240 @ d16384 | 19.47 ± 0.00 | 20.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d32768 | 966.28 ± 0.56 | | 36520.77 ± 22.19 | 36520.44 ± 22.19 | 36520.77 ± 22.19 | | Qwen3.8-27B-Q8_0 | tg240 @ d32768 | 18.84 ± 0.00 | 19.00 ± 0.00 | | | |Stock ROCm llama.cpp with HIPBLASlt enabled:
| model | test | t/s | peak t/s | ttfr (ms) | est_ppt (ms) | e2e_ttft (ms) | |:-----------------|----------------:|---------------:|-------------:|-----------------:|-----------------:|-----------------:| | Qwen3.8-27B-Q8_0 | pp2520 | 1070.25 ± 2.23 | | 2355.60 ± 4.54 | 2355.22 ± 4.54 | 2355.60 ± 4.54 | | Qwen3.8-27B-Q8_0 | tg240 | 18.77 ± 0.01 | 19.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d4096 | 1051.08 ± 1.13 | | 6295.49 ± 6.41 | 6295.11 ± 6.41 | 6295.49 ± 6.41 | | Qwen3.8-27B-Q8_0 | tg240 @ d4096 | 18.14 ± 0.02 | 19.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d8192 | 1003.18 ± 0.82 | | 10680.07 ± 8.43 | 10679.69 ± 8.43 | 10680.07 ± 8.43 | | Qwen3.8-27B-Q8_0 | tg240 @ d8192 | 17.50 ± 0.01 | 18.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d16384 | 888.57 ± 3.30 | | 21276.69 ± 78.94 | 21276.31 ± 78.94 | 21276.69 ± 78.94 | | Qwen3.8-27B-Q8_0 | tg240 @ d16384 | 16.26 ± 0.01 | 17.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d32768 | 716.86 ± 0.35 | | 49228.44 ± 23.86 | 49228.06 ± 23.86 | 49228.44 ± 23.86 | | Qwen3.8-27B-Q8_0 | tg240 @ d32768 | 14.36 ± 0.00 | 15.00 ± 0.00 | | | |So, once again, the results show that my tweaks are doing something completely different to what enabling hipblaslt does.
I did then run my code with hipblaslt enabled, and the results show no noticeable performance change to my tweaks, or if there is a change, it falls within "noise"
Tweaked ROCm llama.cpp with hipblaslt enabled:
| model | test | t/s | peak t/s | ttfr (ms) | est_ppt (ms) | e2e_ttft (ms) | |:-----------------|----------------:|---------------:|-------------:|-----------------:|-----------------:|-----------------:| | Qwen3.8-27B-Q8_0 | pp2520 | 1130.58 ± 2.82 | | 2230.36 ± 5.56 | 2229.84 ± 5.56 | 2230.36 ± 5.56 | | Qwen3.8-27B-Q8_0 | tg240 | 20.08 ± 0.01 | 21.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d4096 | 1151.50 ± 1.73 | | 5746.96 ± 8.62 | 5746.44 ± 8.62 | 5746.96 ± 8.62 | | Qwen3.8-27B-Q8_0 | tg240 @ d4096 | 19.91 ± 0.01 | 20.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d8192 | 1143.17 ± 0.78 | | 9371.87 ± 7.06 | 9371.35 ± 7.06 | 9371.87 ± 7.06 | | Qwen3.8-27B-Q8_0 | tg240 @ d8192 | 19.77 ± 0.02 | 20.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d16384 | 1083.98 ± 4.39 | | 17441.41 ± 71.25 | 17440.89 ± 71.25 | 17441.41 ± 71.25 | | Qwen3.8-27B-Q8_0 | tg240 @ d16384 | 19.46 ± 0.00 | 20.00 ± 0.00 | | | | | Qwen3.8-27B-Q8_0 | pp2520 @ d32768 | 965.33 ± 0.55 | | 36556.68 ± 22.13 | 36556.16 ± 22.13 | 36556.68 ± 22.13 | | Qwen3.8-27B-Q8_0 | tg240 @ d32768 | 18.83 ± 0.00 | 19.00 ± 0.00 | | | |1
u/quackie0 Aug 15 '26
Interesting. 🤔 What I meant is the results, not the mechanics, being the same as turning on hipblaslt lol but you proved me wrong. I am on gfx1152 Ryzen AI 7 350 w/ 860m iGPU and hipblaslt gives me a speed up. I bump up LLAMA_ARG_BATCH and LLAMA_ARG_UBATCH to 2048, and set ROCBLAS_USE_HIPBLASLT=1, ROCBLAS_USE_HIPBLASLT_BATCHED=1, ROCBLAS_DEFAULT_ATOMICS_MODE=1, TENSILE_SOLUTION_SELECTION_METHOD=2, MIGRAPHX_SET_GEMM_PROVIDER=hipblaslt. I am on Windows and I build ROCm myself from TheRock.
Anyhow, I know some of the env vars are placebo (not applicable to my machine) but together they speed up my inference. There are crashes to my graphics driver but it happens with specific models and way before I started using and tweaking hipblaslt. I guess the way I have it, everything is routed through hipblaslt so all I see in the logs is rocblas calling hipblaslt. I wish people tweaked their batch and ubatch numbers to fit their VRAM. Those are the most impactful regardless of arch (especially for token ingestion).
1
u/blackhawk00001 Aug 15 '26 edited Aug 15 '26
I tested your branch on my temporary XTX with R9700 setup compiled for rocm 7.14. I saw a small prefill boost at really low depths but the end result was near the same or slightly lower. Tg decode was the same as before.
I had previously worked on fine tuning my -u, ub, and layer tensor-split ratio to get best performance. -b 2048 -ub 256 was best on layer split with different speed gpus.
The split architecture works and the performance is better than either GPU individually, but I recommend going dual xtx or dual r9700. Dual r9700 layer in llama.cpp was slightly faster and matching R9700 get much better performance in vllm with tensor parallel.
1
u/Look_0ver_There Aug 15 '26 edited Aug 15 '26
Edit so this stays high up in this thread. blackhawk's setup is mixing RDNA3 and RDNA4 together, and my changes presently won't activate in that situation.
That sounds like my tweaks weren't actually activating at all. I'll re-run the tests at my end to verify. Do you have a copy of your llama-server startup command? I want to test and see if I can reproduce.
Also, what model were you using? What quant level? What KV cache? There's certain models and quants that won't even activate my code at all. My code is (presently) largely focused at Q6_K or Q8_0 model weights where the main head dim size > 128, and for BF16 KV cache.
If you're running certain highly quantized models with a quantized KV cache, then my work won't do anything for you.
In that case, you'd be better off using Nathanw1014's work here: https://github.com/Nathanw1014/strix-halo-llamacpp
1
u/blackhawk00001 Aug 15 '26
In my config the R9700 is gpu 0 and XTX is gpu 1. I also previously had to install 7.14 compute packages for both gfx1101 and gfx1201.
Please let me know if you see anything wrong with mine or something to test out.
./llama-server -m /home/dev/models/protoLabsAI/ThinkingCap-Qwen3.6-27B-MTP-GGUF/ThinkingCap-Qwen3.6-27B-Q8_0-MTP.gguf -md /home/dev/models/protoLabsAI/ThinkingCap-Qwen3.6-27B-MTP-GGUF/mtp-ThinkingCap-Qwen3.6-27B-head-Q8_0.gguf -fa on -c 131072 --fit on --fit-target 512 --no-mmap -b 2048 -ub 256 --temp 0.6 --top_p 0.9 --top_k 20 --min_p 0.0 --spec-type draft-mtp --spec-draft-n-max 3 -t 12 --parallel 1 --jinja --host 192.168.1.221 --port 5678 -ngl 999 -sm layer --tensor-split .4,.6 --cache-type-k q8_0 --cache-type-v q8_0 ./llama-server -m '/home/dev/models/huihui-ai/Huihui-Qwen3.6-35B-A3B-abliterated-MTP-GGUF/Huihui-Qwen3.6-35B-A3B-abliterated-ggml-model-Q8_0.gguf' --mmproj '/home/dev/models/huihui-ai/Huihui-Qwen3.6-35B-A3B-abliterated-MTP-GGUF/mmproj-model-f16.gguf' -fa on -c 204800 --fit off -ngl 99 --no-mmap -b 2048 -ub 256 --temp 0.7 --top_p 0.8 --top_k 20 --min_p 0.0 --presence_penalty 1.5 --repeat-penalty 1.0 --spec-type draft-mtp --spec-draft-n-max 3 --parallel 1 --chat-template-file /home/dev/models/huihui-ai/qwen_template_unsloth.jinja --host 192.168.1.221 --port 5678 -sm layer --reasoning auto --reasoning-budget 4096 --reasoning-budget-message "Thinking budget exceeded, let's wrap up and give the final answer now." -t 12 --tensor-split .46,.54 --main-gpu 02
u/Look_0ver_There Aug 15 '26
Okay, so immediately I see you're using a high level of quantization and also quantized KV cache. My changes aren't going to do much of anything for your use-case scenario.
Try giving the code base here a try: https://github.com/Nathanw1014/strix-halo-llamacpp
That says it's focused for the Strix Halo, but much of his work is actually generic tuning work for high quantization levels of both the models and the KV cache.
I've not personally tried his branch on my 7900XTX yet though, so take this as only a suggestion.
1
u/Look_0ver_There Aug 15 '26
I really should reach out to Nathan and see if he doesn't mind if I try to merge his stuff with my stuff. The two projects pretty much have zero code over-lap and should merge together nicely.
1
u/blackhawk00001 Aug 15 '26
Cool, thanks. I'll try without kv cache at q8 later today when I have a chance and look at that repo.
I tried with various quantizations and found Q8_0 to perform best, and the Q8 kv cache helps fit my context but need to retry without it.
I also noticed you were not using mtp which I need to try and replicate.
This is only a temporary setup until I receive the rest of my hardware order end of this next week but am happy to try and optimize the setup to help others. I might add one back someday if the price is right. It works really well for MOE but dense doesn't have the tensor parallel speedup.
2
u/Look_0ver_There Aug 15 '26
Silly me. I just realised you're splitting across both RDNA3 and RDNA4. I've not tested that. Let me see if that's even possible. My code has fairly aggressive gating to ensure it doesn't get activated where it shouldn't be, and it may be that it's purposefully deactivating itself and falling back to standard llama.cpp behavior.
Edit: I already confirmed that a mixed target will deactivate my code. Let me see if I can find a way around it.
1
u/Look_0ver_There Aug 15 '26
What was your build command? Did you set "gfx1100,gfx1200,gfx1201" for both GPU_TARGETS and AMDGPU_TARGETS in your cmake setup?
If not, then this immediately explains why it deactivated. If you did, then I'll need to dig deeper.
Also, enable BF16 for KV cache to get the full benefit of the changes.
1
u/blackhawk00001 Aug 15 '26
I just realized you have a few extra pieces in your build command. I'll replicate and retest. I just reused my saved build script.
cmake -S . -B build -DGGML_HIP=ON -DAMDGPU_TARGETS="gfx1100,gfx1201" -DCMAKE_BUILD_TYPE=Release -DGGML_HIP_ROCWMMA_FATTN=ON -DGGML_HIP_UMA=OFF && cmake --build build --config Release -- -j 12
1
u/Look_0ver_There Aug 15 '26
Yeah, the RCCL stuff is important. Also, GGML_HIP_ROCWMMA_FATTN is completely removed from the code-base by upstream llama.cpp, so that flag is doing nothing now.
Ultimately a heterogeneous tensor split is going to be gated by llama.cpp's own all-reduce handling (I never touched that code). It is completely untested as to what happens in that scenario.
Basically you're treading new and untested ground here. Try rebuilding with my full build config and see if that changes anything, but there's no promises, sorry.
1
u/blackhawk00001 Aug 15 '26
This might take me a bit. Something in one of the arguments you use in the cmake broke my CMAKE_C_COMPILER value and my previous build is not finding it. It worked once when I restarted the terminal but now isn't coming back...
1
u/Look_0ver_There Aug 15 '26
Oh, you probably just need to put the compiler path back to wherever you installed your 7.14 library. My installation path is almost certainly different to yours.
Edit: I just grabbed AMD's 7.14 repo here: https://rocm.docs.amd.com/en/latest/install/rocm.html?fam=radeon&w=compute&os=ubuntu&ubuntu-ver=26.04&i=tar&gpu=ai-r9700&gfx=gfx1201
It says Ubuntu, but it works fine on Fedora too.
1
u/blackhawk00001 Aug 15 '26
Yeah the old command is working after deleting the build directory, something must be hanging onto it there. I'll keep poking at it.
1
u/Look_0ver_There Aug 15 '26
One additional "curl" to all of this is that the 7900XTX is a little faster than the R9700Pro, but because it has less memory, the tensor split is being done based upon memory capacity, nd NOT compute performance. This can add its own set of biases that even if we do get it all working on your pair, then the bulk of the compute load is still going to be running on the (slightly) slower card. This is true regardless of running my code or not though. I'm just pointing out that heterogeneous multi-plexing here likely isn't going to show either card in its best light.
2
u/blackhawk00001 Aug 15 '26
Does your changes override any of the tensor split ratios? I found found the mixed architectures to perform best with as much weight as possible moved to the XTX. It's still a weird setup though, I do recommend pairing the same gpus if possible after my testing.
Also the low -ub values allowed for the two to stay closely in sync without waiting on the other
2
u/Look_0ver_There Aug 15 '26
Yeah, moving as much split to the XTX as possible is exactly what I'm referring to. You're essentially balancing by compute performance, rather than memory capacity, and that's exactly the right thing to do.
I don't know if you have access to cloud model API or not. I use DeepSeek V4 Flash 0731 mostly. It literally costs a handful of cents. You could probably just fire up your favorite coding agent, point it at the code, tell it what model you want to run, and say "make it work!", and it'll figure it out for you. The main "gotcha" with Deepseek is that it wants to call llama-cli toi test with, but it forgets to pass "--single-turn" to the command, and so sits there until it times out waiting for llama-cli to respond. You need to point this out to the model at the start so it doesn't waste time.
Edit: Oh, and no, nothing in my code touches tensor split stuff.
1
u/superdariom Aug 16 '26
I'm very interested to try this out, can I just use your master branch on your repo? How does that compare to the PR you submitted? - I could test that out as well and leave a comment there to try to boost visibility. What build flags should I use for 7900 xtx? You should link your PR so others can also help to test it. You should also include a table on the PR which shows for each case the before and after and the +- improvement in speed. The maintainers have to be careful not to merge something which slows something else down or offers very small gains.
1
u/Look_0ver_There Aug 16 '26
Use the same build command I listed in the opening post, but add gfx1100 to the set of GPU architectures in place of where you see gfx1200 and gfx1201 there.
My original PR, which is based upon the first 7 commits from my branch, is here: https://github.com/ggml-org/llama.cpp/pull/26856 Actually that reminds me. One of the MTP issues I uncovered yesterday was in commit 7, so I really should go fix up that PR. Part of what stung me there though was that there's actually a whole bunch of MTP errors in the CPU-only baseline with the mainline. With yesterday's MTP work I had to first find and fix two separate CPU MTP decode issues in mainline to get back to a stable baseline to build up the MTP fixes in my branch.
The maintainers have to be careful not to merge something which slows something else down or offers very small gains.
Yeah, it's a tough job they have. They're trying to keep everything stable and have it all work generically for an incredible range of both models and hardware setups. Mistakes do creep in so very easily.
I may need to withdraw my PR and see if I can trim it right down to the barest essentials, but it's kind of difficult to add BF16 support where none existed previously at all in a "tiny change set".
I also very much doubt that they'd be interested in my changes to their native CUDA kernels. It makes things faster for RDNA3+ GPUs, but it may have adverse effects on nVidia GPUs and I have no way of testing that. This is why I opted to just keep my changes as a collective set on top of the mainline master branch.
I also admit to being somewhat scared to submit too many changes, as they've banned people for that sort of thing, so I am trying to play it safe here and just keep my changes self-contained.
1
u/superdariom Aug 18 '26
So I can't get it to work, neither tensor or layer mode work and I just get ////// as the output tokens. I think I had this problem before and I seem to remember it relates to this error which I think the binary I was running before has some special fix but I don't remember exactly where it came from: llama_sampler_backend_support: device 'ROCm1' does not have support for op TOP_K needed for sampler 'top-k'
1
u/Look_0ver_There Aug 18 '26
Can you share your exact llama-server command? I'll try to reproduce when I get the chance.
1
u/superdariom Aug 19 '26
So I changed up a bunch of things, updated to 7.14 rocm etc but I couldn't get this to work at all until I set GGML_HIP_RCCL=0 during build - it either bombed out during startup or outputted garbage ////// after a certain number of tokens. After that change I tested tensor and layer split on dual 7900 xtx with qwen 3.8 Q8 MTP - The performance for layer split seems identical to stock llama.cpp (720pp on 100k input tokens 36 t/s on output) and for tensor split I am not sure as I don't think I ever got that working right before but it seemed to do a consistent 500 pp over 100k input and output was 48 t/s) - I previously made the decision to use layer split as for coding I definitely need fast prefill but the 500 figure is not that slow compared to 700 so its possible that this is somewhat improved. I'm sorry my testing is so unscientific. (I should mention my second gpu slot is a poor man's chipset connected 4x)
1
u/Look_0ver_There Aug 19 '26
Ah, the chipset connected GPU running at PCIe4x4 I presume is going to add enough latency that it's going to outweigh pretty much everything else.
It'll work, but it will be the by far the dominant factor in anything performance dependent and make it very difficult to assess any gains. It's probably going to be ~80% of the inter-card issue and my changes are trying to speed up the 20% that remains.
1
u/superdariom Aug 19 '26
Yeah I don't think I can get a better pcie slot without going to ddr5 and I have 128gb so would need to choose between that or sending my kid to college
1
1
u/alphatrad Aug 28 '26
u/Look_0ver_There dude are you on X? I want to give you a solid follow!
I got this setup on my machine - which is also 3X R9700's and saw a great bump in performance. However - hit one bug. I opened an issue on your repo today.
2
u/Look_0ver_There Aug 28 '26
No X for me sorry. Reddit is about the only Social Media presence I have.
I'll go check out the issue now and see what's up
2
u/alphatrad Aug 28 '26
Oh well. Excellent work! I now got this up to 59.2tok/s and 1058tok/s prefill running Qwen3.8-27B Q8_0 verified runs on localmaxxing:
https://www.localmaxxing.com/en/runs/cmtdfljvx004dlm0125ofpfqd
1
u/Look_0ver_There Aug 28 '26
I see that you have P2P turned on. I found that actually slowed decode speeds down (but makes prefill faster). Might be something to check out. I personally run with P2P disabled, but mind you all my cards are only PCIe5x4 and that may be the cause of what I'm seeing.
2
u/alphatrad Aug 28 '26
I'm on PCIe4 but my cards are x8x8x4 - still on an AMD4 system here. I did figure out the bug.
2
u/Look_0ver_There Aug 28 '26
I've (well, Deepseek did what I asked it to) investigated the issue. I wasn't able to reproduce it locally, but based upon your report it found something that it believes will fix your issue. There's a full report it made over on GitHub. Hopefully it fixes it for you.
2
u/aeroG1 Aug 14 '26
I'm going to be testing this when I have time over the next week. Hope that the maintainers actually consider this. We can leave comments about real world performance improvements we are measuring on the PR if that helps?
1
u/mechkbfan Aug 18 '26
This is all pretty awesome. I'm just coming up to speed about what to buy next / expectations of performance
If I understand correctly, 2xR9700 is the sweet spot
BUT, I can certainly get a lot better deals on 2x7900XTX where I am
If by any chance could you compare your 7900XTX vs 9700XTX with these tweaks, or even jut offhand give an approximation?
I don't want to buy it and be underwhelmed if it's nowhere to what you're achieving on the 2xR9700
Thanks again for post and obviously interested in the follow ups. It's really exciting what the community is doing with AMD stuff just in last few months alone
1
u/Qbason Aug 30 '26
Wow! Really good job. I have enabled for the first time RCCL and applied your changes. I see even x2 boost!
In my case I use rx 7900 xtx 24gb and rx 7900 xt 20gb.
Pro tips for others, if you use proxmox and passthrough your gpus card to vm, you need to be gpu specific and don't include audio from gpu ex. 000:13:00.0 otherwise you encounter error https://github.com/ROCm/legacy-rocm-build/issues/6520 . It took me a long time to figure it out.
If someone is intrested I can put my dockerfile to build it and run under llama-swap 😄








5
u/nasone32 Aug 14 '26
HA! this is very welcome. i was alredy using HIP because of faster prompt processing. this is helpful. maybe you can do a PR in smaller chunks? this is good work. I'll try it