]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
vulkan: Implement top-k (llama/17418)
authorJeff Bolz <redacted>
Wed, 26 Nov 2025 15:45:43 +0000 (09:45 -0600)
committerGeorgi Gerganov <redacted>
Fri, 12 Dec 2025 15:53:09 +0000 (17:53 +0200)
commitd8b61e05f8d66991177d9c120d58c7925db402bf
tree8f2151485c8bc5bf57eb0e09548d2e7c50642427
parentfb31a1979701cb0491d555d784e02c6d17d279e4
vulkan: Implement top-k (llama/17418)

* vulkan: Implement top-k

Each pass launches workgroups that each sort 2^N elements (where N is usually 7-10)
and discards all but the top K. Repeat until only K are left. And there's a fast
path when K==1 to just find the max value rather than sorting.

* fix pipeline selection

* vulkan: Add N-ary search algorithm for topk

* microoptimizations
ggml/src/ggml-vulkan/ggml-vulkan.cpp
ggml/src/ggml-vulkan/vulkan-shaders/topk_argsort.comp [new file with mode: 0644]
ggml/src/ggml-vulkan/vulkan-shaders/topk_nary_search.comp [new file with mode: 0644]
ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp