]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
vulkan: Fuse rope+set_rows (llama/16769)
authorJeff Bolz <redacted>
Wed, 29 Oct 2025 20:13:10 +0000 (15:13 -0500)
committerGeorgi Gerganov <redacted>
Sun, 9 Nov 2025 21:38:03 +0000 (23:38 +0200)
commitefe80992687e55340b03d3fb7381432b2bb1203d
tree15eba7143e2d76d94722d6fb139dc613d53bcabf
parent35a3fda24075c106f4d4595508cb3c1eebd5f0aa
vulkan: Fuse rope+set_rows (llama/16769)

This pattern appears in a lot of models, the rope operation is applied right
before storing into the KV cache (usually on the K tensor).

Add a path to some of the rope shaders that computes the destination address
based on the set_rows tensor. Compile variants of the shader with D_TYPE of
f16 (the usual KV cache type).

Add a src3 operand to ggml_vk_op_f32 - sometimes rope uses three srcs and needs
the fourth for the row indices.

Add fused_ops_write_mask to indicate which intermediate tensors need to write
their results to memory. Skipping writing the roped K value helps to allow more
nodes to run concurrently.

Add logic to ggml_vk_graph_optimize to make ROPE+VIEW+SET_ROWS consecutive. It
rarely starts out that way in the graph.

Add new backend tests.
ggml/src/ggml-vulkan/ggml-vulkan.cpp
ggml/src/ggml-vulkan/vulkan-shaders/rope_head.glsl
ggml/src/ggml-vulkan/vulkan-shaders/rope_neox.comp
ggml/src/ggml-vulkan/vulkan-shaders/rope_norm.comp
ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp