Skip to content

ggml-hrx: claim q8_0 KV-cache views so the q8_0 flash-attention cases run - #123

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/kv-q8-salvage
Oct 21, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/kv-q8-salvage

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Salvage from the Hadamard-KV work (Q4_KV itself was rejected by the quality gate and is not included).

  • llama.cpp fork: HRX claims views of a q8_0 KV cache, so test-backend-ops actually runs the q8_0 FLASH_ATTN_EXT cases (29 were silently reported unsupported).
  • gpu-kernels: a q8_0 KV cache uses the HIP decode kernel at every depth (GGML_HRX_HIP_FA_MIN_KV_Q8, default 1) instead of falling back to the scalar prompt kernel below n_kv 1024.

Qwen3-4B Q4_K_M decode, f16 vs q8_0 KV: depth 512 75.23 vs 69.64 (-7.4%, was -27%), 2048 -4.6%, 8192 -5.5%. KLD q8_0 vs f16 (4B, c2048): 0.000172 +- 0.000030, unchanged by the routing (bar <= 0.000231). q8_0 FA cases now run and pass vs CPU. Engine main's hw-gate (ops, kat, kld, needle incl. the kq8/kvq8 rows) PASS on the build with both changes. llama.cpp's graph Hadamard rotation for q8_0 is kept (skipping it raised KLD).

🤖 Generated with Claude Code

…tually tested

test-backend-ops asks a backend about the lone VIEW node of a quantized KV cache, and no matcher
claims a VIEW, so the whole q8_0 KV attention family was reported unsupported and silently skipped
(29 cases). The view is a pure alias: the scheduler resolves it to its storage and the consuming
FLASH_ATTN_EXT matcher decides whether it can run, so a VIEW of a q8_0 tensor is now claimed.

Proven on hardware (Qwen3-4B, HRX, engine main's gate build):
  test-backend-ops -b HRX0 -o FLASH_ATTN_EXT -p type_K=q8_0   28/28 passed, Backend HRX0: OK
  test-backend-ops -b HRX0 -o FLASH_ATTN_EXT -p type_V=q8_0   28/28 passed, Backend HRX0: OK

The same change for a 4-bit KV type was tried alongside it and dropped: skipping the graph Hadamard
rotation for q8_0 (the way a 4-bit cache skips it because it rotates inside its blocks) raised KLD vs
f16 from 0.000172 to 0.000903 on Qwen3-4B at c2048, so q8_0 keeps the graph rotation and that item is
not in this commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bong-water-water-bong
bong-water-water-bong merged commit 8905498 into 1bit/hrx-vulkan-patched Oct 21, 2026
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/kv-q8-salvage branch November 12, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant