]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
vulkan: Optimize argsort (llama/15354)
authorJeff Bolz <redacted>
Sun, 17 Aug 2025 08:41:45 +0000 (03:41 -0500)
committerGeorgi Gerganov <redacted>
Mon, 18 Aug 2025 17:30:45 +0000 (20:30 +0300)
commit0a8285186a9bb63d38dd137abfebae0e1269c1cc
tree74b0751bbf135e936437161c3448512d4fbcbbdd
parentc44d4496353040236a60f6f9c5ae807cbc6f14f4
vulkan: Optimize argsort (llama/15354)

- Launch an appropriate number of invocations (next larger power of two).
32 invocations is common and the barrier is much cheaper there.
- Specialize for "needs bounds checking" vs not.
- Make the code less branchy and [[unroll]] the loops. In the final code,
I see no branches inside the main loop (only predicated stores) when
needs_bounds_check is false.
- Always sort ascending, then apply the ascending vs descending option when
doing the final stores to memory.
- Copy the values into shared memory, makes them slightly cheaper to access.
ggml/src/ggml-vulkan/ggml-vulkan.cpp
ggml/src/ggml-vulkan/vulkan-shaders/argsort.comp