Skip to content

LLM inference in C/C++

C++ ggml

CUDA/HIP: fix race in flash_attn_ext_f16_process_tile when nbatch_combine != DKQ/2 (#30103)

uvos1bb2b9fcbe85
diff --git a/ggml/src/ggml-cuda/fattn-mma-f16.cuh b/ggml/src/ggml-cuda/fattn-mma-f16.cuh
index 7f0f6abfdb..296aa2b349 100644
--- a/ggml/src/ggml-cuda/fattn-mma-f16.cuh
+++ b/ggml/src/ggml-cuda/fattn-mma-f16.cuh
@@ -1772,7 +1772,7 @@ static __device__ __forceinline__ void flash_attn_ext_f16_process_tile(
}
}
}
- if (np > 1) {
+ if (np > 1 || nbatch_combine != DKQ/2) {
__syncthreads();
}
}