]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
ggml-cuda: add flash-attn support for DKQ=320/DV=256 with ncols2=32 (… (#22286)
authorlnigam <redacted>
Tue, 28 Apr 2026 19:37:35 +0000 (01:07 +0530)
committerGitHub <redacted>
Tue, 28 Apr 2026 19:37:35 +0000 (21:37 +0200)
commit7b8443ac786c06438e0f407b7adaa72c220b5099
tree4152b21e90556769cf5f652a7bfc3443d9ed43a4
parent5d56effdeea49413da226d4815db58f515832ead
ggml-cuda: add flash-attn support for DKQ=320/DV=256 with ncols2=32 (… (#22286)

* ggml-cuda: add flash-attn support for DKQ=320/DV=256 with ncols2=32 (GQA=32)

Adds MMA-f16 and tile kernel configs, dispatch logic, template instances,
and tile .cu file for Mistral Small 4 (head sizes 320/256), restricting to
ncols2=32 to support GQA ratio 32 only.

* Adding check to return BEST_FATTN_KERNEL_NONE in case GQA!=32

* Apply suggestions from code review

Address review comments

Co-authored-by: Johannes Gäßler <redacted>
* Address review comments and making kernel config default to DQK=512, DV=512 instead of DQK=256,DV=256

* Fixed bug with sinks=1, with ncols=32, there are two warp-groups created but sinks index is same(0,...,15) for both the groups hence with sinks=1, output is not matching with CPU output. Added sink_base which will be base index for each warp_group (threadIdx.y / np)

* Apply suggestions from code review

Co-authored-by: Johannes Gäßler <redacted>
* Update ggml/src/ggml-cuda/template-instances/generate_cu_files.py

Co-authored-by: Johannes Gäßler <redacted>
---------

Co-authored-by: Johannes Gäßler <redacted>
ggml/src/ggml-cuda/fattn-mma-f16.cuh
ggml/src/ggml-cuda/fattn-tile.cu
ggml/src/ggml-cuda/fattn-tile.cuh
ggml/src/ggml-cuda/fattn.cu
ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_32.cu
ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_32.cu
ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq320-dv256.cu [new file with mode: 0644]
ggml/src/ggml-cuda/template-instances/generate_cu_files.py