ggerganov commited on
Commit
2e71545
·
1 Parent(s): e430cf6

Revert GELU change

Browse files

Seems it does not work on x86 for some reason

Files changed (1) hide show
  1. ggml.c +10 -10
ggml.c CHANGED
@@ -723,21 +723,21 @@ inline static void ggml_vec_gelu_f16(const int n, ggml_fp16_t * y, const ggml_fp
723
  }
724
  }
725
 
726
- inline static void ggml_vec_gelu_f32(const int n, float * y, const float * x) {
727
- uint16_t t;
728
- for (int i = 0; i < n; ++i) {
729
- ggml_fp16_t fp16 = ggml_fp32_to_fp16(x[i]);
730
- memcpy(&t, &fp16, sizeof(uint16_t));
731
- y[i] = table_gelu_f16[t];
732
- }
733
- }
734
-
735
  //inline static void ggml_vec_gelu_f32(const int n, float * y, const float * x) {
 
736
  // for (int i = 0; i < n; ++i) {
737
- // y[i] = ggml_gelu_f32(x[i]);
 
 
738
  // }
739
  //}
740
 
 
 
 
 
 
 
741
  inline static void ggml_vec_sum_f32 (const int n, float * s, const float * x) { ggml_float sum = 0.0; for (int i = 0; i < n; ++i) sum += x[i]; *s += sum; }
742
  inline static void ggml_vec_norm_inv_f32(const int n, float * s, const float * x) { ggml_vec_norm_f32(n, s, x); *s = 1./(*s); }
743
 
 
723
  }
724
  }
725
 
 
 
 
 
 
 
 
 
 
726
  //inline static void ggml_vec_gelu_f32(const int n, float * y, const float * x) {
727
+ // uint16_t t;
728
  // for (int i = 0; i < n; ++i) {
729
+ // ggml_fp16_t fp16 = ggml_fp32_to_fp16(x[i]);
730
+ // memcpy(&t, &fp16, sizeof(uint16_t));
731
+ // y[i] = table_gelu_f16[t];
732
  // }
733
  //}
734
 
735
+ inline static void ggml_vec_gelu_f32(const int n, float * y, const float * x) {
736
+ for (int i = 0; i < n; ++i) {
737
+ y[i] = ggml_gelu_f32(x[i]);
738
+ }
739
+ }
740
+
741
  inline static void ggml_vec_sum_f32 (const int n, float * s, const float * x) { ggml_float sum = 0.0; for (int i = 0; i < n; ++i) sum += x[i]; *s += sum; }
742
  inline static void ggml_vec_norm_inv_f32(const int n, float * s, const float * x) { ggml_vec_norm_f32(n, s, x); *s = 1./(*s); }
743