danbev commited on
Commit
e0d130c
·
unverified ·
1 Parent(s): 02b25fa

whisper: remove MSVC warnings pragmas (#3090)

Browse files

* ggml : remove MSVC warnings pragmas

This commit removes the MSVC-specific pragmas as these are now handled
in CMakeLists.txt.

* whisper : remove MSVC warning pragmas

This commit removes the MSVC-specific pragmas. These are now handled in
the CMakeLists.txt file.

CMakeLists.txt CHANGED
@@ -232,6 +232,7 @@ if (MSVC)
232
  endfunction()
233
 
234
  if (WHISPER_BUILD_EXAMPLES)
 
235
  disable_msvc_warnings(common)
236
  disable_msvc_warnings(common-sdl)
237
  disable_msvc_warnings(lsp)
 
232
  endfunction()
233
 
234
  if (WHISPER_BUILD_EXAMPLES)
235
+ disable_msvc_warnings(whisper)
236
  disable_msvc_warnings(common)
237
  disable_msvc_warnings(common-sdl)
238
  disable_msvc_warnings(lsp)
examples/cli/cli.cpp CHANGED
@@ -20,10 +20,6 @@
20
  #include <windows.h>
21
  #endif
22
 
23
- #if defined(_MSC_VER)
24
- #pragma warning(disable: 4244 4267) // possible loss of data
25
- #endif
26
-
27
  // helper function to replace substrings
28
  static void replace_all(std::string & s, const std::string & search, const std::string & replace) {
29
  for (size_t pos = 0; ; pos += replace.length()) {
 
20
  #include <windows.h>
21
  #endif
22
 
 
 
 
 
23
  // helper function to replace substrings
24
  static void replace_all(std::string & s, const std::string & search, const std::string & replace) {
25
  for (size_t pos = 0; ; pos += replace.length()) {
examples/common-whisper.cpp CHANGED
@@ -26,10 +26,6 @@
26
  #define MINIAUDIO_IMPLEMENTATION
27
  #include "miniaudio.h"
28
 
29
- #if defined(_MSC_VER)
30
- #pragma warning(disable: 4244 4267) // possible loss of data
31
- #endif
32
-
33
  #ifdef _WIN32
34
  #include <fcntl.h>
35
  #include <io.h>
 
26
  #define MINIAUDIO_IMPLEMENTATION
27
  #include "miniaudio.h"
28
 
 
 
 
 
29
  #ifdef _WIN32
30
  #include <fcntl.h>
31
  #include <io.h>
examples/common.cpp CHANGED
@@ -10,10 +10,6 @@
10
  #include <regex>
11
  #include <sstream>
12
 
13
- #if defined(_MSC_VER)
14
- #pragma warning(disable: 4244 4267) // possible loss of data
15
- #endif
16
-
17
  // Function to check if the next argument exists
18
  static std::string get_next_arg(int& i, int argc, char** argv, const std::string& flag, gpt_params& params) {
19
  if (i + 1 < argc && argv[i + 1][0] != '-') {
 
10
  #include <regex>
11
  #include <sstream>
12
 
 
 
 
 
13
  // Function to check if the next argument exists
14
  static std::string get_next_arg(int& i, int argc, char** argv, const std::string& flag, gpt_params& params) {
15
  if (i + 1 < argc && argv[i + 1][0] != '-') {
examples/server/server.cpp CHANGED
@@ -14,10 +14,6 @@
14
  #include <thread>
15
  #include <vector>
16
 
17
- #if defined(_MSC_VER)
18
- #pragma warning(disable: 4244 4267) // possible loss of data
19
- #endif
20
-
21
  using namespace httplib;
22
  using json = nlohmann::ordered_json;
23
 
 
14
  #include <thread>
15
  #include <vector>
16
 
 
 
 
 
17
  using namespace httplib;
18
  using json = nlohmann::ordered_json;
19
 
examples/talk-llama/llama.cpp CHANGED
@@ -16,10 +16,6 @@
16
  #include <cstring>
17
  #include <ctime>
18
 
19
- #if defined(_MSC_VER)
20
- #pragma warning(disable: 4244 4267) // possible loss of data
21
- #endif
22
-
23
  //
24
  // interface implementation
25
  //
 
16
  #include <cstring>
17
  #include <ctime>
18
 
 
 
 
 
19
  //
20
  // interface implementation
21
  //
ggml/CMakeLists.txt CHANGED
@@ -366,6 +366,8 @@ if (MSVC)
366
  /wd4005 # Macro redefinition
367
  /wd4244 # Conversion from one type to another type, possible loss of data
368
  /wd4267 # Conversion from 'size_t' to a smaller type, possible loss of data
 
 
369
  )
370
  function(disable_msvc_warnings target_name)
371
  if(TARGET ${target_name})
 
366
  /wd4005 # Macro redefinition
367
  /wd4244 # Conversion from one type to another type, possible loss of data
368
  /wd4267 # Conversion from 'size_t' to a smaller type, possible loss of data
369
+ /wd4996 # Disable POSIX deprecation warnings
370
+ /wd4702 # Unreachable code warnings
371
  )
372
  function(disable_msvc_warnings target_name)
373
  if(TARGET ${target_name})
ggml/src/ggml-cpu/ggml-cpu-aarch64.cpp CHANGED
@@ -72,8 +72,6 @@ static_assert(sizeof(block_iq4_nlx4) == 4 * sizeof(ggml_half) + QK4_NL * 2, "wro
72
 
73
  #if defined(__GNUC__)
74
  #pragma GCC diagnostic ignored "-Woverlength-strings"
75
- #elif defined(_MSC_VER)
76
- #pragma warning(disable: 4244 4267) // possible loss of data
77
  #endif
78
 
79
  #define UNUSED GGML_UNUSED
 
72
 
73
  #if defined(__GNUC__)
74
  #pragma GCC diagnostic ignored "-Woverlength-strings"
 
 
75
  #endif
76
 
77
  #define UNUSED GGML_UNUSED
ggml/src/ggml-cpu/ggml-cpu-quants.c CHANGED
@@ -20,12 +20,6 @@
20
  #define GROUP_MAX_EPS_IQ1_M 1e-7f
21
  #define GROUP_MAX_EPS_IQ1_S 1e-12f
22
 
23
- #if defined(_MSC_VER)
24
- // disable "possible loss of data" to avoid warnings for hundreds of casts
25
- // we should just be careful :)
26
- #pragma warning(disable: 4244 4267)
27
- #endif
28
-
29
  #define UNUSED GGML_UNUSED
30
 
31
  // some compilers don't provide _mm256_set_m128i, e.g. gcc 7
 
20
  #define GROUP_MAX_EPS_IQ1_M 1e-7f
21
  #define GROUP_MAX_EPS_IQ1_S 1e-12f
22
 
 
 
 
 
 
 
23
  #define UNUSED GGML_UNUSED
24
 
25
  // some compilers don't provide _mm256_set_m128i, e.g. gcc 7
ggml/src/ggml-cpu/ggml-cpu.c CHANGED
@@ -50,19 +50,6 @@
50
  #include "llamafile/sgemm.h"
51
  #endif
52
 
53
- #if defined(_MSC_VER)
54
- // disable "possible loss of data" to avoid hundreds of casts
55
- // we should just be careful :)
56
- #pragma warning(disable: 4244 4267)
57
-
58
- // disable POSIX deprecation warnings
59
- // these functions are never going away, anyway
60
- #pragma warning(disable: 4996)
61
-
62
- // unreachable code because of multiple instances of code after GGML_ABORT
63
- #pragma warning(disable: 4702)
64
- #endif
65
-
66
  // Note: once we move threading into a separate C++ file
67
  // will use std::hardware_destructive_interference_size instead of hardcoding it here
68
  // and we'll use C++ attribute syntax.
 
50
  #include "llamafile/sgemm.h"
51
  #endif
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  // Note: once we move threading into a separate C++ file
54
  // will use std::hardware_destructive_interference_size instead of hardcoding it here
55
  // and we'll use C++ attribute syntax.
ggml/src/ggml-cpu/ops.cpp CHANGED
@@ -8,19 +8,6 @@
8
 
9
  #include <float.h>
10
 
11
- #if defined(_MSC_VER)
12
- // disable "possible loss of data" to avoid hundreds of casts
13
- // we should just be careful :)
14
- #pragma warning(disable: 4244 4267)
15
-
16
- // disable POSIX deprecation warnings
17
- // these functions are never going away, anyway
18
- #pragma warning(disable: 4996)
19
-
20
- // unreachable code because of multiple instances of code after GGML_ABORT
21
- #pragma warning(disable: 4702)
22
- #endif
23
-
24
  // ggml_compute_forward_dup
25
 
26
  static void ggml_compute_forward_dup_same_cont(
 
8
 
9
  #include <float.h>
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  // ggml_compute_forward_dup
12
 
13
  static void ggml_compute_forward_dup_same_cont(
ggml/src/ggml-cpu/vec.cpp CHANGED
@@ -2,12 +2,6 @@
2
 
3
  #include <cassert>
4
 
5
- #if defined(_MSC_VER)
6
- // disable "possible loss of data" to avoid hundreds of casts
7
- // we should just be careful :)
8
- #pragma warning(disable: 4244 4267)
9
- #endif
10
-
11
  // precomputed gelu table for f16 (128 KB)
12
  ggml_fp16_t ggml_table_gelu_f16[1 << 16];
13
 
 
2
 
3
  #include <cassert>
4
 
 
 
 
 
 
 
5
  // precomputed gelu table for f16 (128 KB)
6
  ggml_fp16_t ggml_table_gelu_f16[1 << 16];
7
 
ggml/src/ggml-cuda/common.cuh CHANGED
@@ -130,10 +130,6 @@ static int ggml_cuda_highest_compiled_arch(const int arch) {
130
 
131
  #define MATRIX_ROW_PADDING 512 // last row of quant. matrices is a multiple of this to avoid out-of-bounds memory accesses
132
 
133
- #if defined(_MSC_VER)
134
- #pragma warning(disable: 4244 4267) // possible loss of data
135
- #endif
136
-
137
  #define GGML_CUDA_MAX_STREAMS 8
138
 
139
  [[noreturn]]
 
130
 
131
  #define MATRIX_ROW_PADDING 512 // last row of quant. matrices is a multiple of this to avoid out-of-bounds memory accesses
132
 
 
 
 
 
133
  #define GGML_CUDA_MAX_STREAMS 8
134
 
135
  [[noreturn]]
ggml/src/ggml-quants.c CHANGED
@@ -19,12 +19,6 @@
19
  #define GROUP_MAX_EPS_IQ1_M 1e-7f
20
  #define GROUP_MAX_EPS_IQ1_S 1e-12f
21
 
22
- #if defined(_MSC_VER)
23
- // disable "possible loss of data" to avoid warnings for hundreds of casts
24
- // we should just be careful :)
25
- #pragma warning(disable: 4244 4267)
26
- #endif
27
-
28
  #define UNUSED GGML_UNUSED
29
 
30
  // reference implementation for deterministic creation of model files
 
19
  #define GROUP_MAX_EPS_IQ1_M 1e-7f
20
  #define GROUP_MAX_EPS_IQ1_S 1e-12f
21
 
 
 
 
 
 
 
22
  #define UNUSED GGML_UNUSED
23
 
24
  // reference implementation for deterministic creation of model files
ggml/src/ggml-sycl/common.hpp CHANGED
@@ -80,10 +80,6 @@ extern int g_ggml_sycl_disable_optimize;
80
  // max batch size to use MMQ kernels when tensor cores are available
81
  #define MMQ_MAX_BATCH_SIZE 32
82
 
83
- #if defined(_MSC_VER)
84
- #pragma warning(disable : 4244 4267) // possible loss of data
85
- #endif
86
-
87
  // dmmv = dequantize_mul_mat_vec
88
  #ifndef GGML_SYCL_DMMV_X
89
  #define GGML_SYCL_DMMV_X 32
 
80
  // max batch size to use MMQ kernels when tensor cores are available
81
  #define MMQ_MAX_BATCH_SIZE 32
82
 
 
 
 
 
83
  // dmmv = dequantize_mul_mat_vec
84
  #ifndef GGML_SYCL_DMMV_X
85
  #define GGML_SYCL_DMMV_X 32
src/whisper.cpp CHANGED
@@ -37,10 +37,6 @@
37
 
38
  // dummy
39
 
40
- #if defined(_MSC_VER)
41
- #pragma warning(disable: 4244 4267) // possible loss of data
42
- #endif
43
-
44
  #if defined(WHISPER_BIG_ENDIAN)
45
  template<typename T>
46
  static T byteswap(T value) {
 
37
 
38
  // dummy
39
 
 
 
 
 
40
  #if defined(WHISPER_BIG_ENDIAN)
41
  template<typename T>
42
  static T byteswap(T value) {