Repository navigation
hrx: claim flash attention for MLA and full-context MoE shapes (#95) - #103
bong-water-water-bong wants to merge 3 commits into
Conversation
) Bump the llama.cpp submodule to 19096bf32, which makes HRX0 claim flash attention instead of declining it ("Flash Attention not supported") for: - GLM-4.7-Flash (deepseek2/MLA): key_length 576 was above the FA kernel's 512 head-size cap; raise the cap and handle MLA's key-length-padded value stride. - Qwen3-Coder-30B-A3B (qwen3moe): the 262144 context was above the 32768 KV cap; raise the prefill/decode KV caps and kernel loop bounds to 262144. serve_e2e answers "Paris" on Qwen3-Coder-30B-A3B Q4_K_M and Qwen3.6-35B-A3B Q8_0 (no regression). GLM-4.7-Flash loads with FA enabled.
|
Docs7 for 1bit-monster/engine
Commit |
PR Reviewer Guide 🔍(Review updated until commit f55b923)Here are some key observations to aid the review process:
|
Bump llama.cpp to ff07f1c71, which reads the route-id stride from the tensor (nb[1] = n_expert, not n_expert_used), so the MoE routing tables select the correct experts for batched prompts and GLM-4.7-Flash answers "Paris" at the default ubatch via FA.
|
Persistent review updated to latest commit cf8511c |
|
Regression found while verifying #95 on top of this branch (fork 19096bf3, merged with d7ff3afb, llama-server with The new The GLM batched wrong answer mentioned in the Notes is a separate bug: MUL_MAT_ID ignored the route-id stride. The fix is on fork branch |
|
Persistent review updated to latest commit f55b923 |
|
Review from the commit poll: the new pin,
The submodule is declared Heads-up: |
|
Superseded by #104: this PR's llama.cpp commit is in the pin 96f6b89 (1bit-MONSTER/llama.cpp#4), with the MUL_MAT_ID route-stride fix and the FA value_stride range fix. All 7 HRX models pass serve_e2e. |
…n the model rows (#136) - pins_on_branch, before the build: every pin a PR moves must be on the branch .gitmodules names for that submodule (GitHub compare: identical or ahead). Twice this week an engine PR pinned a fork commit on no branch (#103, #106); the shallow clones follow the branch and could not have fetched it. - bump-hrx/* and bump-llama-vulkan/*: every hrx / vulkan row of registry/check_models.tsv through registry_check (serve end to end per architecture: ZAYA1, the Qwen MoE models, GLM, MiniCPM), under the memory guard; any FAIL holds the bump. Build + ctest alone serve one small GGUF, which would not notice an architecture breaking. Tested pins_on_branch against the open PRs: #121's llama.cpp pin f59f6d37 fails (diverged from 1bit/hrx-vulkan-patched); the ZINC (#132) and Lemonade (#133) pins pass. Co-authored-by: bong-water-water-bong <bong-water-water-bong@1bit.gg> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Complements #101 (the non-FA path fix). This PR makes HRX0 claim flash attention for the two MoE shapes that previously declined it, so the FA path is used, and fixes a batched MoE-routing bug that made GLM's FA output garbled.
Problem
resolve_fused_opslogged "Flash Attention not supported, set to disabled" for two MoE shapes:Fix (in the
llama.cppsubmodule,1bit-MONSTER/llama.cpp@ff07f1c71)kPrefillMaxHeadSize512 → 576 (GLM/DeepSeekkey_length), and widen the FA prefill/decode kernels'qk_head_sizeconfig range to 576.key_length, so the value's row stride is 576, notvalue_head_size(512). Match the value against the QK head-size stride and pass the value stride to the kernel (ggml.flash_attention.value_stride).[n_expert_used, n_tokens]view of the[n_expert, n_tokens]argsort, so the stride between a token's route ids isn_expert, notn_expert_used. The mul_mat_id routing bundle assumedroute_stride == route_countand read the wrong experts for batched prompts (GLM answered garbled at the default ubatch). Readroute_stridefromroute_ids->nb[1]and size the span as(token_count - 1) * route_stride + route_count.Verification
tests/serve_e2e.sh build/1bit <model> hrxanswers "Paris" (and streams) on all three: Qwen3-Coder-30B-A3B-Instruct Q4_K_M, GLM-4.7-Flash Q4_K_M, and Qwen3.6-35B-A3B Q8_0 (no regression).~/evidence/hr-95-fa/*.log.