From 063d99ad11f1295046610ce5b97e105849a4b573 Mon Sep 17 00:00:00 2001 From: luoyu-intel Date: Tue, 23 Jul 2024 07:43:28 +0000 Subject: [PATCH] [SYCL] fix scratch size of softmax (#8642) --- ggml/src/ggml-sycl/softmax.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-sycl/softmax.cpp b/ggml/src/ggml-sycl/softmax.cpp index c5d9a837e..17a542e49 100644 --- a/ggml/src/ggml-sycl/softmax.cpp +++ b/ggml/src/ggml-sycl/softmax.cpp @@ -152,7 +152,8 @@ static void soft_max_f32_sycl(const float * x, const float * mask, const sycl::range<3> block_dims(1, 1, nth); const sycl::range<3> block_nums(1, 1, nrows_x); - const size_t n_local_scratch = (GGML_PAD(ncols_x, WARP_SIZE) + WARP_SIZE); + const size_t n_val_tmp = nth / WARP_SIZE; + const size_t n_local_scratch = (GGML_PAD(ncols_x, WARP_SIZE) + n_val_tmp); const uint32_t n_head_kv = nrows_x/nrows_y; const uint32_t n_head_log2 = 1u << (uint32_t) floorf(log2f((float) n_head_kv));