Commit 0379ee269 for llama.cpp
commit 0379ee269bce6accf30c7f09a2eb81d1ecf21ddf
Author: Ruben Ortlam <rortlam@redhat.com>
Date: Sat Dec 5 11:00:17 2026 +0100
vulkan: clamp rms_norm_mul_rope read to avoid OOB (#33705)
* vulkan: clamp rms_norm_mul_rope read to avoid OOB
* add comments to mark as workaround
diff --git a/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm.comp b/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm.comp
index b73fdeca4..27755bb09 100644
--- a/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm.comp
+++ b/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm.comp
@@ -89,7 +89,8 @@ void rms_norm(uint num_iters) {
#if RMS_NORM_ROPE_FUSION
for (uint col = tid; col < ncols; col += BLOCK_SIZE) {
- const FLOAT_TYPE xi = FLOAT_TYPE(data_a[a_offset + col]);
+ // The min clamp is a workaround for an Nvidia compiler bug
+ const FLOAT_TYPE xi = FLOAT_TYPE(data_a[a_offset + min(col, ncols - 1)]);
sum += xi * xi;
}
#else
@@ -140,7 +141,8 @@ void rms_norm(uint num_iters) {
#if RMS_NORM_ROPE_FUSION
for (uint col = tid; col < ncols; col += BLOCK_SIZE) {
- FLOAT_TYPE value = scale * FLOAT_TYPE(data_a[a_offset + col]);
+ // The min clamp is a workaround for an Nvidia compiler bug
+ FLOAT_TYPE value = scale * FLOAT_TYPE(data_a[a_offset + min(col, ncols - 1)]);
if (do_multiply) {
value *= FLOAT_TYPE(data_b[b_offset + fastmod(col, p.ne10)]);
}