]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
vulkan: Optimize some mat-vec mul quant shaders (llama/10296)
authorJeff Bolz <redacted>
Sat, 16 Nov 2024 06:26:57 +0000 (00:26 -0600)
committerGeorgi Gerganov <redacted>
Wed, 20 Nov 2024 19:00:08 +0000 (21:00 +0200)
commit1bebb1a1165b0a131682af13d20cd88bf9016ef7
tree56a974905fbcf6d1916b84e159f9fe2b2025474b
parentee437cde59ebc54d3fddb754ee53c830fc325160
vulkan: Optimize some mat-vec mul quant shaders (llama/10296)

Compute two result elements per workgroup (for Q{4,5}_{0,1}). This reuses
the B loads across the rows and also reuses some addressing calculations.
This required manually partially unrolling the loop, since the compiler
is less willing to unroll outer loops.

Add bounds-checking on the last iteration of the loop. I think this was at
least partly broken before.

Optimize the Q4_K shader to vectorize most loads and reduce the number of
bit twiddling instructions.
ggml/src/ggml-vulkan/ggml-vulkan.cpp
ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec.comp
ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q4_k.comp
ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp