ChangSeok Oh commited on
Commit
45ef7b5
·
unverified ·
1 Parent(s): 96ada58

ggml : fix compilation errors incurred by -Werror (#1227)

Browse files

The -Werror warning option turns all warnings into errors. This PR makes
the compiler happy to build ggml.c and whisper.cpp with the stricter option.

Files changed (2) hide show
  1. ggml.c +10 -3
  2. whisper.cpp +9 -2
ggml.c CHANGED
@@ -663,7 +663,7 @@ static inline __m256 sum_i16_pairs_float(const __m256i x) {
663
  }
664
 
665
  static inline __m256 mul_sum_us8_pairs_float(const __m256i ax, const __m256i sy) {
666
- #if __AVXVNNI__
667
  const __m256i zero = _mm256_setzero_si256();
668
  const __m256i summed_pairs = _mm256_dpbusd_epi32(zero, ax, sy);
669
  return _mm256_cvtepi32_ps(summed_pairs);
@@ -676,7 +676,7 @@ static inline __m256 mul_sum_us8_pairs_float(const __m256i ax, const __m256i sy)
676
 
677
  // multiply int8_t, add results pairwise twice and return as float vector
678
  static inline __m256 mul_sum_i8_pairs_float(const __m256i x, const __m256i y) {
679
- #if __AVXVNNIINT8__
680
  const __m256i zero = _mm256_setzero_si256();
681
  const __m256i summed_pairs = _mm256_dpbssd_epi32(zero, x, y);
682
  return _mm256_cvtepi32_ps(summed_pairs);
@@ -692,7 +692,7 @@ static inline __m256 mul_sum_i8_pairs_float(const __m256i x, const __m256i y) {
692
  static inline __m128i packNibbles( __m256i bytes )
693
  {
694
  // Move bits within 16-bit lanes from 0000_abcd_0000_efgh into 0000_0000_abcd_efgh
695
- #if __AVX512F__
696
  const __m256i bytes_srli_4 = _mm256_srli_epi16(bytes, 4); // 0000_0000_abcd_0000
697
  bytes = _mm256_or_si256(bytes, bytes_srli_4); // 0000_abcd_abcd_efgh
698
  return _mm256_cvtepi16_epi8(bytes); // abcd_efgh
@@ -4949,6 +4949,13 @@ struct ggml_tensor * ggml_set_name(struct ggml_tensor * tensor, const char * nam
4949
  return tensor;
4950
  }
4951
 
 
 
 
 
 
 
 
4952
  struct ggml_tensor * ggml_format_name(struct ggml_tensor * tensor, const char * fmt, ...) {
4953
  va_list args;
4954
  va_start(args, fmt);
 
663
  }
664
 
665
  static inline __m256 mul_sum_us8_pairs_float(const __m256i ax, const __m256i sy) {
666
+ #ifdef __AVXVNNI__
667
  const __m256i zero = _mm256_setzero_si256();
668
  const __m256i summed_pairs = _mm256_dpbusd_epi32(zero, ax, sy);
669
  return _mm256_cvtepi32_ps(summed_pairs);
 
676
 
677
  // multiply int8_t, add results pairwise twice and return as float vector
678
  static inline __m256 mul_sum_i8_pairs_float(const __m256i x, const __m256i y) {
679
+ #ifdef __AVXVNNIINT8__
680
  const __m256i zero = _mm256_setzero_si256();
681
  const __m256i summed_pairs = _mm256_dpbssd_epi32(zero, x, y);
682
  return _mm256_cvtepi32_ps(summed_pairs);
 
692
  static inline __m128i packNibbles( __m256i bytes )
693
  {
694
  // Move bits within 16-bit lanes from 0000_abcd_0000_efgh into 0000_0000_abcd_efgh
695
+ #ifdef __AVX512F__
696
  const __m256i bytes_srli_4 = _mm256_srli_epi16(bytes, 4); // 0000_0000_abcd_0000
697
  bytes = _mm256_or_si256(bytes, bytes_srli_4); // 0000_abcd_abcd_efgh
698
  return _mm256_cvtepi16_epi8(bytes); // abcd_efgh
 
4949
  return tensor;
4950
  }
4951
 
4952
+ #ifdef __GNUC__
4953
+ #ifdef __MINGW32__
4954
+ __attribute__((gnu_format(printf, 2, 3)))
4955
+ #else
4956
+ __attribute__((format(printf, 2, 3)))
4957
+ #endif
4958
+ #endif
4959
  struct ggml_tensor * ggml_format_name(struct ggml_tensor * tensor, const char * fmt, ...) {
4960
  va_list args;
4961
  va_start(args, fmt);
whisper.cpp CHANGED
@@ -3,7 +3,7 @@
3
  #include "coreml/whisper-encoder.h"
4
  #endif
5
 
6
- #if WHISPER_USE_OPENVINO
7
  #include "openvino/whisper-openvino-encoder.h"
8
  #endif
9
 
@@ -730,6 +730,13 @@ static void whisper_default_log(const char * text) {
730
 
731
  static whisper_log_callback whisper_log = whisper_default_log;
732
 
 
 
 
 
 
 
 
733
  static void log(const char * fmt, ...) {
734
  if (!whisper_log) return;
735
  char buf[1024];
@@ -2446,7 +2453,7 @@ static void fft(const std::vector<float> & in, std::vector<float> & out) {
2446
  }
2447
 
2448
  static bool hann_window(int length, bool periodic, std::vector<float> & output) {
2449
- if (output.size() < length) {
2450
  output.resize(length);
2451
  }
2452
  int offset = -1;
 
3
  #include "coreml/whisper-encoder.h"
4
  #endif
5
 
6
+ #ifdef WHISPER_USE_OPENVINO
7
  #include "openvino/whisper-openvino-encoder.h"
8
  #endif
9
 
 
730
 
731
  static whisper_log_callback whisper_log = whisper_default_log;
732
 
733
+ #ifdef __GNUC__
734
+ #ifdef __MINGW32__
735
+ __attribute__((gnu_format(printf, 1, 2)))
736
+ #else
737
+ __attribute__((format(printf, 1, 2)))
738
+ #endif
739
+ #endif
740
  static void log(const char * fmt, ...) {
741
  if (!whisper_log) return;
742
  char buf[1024];
 
2453
  }
2454
 
2455
  static bool hann_window(int length, bool periodic, std::vector<float> & output) {
2456
+ if (output.size() < static_cast<size_t>(length)) {
2457
  output.resize(length);
2458
  }
2459
  int offset = -1;