From 64beaf76ab52ec272e96ee8fc0ae54eb16497de7 Mon Sep 17 00:00:00 2001 From: slaren Date: Fri, 29 Sep 2023 22:17:49 +0200 Subject: [PATCH] ggml-cuda : explicitly use cmath for log2 --- ggml-cuda.cu | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ggml-cuda.cu b/ggml-cuda.cu index 86d1fe203..9e7b1e256 100644 --- a/ggml-cuda.cu +++ b/ggml-cuda.cu @@ -1,11 +1,12 @@ #include +#include +#include +#include #include #include #include #include #include -#include -#include #if defined(GGML_USE_HIPBLAS) #include @@ -6237,7 +6238,7 @@ inline void ggml_cuda_op_alibi( GGML_ASSERT(ne01 + n_past == ne00); GGML_ASSERT(n_head == ne02); - const int n_heads_log2_floor = 1 << (int) floor(log2(n_head)); + const int n_heads_log2_floor = 1 << (int) std::floor(std::log2(n_head)); const float m0 = powf(2.0f, -(max_bias) / n_heads_log2_floor); const float m1 = powf(2.0f, -(max_bias / 2.0f) / n_heads_log2_floor);