]> git.djapps.eu Git - pkg/ggml/sources/ggml/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>
Mon, 18 Nov 2024 08:56:51 +0000 (10:56 +0200)
commit447033fe1d97f2d946a539eb30183604bac325ed
tree936b70128ff9e18b043fbbb4ba78b07ff4070910
parentdb9090b55d1b94790363658c1ed0c94a88c01f81
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.
src/ggml-vulkan/ggml-vulkan.cpp
src/ggml-vulkan/vulkan-shaders/mul_mat_vec.comp
src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q4_k.comp
src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp