[ util ] Change name swish -> swiglu
authorskykongkong8 <ss.kong@samsung.com>
Tue, 16 Jul 2024 03:06:29 +0000 (12:06 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Wed, 17 Jul 2024 07:47:42 +0000 (16:47 +0900)
- There was a typo in swiglu function. With Z element multiplication, this function is swiglu, not a swish

**Self evaluation:**
1. Build test:     [X]Passed [ ]Failed [ ]Skipped
2. Run test:     [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: skykongkong8 <ss.kong@samsung.com>
nntrainer/utils/util_simd.cpp
nntrainer/utils/util_simd.h
nntrainer/utils/util_simd_neon.cpp
nntrainer/utils/util_simd_neon.h

index 2ec89872e1580e2fff2405ae57119698018cb3cd..81aa88eb959c78c6fd2bfdcd186dea6cb4c14656 100644 (file)
@@ -28,9 +28,9 @@ void calc_trigonometric_vals_dup(unsigned int N_half, float *angle, float *cos_,
 #endif
 }
 
-void swish(const unsigned int N, float *X, float *Y, float *Z) {
+void swiglu(const unsigned int N, float *X, float *Y, float *Z) {
 #ifdef USE_NEON
-  nntrainer::neon::swish(N, X, Y, Z);
+  nntrainer::neon::swiglu(N, X, Y, Z);
 #else
   unsigned int i = 0;
   while (i < N) {
@@ -83,9 +83,9 @@ void compute_rotary_embedding_value(unsigned int dim, unsigned int half_,
 #endif
 }
 
-void swish(const unsigned int N, _FP16 *X, _FP16 *Y, _FP16 *Z) {
+void swiglu(const unsigned int N, _FP16 *X, _FP16 *Y, _FP16 *Z) {
 #ifdef USE_NEON
-  nntrainer::neon::swish(N, X, Y, Z);
+  nntrainer::neon::swiglu(N, X, Y, Z);
 #else
   unsigned int i = 0;
   while (i < N) {
index 9dafc17099180c077bbc1ec2edfd845015f1ebe6..26bf808052e4e8edfa7ba679f47a3adeab0fccb8 100644 (file)
@@ -32,14 +32,14 @@ namespace nntrainer {
 void calc_trigonometric_vals_dup(unsigned int N_half, float *angle, float *cos_,
                                  float *sin_, unsigned int alpha = 1.0);
 /**
- * @brief swish function with neon : X = (Y / (1 + exp( -Y ))) * Z
+ * @brief swiglu function with neon : X = (Y / (1 + exp( -Y ))) * Z
  *
  * @param N number of elements in X
  * @param X float * for Vector X
  * @param Y float * for Vector Y
  * @param Z float * for Vector Z
  */
-void swish(const unsigned int N, float *X, float *Y, float *Z);
+void swiglu(const unsigned int N, float *X, float *Y, float *Z);
 
 /**
  * @brief returns maximum value of the vector X
@@ -75,14 +75,14 @@ void compute_rotary_embedding_value(unsigned int dim, unsigned int half_,
                                     unsigned int w, _FP16 *in, _FP16 *out,
                                     float *cos_, float *sin_);
 /**
- * @brief swish function : X = (Y / (1 + exp( -Y ))) * Z
+ * @brief swiglu function : X = (Y / (1 + exp( -Y ))) * Z
  *
  * @param N number of elements in X
  * @param X _FP16 * for Vector X
  * @param Y _FP16 * for Vector Y
  * @param Z _FP16 * for Vector Z
  */
-void swish(const unsigned int N, _FP16 *X, _FP16 *Y, _FP16 *Z);
+void swiglu(const unsigned int N, _FP16 *X, _FP16 *Y, _FP16 *Z);
 
 /**
  * @brief returns maximum value of the vector X
index a76f8883030cbfe9d9bcf5c109512766a3950af1..d8238970471f10c49d8e0f0e6de26ae2afb04ba2 100644 (file)
@@ -35,7 +35,7 @@ void calc_trigonometric_vals_dup(unsigned int N_half, float *angle, float *cos_,
   }
 }
 
-void swish(const unsigned int N, float *X, float *Y, float *Z) {
+void swiglu(const unsigned int N, float *X, float *Y, float *Z) {
   unsigned int i = 0;
   for (; N - i >= VL_FP32; i += VL_FP32) {
     float32x4_t y0_3 = vld1q_f32(&Y[i]);
@@ -186,7 +186,7 @@ void compute_rotary_embedding_value(unsigned int dim, unsigned int half_,
   }
 }
 
-void swish(const unsigned int N, __fp16 *X, __fp16 *Y, __fp16 *Z) {
+void swiglu(const unsigned int N, __fp16 *X, __fp16 *Y, __fp16 *Z) {
   unsigned int i = 0;
   for (; N - i >= VL_FP16; i += VL_FP16) {
     float16x8_t y0_7 = vld1q_f16(&Y[i]);
index e838ea8520fe5c2b57df565e6c3c02b5c4ad89d1..aea5a4d1d2a4d005141a685eabafa6a5aec889c9 100644 (file)
@@ -32,14 +32,14 @@ void calc_trigonometric_vals_dup(unsigned int N_half, float *angle, float *cos_,
                                  float *sin_, unsigned int alpha = 1.0);
 
 /**
- * @brief swish function with neon : X = (Y / (1 + exp( -Y ))) * Z
+ * @brief swiglu function with neon : X = (Y / (1 + exp( -Y ))) * Z
  *
  * @param N number of elements in X
  * @param X float * for Vector X
  * @param Y float * for Vector Y
  * @param Z float * for Vector Z
  */
-void swish(const unsigned int N, float *X, float *Y, float *Z);
+void swiglu(const unsigned int N, float *X, float *Y, float *Z);
 
 /**
  * @brief returns maximum value of the vector X
@@ -82,14 +82,14 @@ void compute_rotary_embedding_value(unsigned int dim, unsigned int half_,
                                     unsigned int w, __fp16 *in, __fp16 *out,
                                     float *cos_, float *sin_);
 /**
- * @brief swish function with neon : X = (Y / (1 + exp( -Y ))) * Z
+ * @brief swiglu function with neon : X = (Y / (1 + exp( -Y ))) * Z
  *
  * @param N number of elements in X
  * @param X __fp16 * for Vector X
  * @param Y __fp16 * for Vector Y
  * @param Z __fp16 * for Vector Z
  */
-void swish(const unsigned int N, __fp16 *X, __fp16 *Y, __fp16 *Z);
+void swiglu(const unsigned int N, __fp16 *X, __fp16 *Y, __fp16 *Z);
 
 /**
  * @brief returns maximum value of the vector X