Repository navigation
Conversation
Above 6144 keys the tile kernel runs 6 query tiles with the prefetch when a KV head has 3 query heads (Inkling 2: 24/8 heads): 18 waves, 5 on each SIMD of the WGP. gfx1151 has 1536 VGPRs for each SIMD lane, gfx1150 and gfx1152 have 1024. The kernels of Inkling 2's attention take 247-255 VGPRs, so 4 waves fit on gfx1150 and the compiler rejects the kernel (AMDGPU/052). The fused bias paths then abort with "failed to run node"; a FLASH_ATTN_EXT without a bias leaves its output unwritten. If the compiler rejects the prefetch kernel, the short-KV workgroup (2 query tiles, 6 waves) runs instead. The failed build is cached, so it is tried once for each configuration. GQA ratios 2, 4 and 8 get 16-wave prefetch workgroups, which fit, so they do not change. New test-backend-ops cases with 8192 keys and 512 queries for the 24/8 head geometry: the bias table as a SUB, as a MUL_MAT, and no bias. On gfx1150 (Radeon 890M) all three fail without this change. Assisted-by: Claude Code
Plain FLASH_ATTN_EXT with 8 KV heads and 5, 6 or 7 query heads for each, 8192 keys and 512 queries: prefetch workgroups of 20, 18 and 21 waves. On gfx1150 (Radeon 890M) all three fail on master (the compiler rejects the kernel, AMDGPU/052, and the output is left unwritten) and pass with the previous commit. Assisted-by: Claude Code
Decide before compiling instead of compiling the prefetch kernel and falling back when the compiler rejects it. The fallback gave the right result, but each new configuration logged an AMDGPU/052 error. The waves of the prefetch workgroup run on the 4 SIMDs of a WGP and its kernels take up to 256 VGPRs, so it is used if ceil(waves / 4) <= VGPRs of a SIMD lane / 256: 4 waves on each SIMD with 1024 VGPRs (gfx1102, gfx1103, gfx1150, gfx1152), 6 with 1536 (gfx1100, gfx1101, gfx1151). ggml_hrx_arch gets the VGPR count of each architecture, as in the residency model of the hrx-system runtime (1536 on gfx1100, gfx1101, gfx1151 and gfx12, 1024 on the other gfx11). Checked offline against the Loom compiler of hrx-system v0.2.0: the prefetch kernel of the tile for 2 to 8 query heads for each KV head, in 7 variants (mask, vector mask, bias SUB, bias MUL_MAT and combinations), compiled for the seven gfx11 targets, 343 builds. The compiler accepts exactly the workgroups that this rule allows: all of them on gfx1100, gfx1101 and gfx1151 (up to 21 waves; the kernels take 224-256 VGPRs) and only the 16-wave ones on gfx1102, gfx1103, gfx1150 and gfx1152 (the 18-21 wave kernels take 236-255 VGPRs; 4 waves fit, 5 or 6 are needed). So gfx1151 keeps the same workgroups as on master. Assisted-by: Claude Code
dzannotti
left a comment
There was a problem hiding this comment.
Verdict
Correct and safe to merge. On Strix Halo the change does nothing, as intended, and every output we compared is byte-identical to master, also past the 6144-key boundary. It changes kernel dispatch, so it needs one maintainer approval. Our points below are about comments and test cost, and none of them blocks.
Direction
Accept. HRX is fork-only, so this crash fix for gfx1150 can only live here. It is gated to the 1024-VGPR targets and to the 18-21-wave prefetch workgroups, and gfx1151 keeps the master dispatch.
Asks
- Should fix:
ggml/src/ggml-hrx/ops/flash-attn.cpp:387-390. The comment derives the rule as "kernels take up to 256 VGPRs, so vgprs / 256 waves fit". On a 1536-VGPR SIMD the wave32 allocation granule is 24, so a 256-VGPR wave takes 264 and only 5 waves fit. The 21-wave workgroup (7 query heads for each KV head) fits on gfx1151 only because the compiler keeps that kernel at 240 VGPRs or less. On 1024 VGPRs (granule 16) the rule is exact. Please describe it as a rule checked against Loom of hrx-system v0.2.0 (your 343 offline builds), exact on 1024-VGPR targets and dependent on the compiler on 1536-VGPR targets. - Should fix:
ggml/src/ggml-hrx/ops/flash-attn.cpp:198-199and:383still say that long KV always uses the 18-wave or 16-plus-wave prefetch workgroup. Add "if it fits the VGPRs". - Should fix:
tests/test-backend-ops.cpp:19771-19779. The six cases at 8192 keys x 512 queries add about 0.46 TFLOP of CPU reference work. The rejection depends only on n_kv > 6144 and the wave count, sonb = 32takes the same tile path at about 1/16 of the cost. The 6-head case also repeats the 18 waves of the 3-head case. Also, the comment calls the plain FLASH_ATTN_EXT case causal, buttest_flash_attn_extdoes not use a causal mask. - Optional: add a
vgprs == 1024 || vgprs == 1536check toggml_hrx_archs_valid(), so that a new arch row cannot carry a wrong value without notice.
At squash, please use the message of the last commit. The first commit describes the compile-and-fall-back logic that the last commit removed.
Correctness
PASS on gfx1151. For the HRX kernel change we ran test-backend-ops for FLASH_ATTN_EXT (1433/1433 on master, 1439/1439 with the PR) and the full HRX0 suite (16284/16284 and 16290/16290; the difference is the 6 new cases). We ran the six new cases with the PR's test binary against master's and the PR's libraries. The kernel dispatch lines are identical, and no AMDGPU/052 lines appear. On Inkling 2 Mini (24/8 heads) with all four corpora (10k-13.5k tokens each), the f32 final logits and the prompt tokens are byte-identical. The KLD base files (-c 2048 per corpus and -c 16384 over the four corpora joined) are byte-identical too, and so is a 256-token greedy decode after 6.3k-token and 8.8k-token prompts (master A/A identical). scripts/hrx/verify.sh passes. On ROCm0 and Vulkan0 the four new GQA cases pass. The two indexed-bias cases are not supported there, as expected. No HIP or Vulkan code changed, so the HIP -Werror build, the spill gate and test-vk-exact do not apply.
We have no gfx1150, so we could not test the fix itself. Forcing the gfx1150 table entry on gfx1151 does not work, because the runtime refuses to load gfx1150 code objects before the tile kernel runs. The gfx1150 evidence is your hardware logs and the offline compile table. The VGPR values in the table match the residency model in hrx-system v0.2.0 (runtime/src/iree/hal/driver/amd/gpu/dispatch.c).
Performance
Dispatch on gfx1151 is unchanged, so we expected no change, and the numbers show none. Inkling 2 Mini on HRX0, -b 4096 -ub 4096, -r 5, 4 rounds for pp (order reversed in rounds 3-4) and 2 rounds for tg:
| Test | master t/s | PR t/s | change | summed stddev |
|---|---|---|---|---|
| pp2048 | 1719.5 | 1740.4 | +1.2 % | 2.1 % |
| pp2048 @ d12000 | 1430.2 | 1428.8 | -0.1 % | 3.1 % |
| pp2048 @ d32000 | 1056.0 | 1044.3 | -1.1 % | 8.5 % |
| pp2048 @ d64000 | 526.4 | 539.3 | +2.5 % | 12.7 % |
| tg128 | 40.28 | 40.25 | -0.1 % | 0.5 % |
| tg128 @ d32000 | 32.44 | 32.36 | -0.2 % | 3.4 % |
Verification
Strix Halo (gfx1151), HRX0 with hrx-system v0.2.0, plus ROCm0 and Vulkan0 for the new cases. We compared the PR merged into master dc5521842 (0 commits behind, clean merge) against master.
Not tested
gfx1150 and the other 1024-VGPR targets on hardware; models other than Inkling 2 Mini with 5, 6 or 7 query heads for each KV head.
Thanks for the careful write-up and the offline compile table.
Review made with AI on behalf of the strix-llama.cpp maintainers.
Full verification (for reproduction and agents)
Environment
- AMD Ryzen AI MAX+ 395, Radeon 8060S (gfx1151). Ubuntu 26.04.1, kernel 7.0.0-44-generic.
- HRX: hrx-system v0.2.0 (
0cd370f2baaa0cfef47cc23007f1a109906f8a52), the SDK revision indocs/backend/HRX.md. - ROCm 10.1,
hipconfig7.16.26385, AMD clang 24.0.0git (d6f6cb691863). Mesa 26.0.8 (RADV STRIX_HALO). cmake 4.2.3, ninja 1.13.2, gcc 15.2.0.
Compared
- master tip (base):
dc5521842f7991ceae73139f9d242d8f877e12d4, also the merge base (0 commits behind). - PR head:
b778b76ed396952e962f0f39d5276dbd385fb6cb. - Head as tested: the PR merged into master with
--no-ff, clean merge,e7ad612fade99660b8bbf1907d9e0619a32cfdfd(local only).
Build
Identical flags for both trees.
cmake -S <tree> -B <tree>/build-hrx -G Ninja -DCMAKE_BUILD_TYPE=Release -DGGML_HRX=ON -DCMAKE_PREFIX_PATH=<hrx-sdk> -DLLAMA_BUILD_TESTS=ON
cmake --build <tree>/build-hrx --target test-backend-ops test-flash-attn-indexed-bias test-llama-archs llama-server llama-debug llama-perplexity llama-completion llama-bench llama-tokenize
cmake -S <tree> -B <tree>/build-hip -G Ninja -DGGML_HIP=ON -DGGML_VULKAN=OFF -DGPU_TARGETS=gfx1151 -DCMAKE_HIP_COMPILER=$(hipconfig -l)/clang -DCMAKE_PREFIX_PATH=$(hipconfig -R) -DCMAKE_BUILD_TYPE=Release
cmake -S <tree> -B <tree>/build-vk -G Ninja -DGGML_VULKAN=ON -DGGML_HIP=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build <tree>/build-{hip,vk} --target test-backend-ops
Models
unsloth/Inkling-2-Mini-GGUF,Inkling-2-Mini-UD-Q4_K_XL.gguf, sha256e64276656f072e9b2197a61723667cbdb71da66a716ffd966e572c21088f3cd3(the file named indocs/backend/HRX.md). 24 Q heads, 8 KV heads, head size 128.- Corpora (
tests/corpus, same bytes in both trees): codedec1127a..., numericd9f08d94..., prosec90398f2..., structuredc21947b3.... Tokens: prose 13105, code 13545, structured 10769, numeric 10373, the four joined 47792.
Commands
Model runs used -dev HRX0 -ngl 99 -fa on -ctk f16 -ctv f16.
test-backend-ops test -b HRX0 -o FLASH_ATTN_EXT # base, head
test-backend-ops test -b HRX0 -o FLASH_ATTN_EXT -p 'kv=8192,nb=512' # PR binary on PR libs and on master libs, also with --backend-params trace
test-backend-ops test -b HRX0 -j 4 # base, head
scripts/hrx/verify.sh <bin> <dir> # master's script, base and head bins
test-backend-ops test -b {ROCm0,Vulkan0} -o FLASH_ATTN_EXT # base, head
test-backend-ops test -b {ROCm0,Vulkan0} -o FLASH_ATTN_EXT -p 'kv=8192,nb=512' # head; ROCm with HIP_LAUNCH_BLOCKING unset and =1
llama-debug -m <model> -f <corpus> -c 16384 -b 16384 -ub 512 --save-logits --logits-output-dir <dir>/<side>-<t> # 4 corpora + a 46694-byte prefix of the joined corpora (11663 tokens)
llama-perplexity -m <model> -f <corpus> -c 2048 -b 2048 -ub 2048 --kl-divergence-base <dir>/<side>-<t>.kld
llama-perplexity -m <model> -f <joined> -c 16384 -b 512 -ub 512 --kl-divergence-base <dir>/<side>-long.kld
llama-perplexity <same, head> --kl-divergence-base <dir>/base-<t>.kld --kl-divergence
llama-completion -m <model> -f <prompt> -n 256 --temp 0 --seed 1 -no-cnv --ignore-eos -c 16384 # base x2, head x1; prompts = byte prefixes of the joined corpora, 6334 and 8832 tokens
llama-bench -m <model> -p 2048 -n 0 -d 0,12000,32000,64000 -b 4096 -ub 4096 -r 5 --load-mode none -dev HRX0 -o jsonl # 4 rounds, base/head alternated, reversed in rounds 3-4
llama-bench -m <model> -p 0 -n 128 -d 0,32000 -b 4096 -ub 4096 -r 5 --load-mode none -dev HRX0 -o jsonl # 2 rounds
Results
| Run | master | PR merged |
|---|---|---|
HRX0 -o FLASH_ATTN_EXT |
1433/1433 | 1439/1439 |
| HRX0 full suite | 16284/16284 | 16290/16290 (only difference: the 6 new cases) |
| HRX0 new cases, PR test binary | 6/6 on master libs | 6/6 |
ROCm0 -o FLASH_ATTN_EXT |
4369/4369 | 4373/4373 |
Vulkan0 -o FLASH_ATTN_EXT |
5763/5763 | 5767/5767 |
| ROCm0 new cases (HIP_LAUNCH_BLOCKING unset / =1) | n/a | 4 OK, 2 not supported / same |
| Vulkan0 new cases | n/a | 4 OK, 2 not supported |
scripts/hrx/verify.sh |
pass | pass (wide attention max error 0.000162661 on both) |
- Trace of the 6 new cases: the 12 kernel dispatch lines (
ggml_flash_attn_ext_f32_f16_tilewith grids 11,8,1 / 6,8,1 / 8,8,1, andggml_flash_attn_ext_range_f16) are the same on master libs and PR libs. - AMDGPU/052: none for the new cases on either side. Both sides log the same single line for the existing WMMA 16-to-8-wave fallback (
ggml_flash_attn_ext_f32_f16_wmma, VGPRs=197), which this PR does not touch.
| Prompt | logits (f32) | token IDs |
|---|---|---|
| prose (13104) | identical | identical |
| code (13544) | identical | identical |
| structured (10768) | identical | identical |
| numeric (10372) | identical | identical |
| joined prefix (11663) | identical | identical |
| KLD case | base vs head .kld |
PPL (both) | head vs base: mean KLD / same top p | A/A floor |
|---|---|---|---|---|
prose -c 2048 |
identical | 6.5704 +/- 0.19359 | 0.000000 / 100.000 % | 0.000269 / 99.560 % (ub 512) |
code -c 2048 |
identical | 1.6978 +/- 0.03169 | 0.000000 / 100.000 % | 0.000463 / 99.658 % |
structured -c 2048 |
identical | 1.4164 +/- 0.02439 | 0.000000 / 100.000 % | 0.000188 / 99.765 % |
numeric -c 2048 |
identical | 1.5729 +/- 0.03105 | 0.000000 / 100.000 % | 0.000219 / 99.629 % |
joined -c 16384 -ub 512 |
identical | 2.3481 +/- 0.03394 | 0.000000 / 100.000 % | 0.001174 / 99.054 % (ub 256) |
Greedy decode, 256 tokens: master A/A identical, PR identical to master, for both prompts.
Correctness
| Check | Method | Result |
|---|---|---|
| Changed op | test-backend-ops -o FLASH_ATTN_EXT, HRX0 |
PASS |
| New cases on master and PR code | PR test binary on both libraries, with trace | PASS, same dispatches |
| Full backend suite | HRX0 -j 4 |
PASS |
| New cases on other backends | ROCm0 (HLB unset and =1), Vulkan0 | PASS |
| Prompt token IDs and f32 final logits, 4 corpora, past 6144 keys | llama-debug + cmp | PASS, byte-identical |
| KLD/PPL short and long | .kld cmp, A/A floor |
PASS, byte-identical |
| Multi-step greedy decode | llama-completion, A/A | PASS, identical |
| Performance | llama-bench PP2048 d0-64000, tg128 | PASS, all differences inside the stddev |
| test-vk-exact | - | n/a: no Vulkan code changed |
HIP -Werror, VGPR spill gate |
- | n/a: no HIP code changed |
| ops-perf.sh | - | not run: same dispatch on gfx1151 (trace) |
| gfx1150 behavior | - | not tested: no hardware |
Performance
Raw avg_ts +/- stddev_ts per round (t/s). Rounds 1-2: master first; rounds 3-4: PR first.
| Test | master r1 / r2 / r3 / r4 | PR r1 / r2 / r3 / r4 |
|---|---|---|
| pp2048 d0 | 1752.84+/-22.59 / 1706.34+/-15.70 / 1734.62+/-15.59 / 1684.29+/-31.40 | 1704.09+/-12.77 / 1678.19+/-19.03 / 1856.00+/-15.19 / 1723.47+/-14.64 |
| pp2048 d12000 | 1450.09+/-22.35 / 1403.54+/-20.85 / 1439.40+/-22.80 / 1427.58+/-35.47 | 1392.33+/-15.67 / 1409.14+/-17.47 / 1505.80+/-17.36 / 1407.79+/-27.04 |
| pp2048 d32000 | 1046.76+/-45.38 / 1045.28+/-34.26 / 1070.02+/-45.64 / 1061.77+/-53.44 | 1030.92+/-63.70 / 995.24+/-19.22 / 1091.16+/-39.85 / 1059.91+/-55.44 |
| pp2048 d64000 | 521.70+/-43.34 / 496.86+/-21.86 / 569.46+/-20.92 / 517.36+/-36.50 | 522.06+/-34.22 / 542.55+/-28.70 / 547.67+/-21.86 / 545.07+/-60.98 |
| tg128 d0 | 40.32+/-0.07 / 40.25+/-0.09 | 40.28+/-0.10 / 40.22+/-0.15 |
| tg128 d32000 | 32.47+/-0.56 / 32.41+/-0.57 | 32.39+/-0.57 / 32.33+/-0.55 |
At d64000 the KV (66048 cells) is above GGML_HRX_FA_TILE_MAX_KV, so that depth runs the WMMA kernel. d12000 and d32000 run the prefetch tile path. Rounds 1-2 alone showed -3.1 % at d32000, and that difference followed the run order. The reversed rounds 3-4 removed it.
Findings in full
ops/flash-attn.cpp:387-390(should fix). On 1536-VGPR targets the wave32 VGPR allocation granule is 24 (16 on 1024-VGPR targets), per the hrx-system v0.2.0 residency model (runtime/src/iree/hal/driver/amd/gpu/dispatch.c). A 241-256-VGPR wave takes 264 VGPRs, so a 1536-VGPR SIMD holds 5 such waves, not 6. Waves per SIMD for the prefetch workgroup: 3 heads 18 waves (5), 5 heads 20 (5), 6 heads 18 (5), 7 heads 21 (6). Only the 7-head workgroup needs the kernel at 240 VGPRs or less. With SDK v0.2.0 it compiles and runs on gfx1151 without AMDGPU/052, on master and with the PR. If a later kernel or SDK change pushes it above 240, gfx1151 would reject it on master and with the PR alike, and the rule would not prevent that. This is not a regression. A granule-aware check or a fallback on compile failure would cover it. On 1024-VGPR targets the rule is exact: 256 is the wave32 maximum on gfx11, and 1024 / 256 = 4.ops/flash-attn.cpp:198-199,:383(should fix). The comments still describe the prefetch workgroup as unconditional above 6144 keys.tests/test-backend-ops.cpp:19771-19779(should fix). About 4.6e11 FLOP of CPU reference work for the six cases.nb = 32reaches the same tile path (n_q > 8). The 6-head case has the same wave count as the 3-head case. The comment says "causal" for the plaintest_flash_attn_extcase, whose mask is not causal.ggml-hrx-arch.cpp:101-108(nit).ggml_hrx_archs_valid()does not checkvgprs.ggml-hrx-arch.cpp(nit). The gfx12vgprsvalues are not read today, because the tile kernel requiresWMMA_GFX11. They match the runtime.- Commit messages (nit). The first commit describes a fallback that the third commit removed. Use the third commit's message at squash.
- Note for later, not this PR: the WMMA kernel's 16-to-8-wave fallback at
ops/flash-attn.cpp:516-518still compiles, fails and retries, and logs AMDGPU/052 once for each configuration. It could use the same kind of VGPR rule.
Claims
| Claim | Result |
|---|---|
| On gfx1151 the rule allows every prefetch workgroup that master allows (same dispatch) | Reproduced: same trace, byte-identical logits, KLD and decode past 6144 keys |
| The compiler accepts the 18-21-wave prefetch workgroups on gfx1151 | Reproduced on hardware for 3, 5, 6 and 7 heads at 8192 keys |
| The new cases pass with the change | Reproduced on HRX0 (6/6), ROCm0 and Vulkan0 (4/4 supported) |
| No new failure in the full HRX0 suite | Reproduced on gfx1151 (no failure on either side) |
| No speed change below 6144 keys and on gfx1151 | Reproduced |
| The VGPR value per target | Matches the hrx-system v0.2.0 runtime residency model |
| On gfx1150 master rejects the kernel and the PR avoids it; gfx1150 speed numbers | Not tested: no gfx1150 |
Not tested
- gfx1150, gfx1152, gfx1102/gfx1103, gfx1100/gfx1101 and gfx12: no hardware. We tried to force the gfx1150 table entry on gfx1151, but the runtime refuses to load gfx1150 code objects before the tile kernel runs, so the attempt gives no result. We did not repeat the offline compile table.
- Models other than Inkling 2 Mini with 5, 6 or 7 query heads for each KV head: test-backend-ops only.
test-llama-archsran only throughverify.sh(device placement), because no model code changed.
|
Thanks, I don't have a gfx1150 box so I can't verify, I'm trusting this is correct. Please just fix the minor issues. |
On 1536-VGPR targets VGPRs are allocated in steps of 24, so 6 waves fit on a SIMD only at 240 VGPRs or less. The rule allows the 21-wave prefetch workgroup there because Loom of hrx-system v0.2.0 keeps its kernels at 224-240 VGPRs. The comments now say that the rule is exact on 1024-VGPR targets and depends on the compiler on 1536-VGPR targets, and that long KV keeps the short-KV workgroup where the prefetch one does not fit. Loom of hrx-system v0.3.0 already takes 255 VGPRs for one of these kernels on gfx1100, gfx1101 and gfx1151: 7 heads for each KV head, the bias table only as a MUL_MAT (offline, the rule matches the compiler in 340 of 343 builds). So the dispatch again runs the short-KV workgroup if the prefetch kernel does not build. The rule avoids the failed build where it is exact, and the fallback covers a compiler that takes more VGPRs. A new test case builds that kernel. The long-KV cases take 64 queries instead of 512: the fewest that reach the tile kernel, at about 1/8 of the CPU reference work. The 6-head case is dropped (18 waves, as for 3 heads), and the plain cases are no longer called causal. ggml_hrx_archs_valid() checks the VGPRs of each arch row. Assisted-by: Claude Code
|
Thanks for the review. All four asks are in b391cb5, with one change to the test size and one addition that finding 1 turned out to need.
The note under finding 1 was right. With the Loom of hrx-system v0.3.0 (#338), one 21-wave prefetch kernel (7 heads for each KV head, the bias table only as a MUL_MAT) takes 255 VGPRs on gfx1100, gfx1101 and gfx1151 and no longer builds. In the other 340 of the 343 offline builds the rule still matches the compiler. So b391cb5 brings back the first commit's fallback as a safety net: if the prefetch kernel does not build, the short-KV workgroup runs. The rule still avoids the failed build wherever it is exact. A new case (56 query heads and 8 KV heads, MUL_MAT bias, 8192 keys) builds that kernel, so on gfx1151 with v0.3.0 it would go through the fallback. Tests on gfx1150 (Radeon 890M, hrx-system v0.2.0), the 7 cases of
The last commit is now the follow-up, so here is a message for the squashed commit: Squash message |
dzannotti
left a comment
There was a problem hiding this comment.
This review replaces our review of b778b76.
Verdict
Still correct and safe to merge. All four of our earlier asks are in b391cb5, and with the PR merged into current master, every output we compared on Strix Halo is byte-identical to master. Two small points in the test file remain. Neither blocks. The PR changes kernel dispatch, so it still needs one maintainer approval.
Direction
Accept. The compile-fail fallback is a good safety net for a compiler that needs more VGPRs than pf_fits expects. Merge order: this PR first, squashed with the message from your reply. Then #340, rebased to its own commit. That commit applies cleanly on b391cb5, and #338 merges cleanly on top of both.
Asks
- Should fix:
tests/test-backend-ops.cpp:21246changes the upstream perf case "GLM 4.7 Flash gqa20" from 32 to 64 queries. It has head size 576, so it never reaches the HRX tile kernel. The change only adds a conflict to every upstream sync. Please restore 32. - Should fix:
tests/test-backend-ops.cpp:19776-19777. The 56/8 case hassub=false. HRX fuses the bias table only for MUL_MAT -> SUB -> FLASH_ATTN_EXT (ggml_hrx_fuse_flash_attn_bias_mm), and withsub=falsethe test also runs node by node. So this case runs the tile kernel withbias_mm=0, not the MUL_MAT-table kernel that the comment names. Please usesub=true, which fuses and runsbias_mm=1at 21 waves (we ran it, and it passes), or fix the comment. - Question: which kernel config failed in your v0.3.0 build? On gfx1151, with #338 at ad0d44b, the runtime compile built every 21-wave prefetch kernel: the plain 7-head case, your 56/8 case, and the fused 56/8 variant. So the fallback never ran on our hardware. It does not need to run for this PR to merge.
- Optional: the comment at
ggml/src/ggml-hrx/ops/flash-attn.cpp:392names hrx-system v0.2.0 and the 343 offline builds. That goes stale when #338 lands, and the commit message is a better place for it.
Correctness
PASS on gfx1151. Base and head ran the same case list: the PR's cases, plus a 6-head case and the fused 56/8 case, which we added locally to both sides. With hrx-system v0.2.0, FLASH_ATTN_EXT passes 1441/1441 and the full HRX0 suite passes 16292/16292 on both sides. The kernel dispatch trace of every 8192-key case is identical, and there is no AMDGPU/052 line for the tile kernel. On Inkling 2 Mini, the four corpora have 10.4k-13.5k tokens each, so prefill runs the long-KV tile path. On all four, the f32 final logits and the token IDs are byte-identical (-ub 512, and -ub 4096 on prose). The KLD base files are byte-identical too (-c 2048 per corpus, and -c 16384 over the four joined). A 256-token greedy decode is identical as well, and master is identical to itself (A/A). With hrx-system v0.3.0, master + #338 and master + this PR + #338 both pass FLASH_ATTN_EXT 1441/1441. On ROCm0 and Vulkan0 the new plain cases pass (ROCm with HIP_LAUNCH_BLOCKING unset and =1). The indexed-bias cases are not supported there, as expected. No HIP or Vulkan code changed, so the -Werror build, the spill gate and test-vk-exact do not apply.
Performance
The dispatch on gfx1151 is unchanged, and the numbers show no change. Inkling 2 Mini on HRX0, -b 4096 -ub 4096 -r 5, 2 rounds, base and head alternated:
| Test | master t/s | PR t/s | change | stddev per side |
|---|---|---|---|---|
| pp2048 | 2132.8 | 2126.0 | -0.3 % | ~10 |
| pp2048 @ d12000 | 1804.4 | 1798.8 | -0.3 % | ~25 |
| pp2048 @ d32000 | 1248.0 | 1233.7 | -1.1 % | ~60 |
| pp2048 @ d64000 | 746.8 | 750.7 | +0.5 % | ~20 |
| tg128 | 41.81 | 41.77 | -0.1 % | 0.03 |
| tg128 @ d32000 | 33.45 | 33.47 | +0.1 % | 0.6 |
Verification
Strix Halo (gfx1151): HRX0 with hrx-system v0.2.0 and v0.3.0, plus ROCm0 and Vulkan0 for the new cases. We compared the PR merged into master 8707b3a91 (9 commits behind, clean merge) against master.
Not tested
The fallback path itself, because no prefetch build fails on gfx1151. Also gfx1150 and the other 1024-VGPR targets.
Thanks for the quick follow-up.
Review made with AI on behalf of the strix-llama.cpp maintainers.
Full verification (for reproduction and agents)
Environment
- AMD Ryzen AI MAX+ 395, Radeon 8060S (gfx1151), 128 GB unified memory. Ubuntu 26.04.1, kernel 7.0.0-44-generic.
- HRX: hrx-system v0.2.0 (
0cd370f2baaa0cfef47cc23007f1a109906f8a52, the SDK revision indocs/backend/HRX.md), and hrx-system v0.3.0 (the pin in #338) for the combined runs. - ROCm 10.1,
hipconfig7.16.26385, AMD clang 24.0.0git (d6f6cb691863). Mesa 26.0.8 (RADV STRIX_HALO). cmake 4.2.3, ninja 1.13.2, gcc 15.2.0.
Compared
- master tip (base):
8707b3a915b51f614de48061622f3da118d43d4f. - PR head:
b391cb56d6861eb51c8ec0c9b538572985758ce7, merge basedc5521842(9 commits behind). - Head as tested: the PR merged into master with
--no-ff, clean merge,4e15248d9(local only). - v0.3.0 runs: master + #338 (
ad0d44b7d), mergee970b88c5; master + this PR + #338, merge65c56d490. Both merges were clean, and both are local only. - #340 (
4665a3e4a): its own commit cherry-picks cleanly onto b391cb5 and onto master + this PR + #338.
Build
Identical flags for both trees.
cmake -S <tree> -B <tree>/build-hrx -G Ninja -DCMAKE_BUILD_TYPE=Release -DGGML_HRX=ON -DCMAKE_PREFIX_PATH=<hrx-sdk> -DLLAMA_BUILD_TESTS=ON
cmake --build <tree>/build-hrx --target test-backend-ops test-flash-attn-indexed-bias llama-debug llama-perplexity llama-completion llama-bench llama-tokenize
cmake -S <head> -B <head>/build-hip -G Ninja -DGGML_HIP=ON -DGGML_VULKAN=OFF -DGPU_TARGETS=gfx1151 -DCMAKE_HIP_COMPILER=$(hipconfig -l)/clang -DCMAKE_PREFIX_PATH=$(hipconfig -R) -DCMAKE_BUILD_TYPE=Release
cmake -S <head> -B <head>/build-vk -G Ninja -DGGML_VULKAN=ON -DGGML_HIP=OFF -DCMAKE_BUILD_TYPE=Release
The base tree got the PR's tests/test-backend-ops.cpp hunk, so both sides run the same cases. Both trees also got two extra cases after the PR's {7, 1} case:
test_cases.emplace_back(new test_flash_attn_ext(128, 128, 8, {6, 1}, 8192, 64, true, false, 0, 0, GGML_PREC_F32, GGML_TYPE_F16, GGML_TYPE_F16));
test_cases.emplace_back(new test_flash_attn_ext_indexed_bias(128, 56, 8, 8192, 64, 1025, 0, true, true));
Models
unsloth/Inkling-2-Mini-GGUF,Inkling-2-Mini-UD-Q4_K_XL.gguf, sha256e64276656f072e9b2197a61723667cbdb71da66a716ffd966e572c21088f3cd3. 24 Q heads, 8 KV heads, head size 128.- Corpora (
tests/corpus, same bytes in both trees): codedec1127a..., numericd9f08d94..., prosec90398f2..., structuredc21947b3.... Tokens: prose 13105, code 13545, structured 10769, numeric 10373.
Commands
Model runs used -dev HRX0 -ngl 99 -fa on -ctk f16 -ctv f16.
test-backend-ops test -b HRX0 -o FLASH_ATTN_EXT # base, head; v0.3.0 trees too
test-backend-ops test -b HRX0 -o FLASH_ATTN_EXT -p 'kv=8192' # base, head, v0.3.0 trees; also with --backend-params trace
test-backend-ops test -b HRX0 -j 4 # base, head
test-flash-attn-indexed-bias (and --wide-hrx) # base, head
scripts/hrx/verify.sh <bin> <dir> # master's script, head bins
test-backend-ops test -b ROCm0 -o FLASH_ATTN_EXT -p 'kv=8192' # head; HIP_LAUNCH_BLOCKING unset and =1
test-backend-ops test -b Vulkan0 -o FLASH_ATTN_EXT -p 'kv=8192' # head
llama-debug -m <model> -f <corpus> -c 16384 -b 16384 -ub 512 --save-logits --logits-output-dir <dir>/<side>-<t> # 4 corpora; base twice on prose; also -ub 4096 on prose
llama-perplexity -m <model> -f <corpus> -c 2048 -b 2048 -ub 2048 --kl-divergence-base <dir>/<side>-<t>.kld
llama-perplexity -m <model> -f <joined> -c 16384 -b 512 -ub 512 --kl-divergence-base <dir>/<side>-long.kld
llama-completion -m <model> -f <corpus> -n 256 --temp 0 --seed 1 -no-cnv --ignore-eos -c 16384 # prose and numeric; base x2, head x1
llama-bench -m <model> -p 2048 -n 0 -d 0,12000,32000,64000 -b 4096 -ub 4096 -r 5 --load-mode none -o jsonl # 2 rounds, alternated
llama-bench -m <model> -p 0 -n 128 -d 0,32000 -b 4096 -ub 4096 -r 5 --load-mode none -o jsonl # 2 rounds, alternated
Results
| Run | master | PR merged |
|---|---|---|
HRX0 -o FLASH_ATTN_EXT (v0.2.0) |
1441/1441 | 1441/1441 |
HRX0 -p 'kv=8192' (v0.2.0) |
11/11 | 11/11 |
| HRX0 full suite (v0.2.0) | 16292/16292 | 16292/16292 |
| not supported lines, full suite | 44839 | 44839 |
| AMDGPU/052 lines, full suite | 1 (WMMA 16-to-8-wave fallback, VGPRs=197) | 1 (same) |
test-flash-attn-indexed-bias, --wide-hrx |
pass, max error 0.000162661 | same |
scripts/hrx/verify.sh |
n/a | pass |
8192-key cases on HRX0, v0.2.0. The tile grid x is ceil(64 / (16 * qt)), so it shows which workgroup ran. It is identical on both sides.
| Case | waves | result (both) | tile grid | workgroup |
|---|---|---|---|---|
| indexed bias 24/8, SUB | 18 | OK | 1,8,1 | prefetch |
| indexed bias 24/8, SUB + MUL_MAT (fused) | 18 | OK | 1,8,1 | prefetch |
indexed bias 56/8, sub=false, mm=true (MUL_MAT runs alone, FA with bias_mm=0) |
21 | OK | 2,8,1 | prefetch |
| plain 3 heads per KV head | 18 | OK | 1,8,1 | prefetch |
| plain 5 heads per KV head | 20 | OK | 1,8,1 | prefetch |
| plain 6 heads per KV head (added) | 18 | OK | 2,8,1 | prefetch |
| plain 7 heads per KV head | 21 | OK | 2,8,1 | prefetch |
indexed bias 56/8, SUB + MUL_MAT, fused, bias_mm=1 (added) |
21 | OK | 2,8,1 | prefetch |
The full dispatch trace is identical between master and the PR.
hrx-system v0.3.0:
| Run | master + #338 | master + this PR + #338 |
|---|---|---|
-o FLASH_ATTN_EXT -p 'kv=8192' |
11/11 | 11/11 |
-o FLASH_ATTN_EXT |
1441/1441 | 1441/1441 |
| AMDGPU/052 lines | 2, both WMMA (VGPRs=195), none for the tile kernel | same |
| tile grids at 8192 keys | same as v0.2.0, so every 21-wave case ran the prefetch workgroup | same |
Inkling 2 Mini on HRX0, v0.2.0:
| Check | Result |
|---|---|
llama-debug f32 logits and token IDs, 4 corpora, -ub 512 |
byte-identical |
llama-debug prose, -ub 4096 |
byte-identical |
| llama-debug master A/A (prose) | byte-identical |
.kld files, -c 2048, 4 corpora |
byte-identical (KLD 0) |
.kld file, joined, -c 16384 |
byte-identical |
| greedy decode, 256 tokens, prose and numeric prompts | master A/A identical, PR identical to master |
| PPL | master | PR |
|---|---|---|
prose -c 2048 |
6.5704 +/- 0.19359 | 6.5704 +/- 0.19359 |
code -c 2048 |
1.6978 +/- 0.03169 | 1.6978 +/- 0.03169 |
structured -c 2048 |
1.4164 +/- 0.02439 | 1.4164 +/- 0.02439 |
numeric -c 2048 |
1.5729 +/- 0.03105 | 1.5729 +/- 0.03105 |
joined -c 16384 -ub 512 |
2.3481 +/- 0.03394 | 2.3481 +/- 0.03394 |
ROCm0 and Vulkan0, PR merged, -p 'kv=8192':
| Case | ROCm0 (HLB unset) | ROCm0 (HLB=1) | Vulkan0 |
|---|---|---|---|
| plain 3, 5, 6, 7 heads per KV head | OK | OK | OK |
| 4 indexed-bias cases | not supported | not supported | not supported |
| total | 19/19 | 19/19 | 19/19 |
Correctness
| Check | Method | Result |
|---|---|---|
| Changed op | test-backend-ops -o FLASH_ATTN_EXT, HRX0, both SDKs |
pass, same counts as master |
| Full backend suite | test-backend-ops, HRX0 |
pass, 16292/16292 both sides |
| Dispatch | --backend-params trace at 8192 keys |
identical to master |
| f32 logit parity and prompt tokens | llama-debug + cmp, 4 corpora |
byte-identical |
| KLD/PPL short and long | llama-perplexity, .kld cmp |
byte-identical |
| Multi-step greedy decode | llama-completion, A/A + head |
identical |
ROCm HIP_LAUNCH_BLOCKING unset and =1 |
new cases on ROCm0 | pass both |
| Vulkan | new cases on Vulkan0 | pass |
test-vk-exact, HIP -Werror, VGPR spill gate |
n/a | no Vulkan or HIP code changed |
| Performance | llama-bench, 2 rounds alternated |
inside stddev |
| Fallback path | v0.3.0 SDK on gfx1151 | not run: no prefetch build failed |
Performance
Raw avg_ts +/- stddev_ts (t/s):
| Test | master r1 | PR r1 | master r2 | PR r2 |
|---|---|---|---|---|
| pp2048 | 2142.47 +/- 9.67 | 2129.09 +/- 9.27 | 2123.21 +/- 13.68 | 2122.89 +/- 9.37 |
| pp2048 @ d12000 | 1810.42 +/- 19.76 | 1803.77 +/- 23.20 | 1798.35 +/- 33.05 | 1793.83 +/- 27.18 |
| pp2048 @ d32000 | 1258.40 +/- 61.73 | 1265.58 +/- 66.98 | 1237.59 +/- 63.91 | 1201.77 +/- 57.22 |
| pp2048 @ d64000 | 745.49 +/- 11.17 | 745.51 +/- 12.34 | 748.10 +/- 29.71 | 755.95 +/- 20.25 |
| tg128 | 41.83 +/- 0.04 | 41.79 +/- 0.03 | 41.80 +/- 0.03 | 41.76 +/- 0.02 |
| tg128 @ d32000 | 33.45 +/- 0.55 | 33.46 +/- 0.56 | 33.46 +/- 0.58 | 33.48 +/- 0.57 |
Findings in full
- Earlier asks: 1 (the
pf_fitscomment), 2 (the stale "long KV always prefetches" comments), 3 (test cost, the 6-head case, the causal wording) and 4 (the VGPR check inggml_hrx_archs_valid()) are all done in b391cb5. - The fallback retry reproduces the short-KV dispatch exactly.
toepis recomputed in the lambda, and the grid uses the newtqt. The config hasprefetch=0, so the retry shares the cache entry of the normal short-KV kernel. No value computed before the lambda depends onpfortqt. A failed build is cached as null, so the retry costs no compile per token. If both builds fail,ggml_hrx_dispatchgets null and returns false, the same as master. - On gfx1151,
pf_fitsis always true (at most 6 waves on each SIMD, and 1536 / 256 = 6), so the dispatch equals master whenever the prefetch kernel builds. - Ask 1:
tests/test-backend-ops.cpp:21246. The GLM 4.7 Flash gqa20 perf case (hsk 576) comes from upstream.ggml_hrx_flash_attn_ext_use_tileneedsk->ne[0] == 128, so this case never reaches the tile kernel, with 32 or with 64 queries. Nothing inscripts/bench-history/perf-cases.txtor CI uses it. - Ask 2:
test_flash_attn_ext_indexed_bias::run_whole_graph()returnssub. Withsub=false,ggml_backend_compare_graph_backendruns each node on its own, and HRX fuses the table only when a SUB reads a MUL_MAT. At runtime,bias_mm=1always comes withbias_sub=1. - Nit: on 1024-VGPR targets (granule 16), 5 waves fit at up to 192 VGPRs, so the rule is conservative there, not exact. It can never pick a workgroup that does not fit. Our first review called it exact too.
- Nit: the tile fallback lambda reads
pfandtqtfrom the enclosing scope, and the caller changes them between the two calls. The WMMA fallback in the same file passes its variable as a parameter.get_kernel(bool prefetch, int64_t qt)would match it. Optional.
Claims
- The rule leaves gfx1151 dispatch unchanged: reproduced (identical trace, byte-identical model output).
- The fix for gfx1150 and the other 1024-VGPR targets: not tested, no hardware.
- With hrx-system v0.3.0, one 21-wave prefetch kernel needs 255 VGPRs on gfx1151 and does not build: not reproduced. The runtime compile built every 21-wave prefetch kernel on gfx1151, and the fallback did not run.
- The fallback runs the short-KV workgroup when the prefetch build fails: not tested on hardware. The code reading above confirms it.
- The long-KV cases now cost about 1/8 of the old CPU reference work: consistent with 64 instead of 512 queries. Not timed.
Not tested
- The fallback path on hardware (no prefetch build fails on gfx1151 with either SDK).
- gfx1150, gfx1102, gfx1103, gfx1152, gfx1100, gfx1101 and gfx12.
- Full ROCm0 and Vulkan0 suites (no ROCm or Vulkan code changed; the new cases ran).
|
Status from the maintainers: our review found nothing blocking, but we cannot verify the fix itself. Our hardware is gfx1151 only, and this change targets gfx1150 and other 1024-VGPR GPUs, where the new path actually runs. We will not approve it on our side for that reason. A maintainer or contributor with gfx1150 (or another 1024-VGPR target) needs to run the new FA cases and confirm the fix there before this merges. Review made with AI on behalf of the strix-llama.cpp maintainers. |
|
This looks largely correct, per Claude: Review focused on code correctness and on keeping gfx1151 unaffected. No gfx1150 hardware was available; no HRX build or run was possible either (no hrx-system SDK or GPU). Everything below is offline analysis. Verdict: correct, and gfx1151 is isolated. One small test-file nit. Isolation. The code never tests for
Fallback. Nit (please revert). Commit Checked: all added lines are ASCII, and all commits carry I'd merge. |
- tests: restore 32 queries in the upstream perf case "GLM 4.7 Flash gqa20". b391cb5 changed it by mistake; head size 576 never reaches the tile kernel. - tests: the 7-head indexed-bias case takes the table as a SUB of a MUL_MAT. HRX fuses only that pattern, so the case now runs the 21-wave prefetch kernel with bias_mm=1, as its comment says. - The pf_fits comment calls the rule conservative on 1024-VGPR targets (5 waves would fit at 192 VGPRs or less) and no longer names a Loom version: that goes to the commit message. - The tile fallback passes prefetch and query tiles to get_kernel, as the WMMA fallback passes its waves; pf is const. Assisted-by: Claude Code
|
All four asks and both nits are in bf5336d, a new commit on top (fast-forward). The squash message below replaces the one in my last reply.
Nit: the fallback calls gfx1150 (Radeon 890M, Ryzen AI 9 HX PRO 370, hrx-system v0.2.0),
The last row runs the fallback through the new Squash message |
Overview
On gfx1150 (Strix Point, Radeon 890M) HRX aborts Inkling 2 as soon as attention sees more than 6144 keys:
Above
GGML_HRX_FA_TILE_SHORT_KV(6144 keys) the tile kernel switches to 6 query tiles with the prefetch. With 3 queryheads per KV head (Inkling 2: 24/8 heads) that is an 18-wave workgroup, 5 waves on each SIMD of the WGP. The register
file decides whether that fits. HRX's own runtime (hrx-system
runtime/src/iree/hal/driver/amd/gpu/dispatch.c) givesgfx1100/gfx1101/gfx1151 1536 VGPRs per SIMD lane and the other RDNA3 targets, gfx1150 included, 1024. Inkling 2's
attention kernels take 247-255 VGPRs, so 4 waves fit on gfx1150 and the compiler rejects the kernel. The fused bias
paths then abort; a FLASH_ATTN_EXT without a bias reports a failed node and leaves its output unwritten. Head groups
of 2, 4 and 8 get 16-wave prefetch workgroups (4 waves per SIMD), which fit, so they are not affected; head groups of
5, 6 or 7 (GQA ratios 5, 6, 7, 12, ...) give 18-21 waves like 3 and are rejected the same way.
The fix: the prefetch workgroup is used only where it fits the register file. Its waves run on the 4 SIMDs of a WGP
and its kernels take up to 256 VGPRs, so it is used if ceil(waves / 4) <= VGPRs of a SIMD lane / 256: 4 waves on each
SIMD with 1024 VGPRs, 6 with 1536. Otherwise the short-KV workgroup (2 query tiles, 6 waves) runs, as it does up to 6144
keys.
ggml_hrx_archgets the VGPR count of each target, as in the residency model of the hrx-system runtime (1536 ongfx1100, gfx1101, gfx1151 and gfx12, 1024 on the other gfx11). The head groups of every GQA ratio give at most 21 waves,
so on gfx1151 the rule allows every prefetch workgroup, as master does.
Update (3 commits now, no force-push): the first commit compiled the prefetch kernel and fell back to the short-KV
workgroup when the compiler rejected it. That gave the right results but logged the compiler's error (two lines) once
per configuration and process. The second commit adds test cases for 5, 6 and 7 query heads per KV head. The third
replaces the fallback with the rule above, so the rejected kernel is never compiled and nothing is logged.
New test-backend-ops cases (eval mode, next to the existing indexed-bias cases): 24/8 heads, head size 128, 8192 keys,
512 queries, causal, with the bias table as a SUB, as a MUL_MAT, and without a bias. On gfx1150 all three fail without
the fix (SUB and MUL_MAT abort with the error above, 248 and 255 VGPRs; the plain one fails with ERR = 1.0, 247 VGPRs)
and pass with it. No existing case covered this: the indexed-bias cases stop at 5120 keys, and the long-KV
FLASH_ATTN_EXT cases use GQA ratios 1, 4, 6 and 8. The second commit adds plain FLASH_ATTN_EXT cases with 8 KV heads and
5, 6 or 7 query heads each, 8192 keys and 512 queries: on gfx1150 all three fail on master (rejected kernel, output
left unwritten) and pass with this PR.
The rule checked against the compiler, offline
Loom compiles for a named target without a GPU, so a small program that calls ggml-hrx's exported
ggml_hrx_loom_jit_create/ggml_hrx_loom_compilebuilt the tile kernel's prefetch workgroup for every gfx11 targetin the arch table: 2 to 8 query heads per KV head (
hg= ratio,qt= ceil(16 / hg)), each in 7 variants (no mask,mask, vector mask, bias SUB, bias SUB with vector mask, bias MUL_MAT, both), prefetch on, hrx-system v0.2.0. 343 builds:
The compiler accepts exactly the workgroups the rule allows. (The gfx1150 rows reproduce the rejection logged on the
hardware, e.g. 255 VGPRs and 58496 bytes of LDS for Inkling 2's fused MUL_MAT bias.)
Measurements
All numbers are from one gfx1150 machine (Strix Point, not Strix Halo), oracle and candidate built and run in the same
session from separate worktrees and build directories with the same SDK, compiler and options.
llama-bench -m MODEL -p 2048 -n 128 -d DEPTHS -b 4096 -ub 4096 -r 4 -ngl 99 -fa on -ctk f16 -ctv f16 --load-mode none -dev HRX0 -o jsonl.Depth 0 ran alternating baseline, change, baseline, change. The baseline aborts at depth 12000 (exit 134, "failed to
run node 1121"), so the deeper depths have no baseline on this GPU; the change ran them twice.
Baseline:
After:
Depth 0, n = 2 rounds x 4 samples: pp2048 714.9 -> 712.7 t/s (-0.3 %, inside the per-run standard deviations), tg128
15.09 -> 15.10 t/s. The code path below 6144 keys is unchanged, so no change was expected. At d64000 the KV is above
GGML_HRX_FA_TILE_MAX_KV(65536), so that depth runs the WMMA kernel, not the tile kernel; it is listed because theflow asks for it.
Correctness: TARGET PASS on gfx1150 / HRX0 / Inkling 2 Mini.
Up to the 6144-key boundary the change must equal the baseline byte for byte, and it does. Past the boundary the
baseline aborts, so there is no oracle on this GPU; there the change is checked against the CPU (test-backend-ops),
against itself at another ubatch, and against Vulkan0, with the same Vulkan0 comparison at the boundary as the control.
above.
test-backend-ops test -b HRX0 -j 4): baseline 16275/16284, change 16279/16287 (the 3 newcases are the difference). Every failure in both builds is a MUL_MAT_ID q8_0 case with m=512, k=256, n=33 or 129
(NMSE above 5e-4): 8 in the baseline, 7 in the change, and the set differs between the runs (1 only in the change,
2 only in the baseline). That op is not touched here. FLASH_ATTN_EXT: no failure in either build.
-fa on:-c 2048 -b 2048 -ub 2048, each corpus: the--kl-divergence-baselogit files of baseline and change arebyte-identical (prose 97 MB, code 41 MB, structured 28 MB, numeric 36 MB). The
--kl-divergencerun of the changeagainst the baseline's file gives mean KLD 0.000000 and same top p 100.000 % for all four; its maximum KLD of at most
0.000066 is the 16-bit storage of the base file. For scale, the baseline against itself at
-ub 512: mean KLD0.00034 / 0.00046 / 0.00017 / 0.00032, same top p 99.46 / 99.74 / 99.77 / 99.63 %.
-b 512 -ub 512:-c 6144, the boundary (n_kv reaches 6144, still the short-KV config): logit files byte-identical. Vulkan0against the baseline's HRX0: mean KLD 0.00268, 99.9 % KLD 0.141, same top p 98.63 %.
-c 16384, past the boundary: the baseline aborts (exit 134, "failed to run node 1121"). The change: PPL2.3492 +/- 0.0340. The change at
-ub 256against itself at-ub 512: mean KLD 0.00110, same top p 99.16 %.The change's Vulkan0 against its HRX0: mean KLD 0.00235, 99.9 % KLD 0.138, same top p 98.71 %, the same agreement
as at the boundary.
-c 8192 -b 4096 -ub 4096, f16 K/V), 64 tokens after 1976 and 4212 prompttokens of the corpora (below the boundary): token ids and top log-probabilities identical between baseline and
change.
The final head on gfx1150 (same machine; 21ea5af + the second commit's tests as the reference):
-p kv=8192,nb=512): 6/6 pass with both; the reference logs 6 AMDGPU/052errors, the head none.
9 with the reference, 3 with the head. The 3 left come from the WMMA kernel's existing 16-to-8-wave fallback
(
ggml_flash_attn_ext_f32_f16_wmma, 13 to 75 queries), which this PR does not change.-c 16384 -b 512 -ub 512(past the boundary): the head's--kl-divergence-basefile is byte-identical to the reference's (153 MB), PPL 2.3492 +/- 0.0340 for both. Thereference logs one AMDGPU/052 error, the head none.
Additional information
every HRX configuration we tried (
-ub 1024too; q8_0 K/V fails earlier because HRX cannot SET_ROWS into a q8_0cache;
-fa offneeds an 80 GB CPU compute buffer). The attention path does not depend on the weight types, so anyInkling 2 GGUF should take it the same way (only the file above was run).
-b 4096 -ub 4096, f16 K/V) served 1k-32k token prompts and passed a toolcall, a tool-result turn and a developer message. For context only (same machine, an earlier run with different
settings, not part of the evidence above): its prefill at 8k / 16k / 32k was 624 / 586 / 501 t/s, Vulkan0's
(
-ub 1024, q8_0 K/V) 190 / 175 / 150 t/s.HX PRO 375, llama-server, 64k context, f16 K/V,
-b 4096 -ub 4096): 1k-32k token prompts and the three functionchecks passed with no drafter, with the DFlash2 drafter on HRX0 and with
--hrx-npu. The head runs the same kernelson gfx1150.
fit in 1024 and the 1024-VGPR targets could use the prefetch workgroup for 3 or 5-6 heads; the rule would then leave
that speed unused there, but it never picks a workgroup that does not fit.
Requirements
on a sibling GPU. On Strix Halo (gfx1151) the rule allows every prefetch workgroup, so the dispatch is the same as on
master; the offline compile for gfx1151 shows the compiler accepts all of them. Not run on Strix Halo hardware.
test scripts and this description, and ran the measurements on rcfa's machines; rcfa asked for the fix, for this
PR once the tests passed, and for the third commit (choose by the hardware instead of falling back).
cases, no model.
Generated with Claude Code