]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/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>
Sun, 29 Mar 2026 12:04:36 +0000 (15:04 +0300)
commitdfba84cb470ec2c4d750936b048460648aea7db6
treeeb1c68450b50d654f7ad96acf87d8039ae6d4475
parentd6a0f0d075a2732e30031408e843fbbb712a860f
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.
ggml/src/ggml-cann/aclnn_ops.cpp
ggml/src/ggml-cann/ggml-cann.cpp