]> git.djapps.eu Git - pkg/ggml/sources/ggml/commit
CANN: support flash attention for head dim not multiple of 16, fix ALiBi slope offset...
authorChenguang Li <redacted>
Thu, 19 Mar 2026 03:02:42 +0000 (11:02 +0800)
committerGeorgi Gerganov <redacted>
Sat, 28 Mar 2026 11:39:09 +0000 (13:39 +0200)
commit33696bbb10dfd711c7e62e64dfea236905c67cbf
tree2eb1ecd2598a59769f159b056f6978e0c944b0c0
parent868a1ad7447b3b5cc0882f6829d544b40e2072f1
CANN: support flash attention for head dim not multiple of 16, fix ALiBi slope offset (llama/20031)

- Allow FLASH_ATTN_EXT when head dimension D is not a multiple of 16 by
  padding Q/K/V to D_padded = GGML_PAD(D, 16), running FusedInferAttentionScoreV2,
  then slicing the output back to D (ggml-cann.cpp + aclnn_ops.cpp).
- Fix aclnn_get_slope second-part offset: use ggml_type_size(dtype) instead of
  sizeof(float) so ALiBi slopes are correct when dtype is F16 (e.g. GQA with
  48 heads); fixes buffer overflow and large numerical errors in those cases.
src/ggml-cann/aclnn_ops.cpp
src/ggml-cann/ggml-cann.cpp