Commit fb556b1
feat(paged): support sub-128 head_dim for paged turbo cache (LFM2.5 head_dim 64)
The paged turbo kernels quantize 128-element blocks (QK_TURBO=128), so a
head_dim < 128 (LFM2.5 hybrid attention: head_dim 64) is smaller than one
block and the dispatch rejects it. Zero-pad each head to 128 in build_attn
for the paged turbo path (q/k/v padded before the F16 cast since ggml_pad
needs F32; output sliced back to head_dim), and size the paged cache to the
padded head_dim to match. Mirrors the non-paged turbo path.
Correctness: padded Q dims are zero so they contribute nothing to QK
(K-pad quant is irrelevant); padded V output dims are sliced off. Validated
end-to-end on gfx803 once the warp-width corruption was fixed -- LFM2.5
paged turbo4 now generates coherent, correct text on the full tiered config.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 62f4f99 commit fb556b1
2 files changed
Lines changed: 38 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2659 | 2659 | | |
2660 | 2660 | | |
2661 | 2661 | | |
2662 | | - | |
2663 | | - | |
2664 | | - | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
| 2678 | + | |
| 2679 | + | |
| 2680 | + | |
| 2681 | + | |
| 2682 | + | |
2665 | 2683 | | |
2666 | 2684 | | |
2667 | 2685 | | |
| |||
2692 | 2710 | | |
2693 | 2711 | | |
2694 | 2712 | | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
| 2720 | + | |
2695 | 2721 | | |
2696 | 2722 | | |
2697 | 2723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
123 | 132 | | |
124 | 133 | | |
125 | 134 | | |
| |||
0 commit comments