Skip to content

HRX: flash-attention decode-split template resolution fails ("all_rejected") at longer context (~3800+ tokens) #115

Description

@bong-water-water-bong

Found while long-context-verifying 1bit-MONSTER/engine#108's fix (1bit-MONSTER/llama.cpp PR #7, commit b4d3ec9, HRX+Vulkan build on Strix Halo, gfx1151).

Repro

llama-server -m Qwen3-Coder-30B-A3B-Instruct-Q4_K_M.gguf -dev HRX0 -ngl 99 -c 8192 (no cross-device split; reproduces the same on -dev HRX0,Vulkan0 -ts 1,0 -ot exps=Vulkan0 too), a single chat completion with a prompt around 3800 tokens (a ~3000-word synthetic document). Decode fails:

HRX Loom JIT Loom compilation failed failed: Loom compilation failed
  diagnostic[0] LOWERING/045: select-templates cannot resolve template.apply against template family <ggml.flash_attention.decode_split.reduce_fused>: all_rejected
compile_kernel: compile gfx1151|...|ggml_flash_attention_decode_split_f32_f16_wmma_next_q8|recipe=direct|key_value_token_count=4864|ggml.flash_attention.attention_scale=0.0883883461|ggml.flash_attention.decode.key_value_token_capacity=4864|ggml.flash_attention.key_value_head_count=4|ggml.flash_attention.qk_head_size=128|ggml.flash_attention.query_head_count=32|ggml.flash_attention.value_head_size=128: Loom compilation failed
graph_compute: failed to prepare command 3 kind=Kernel kernel_id=... bindings=10
llama_decode: failed to decode, ret = -3
srv        decode: Compute error. off = 0, n_batch = 2048, ret = -3

What's confirmed

  • Works at 1470 prompt tokens (key_value_token_count presumably under whatever triggers the split), fails somewhere between there and ~3800 tokens (key_value_token_count=4864 at the point of failure - the KV capacity is padded/rounded, so the true threshold is a bit lower than 4864).
  • Not related to the cross-device split or the MoE router (engine#108): reproduces identically with -dev HRX0 alone, no -ts/-ot at all.
  • Not model-specific in any narrow sense that's been checked - only tried on Qwen3-Coder-30B-A3B-Instruct-Q4_K_M so far, dense-attention (32 query heads / 4 KV heads / head_dim 128, GQA), f16 KV cache (server default).
  • Looks like a genuine coverage gap: "all_rejected" means the template-selection pass found zero candidate implementations for the ggml.flash_attention.decode_split.reduce_fused family at this parameter combination, not a compile error in one candidate.

Not yet done

  • Narrowing the exact key_value_token_count threshold.
  • Checking other models/GQA configurations, KV cache types (q8_0/q4_0 KV), or whether -fa off avoids it entirely (it would, but that's a workaround not a fix).
  • Reading ggml.flash_attention.decode_split.reduce_fused's template definitions in the Loom kernel corpus to see which parameter range they cover and why this one falls outside it.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions