From: Cebtenzzre Date: Tue, 29 Aug 2023 12:34:59 +0000 (-0400) Subject: CUDA: fix build and enable warnings (#494) X-Git-Tag: upstream/0.0.1642~1256 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=7c8a87690c363ea34ed15a2f912e669b92aeddde;p=pkg%2Fggml%2Fsources%2Fggml CUDA: fix build and enable warnings (#494) * cmake : fix CUDA build -Werror=vla needs to be passed to the host compiler. * cmake : enable warnings for ggml-cuda.cu * ggml : fix some unused variable warnings --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6589e78b..d31be316 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.0) +cmake_minimum_required (VERSION 3.3) project(ggml VERSION 0.1.0) set(CMAKE_EXPORT_COMPILE_COMMANDS "on") @@ -84,7 +84,11 @@ if (GGML_ALL_WARNINGS) endif() if (NOT MSVC) - add_compile_options(-Werror=vla) + add_compile_options( + "$<$:-Werror=vla>" + "$<$:-Werror=vla>" + "$<$:-Xcompiler;-Werror=vla>" + ) endif() # dependencies diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 81d04151..94c31be6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,14 +1,7 @@ if (GGML_ALL_WARNINGS) if (NOT MSVC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \ - -Wunused \ - -Wextra \ - -Wshadow \ - -Wcast-qual \ - -Wdouble-promotion \ - -Wno-unused-function \ - -Wmissing-prototypes \ - ") + add_compile_options(-Wunused -Wextra -Wcast-qual -Wdouble-promotion) + add_compile_options("$<$:-Wshadow;-Wno-unused-function;-Wmissing-prototypes>") else() # todo : windows endif() diff --git a/src/ggml-cuda.cu b/src/ggml-cuda.cu index 5fd62563..391e6318 100644 --- a/src/ggml-cuda.cu +++ b/src/ggml-cuda.cu @@ -5721,6 +5721,7 @@ inline void ggml_cuda_op_alibi( (void) src1; (void) src0_ddq_i; (void) src1_ddf_i; + (void) i02; (void) i1; } diff --git a/src/ggml.c b/src/ggml.c index b199bb1a..fb534c4c 100644 --- a/src/ggml.c +++ b/src/ggml.c @@ -1292,6 +1292,7 @@ static void quantize_row_q8_0(const float * restrict x, void * restrict vy, int #endif } #else + (void)nb; // scalar quantize_row_q8_0_reference(x, y, k); #endif @@ -1510,6 +1511,7 @@ static void quantize_row_q8_1(const float * restrict x, void * restrict vy, int #endif } #else + (void)nb; // scalar quantize_row_q8_1_reference(x, y, k); #endif