[Trivial] Unnecessary comments Removed
authorYash Singh <yash.singh@samsung.com>
Thu, 29 Aug 2024 06:34:51 +0000 (12:04 +0530)
committerJijoong Moon <jijoong.moon@samsung.com>
Sun, 20 Oct 2024 23:33:51 +0000 (08:33 +0900)
Comments removed from the code.

Signed-off-by: Yash Singh <yash.singh@samsung.com>
nntrainer/tensor/cl_operations/attention_kernels.cpp
nntrainer/tensor/cl_operations/attention_kernels_fp16.cpp
nntrainer/tensor/cl_operations/testing_rotarty_emb.cpp
test/unittest/unittest_attention_kernels_cl.cpp

index 387ceb50a780fd00bc34acb5024bd7dc1ecdcf48..9b5cb7e69998d048583c875187f8cf368482d6fa 100644 (file)
@@ -59,7 +59,6 @@ __kernel void rotary_emb_cl(__global float *input,
                 transformed_value = input[b * channel * height * width + c * height * width + h * width + span - half_];
               }
               value = value * cos_ptr[k] + transformed_value * sin_ptr[k];
-              // printf("GPU Batch: %u, Height: %u, Channel: %u, Width: %u, K: %u, Span: %u, Value: %f, Transformed Value: %f, cos_ptr[k]: %f, sin_ptr[k]: %f\n",  b, h, c, w, k, span, value, transformed_value, cos_ptr[k], sin_ptr[k]);
               output[b * channel * height * width + c * height * width + h * width + span] = value;
             }
           }
index 16640821b7b3df2073c124562d5a651dde870ea1..c6b1fbb263e58672c9e7773dafa6b6094ea95537 100644 (file)
@@ -144,14 +144,14 @@ void rotary_emb_cl(__fp16 *in, __fp16 *out,
     result = freqs_cosBuf.WriteData(context.command_queue_inst_,
                                     freqs_cos_flat.data());
     if (!result) {
-      printf("Failed to write cos data\n");
+      printf("Failed to write freqs cos data\n");
       break;
     }
 
     result = freqs_sinBuf.WriteData(context.command_queue_inst_,
                                     freqs_sin_flat.data());
     if (!result) {
-      printf("Failed to write sin data\n");
+      printf("Failed to write freqs sin data\n");
       break;
     }
 
index 3bf8f8ab612cf90d7cf67c812336151aeb7b6bd5..4ebde87332c16f5cccfc26b8ff8800aaf5032f40 100644 (file)
@@ -42,10 +42,6 @@ void precompute_freqs(int dim, unsigned int seq_len,
     sin.assign(seq_len, std::vector<float>(dim, 0));
 
     for (unsigned int i = 0; i < seq_len; ++i) {
-#ifdef USE_NEON
-      nntrainer::calc_trigonometric_vals_dup(half_, freqs.data(), cos[i].data(),
-                                             sin[i].data(), i);
-#else
       for (unsigned int j = 0; j < half_; ++j) {
         float angle = i * freqs[j];
         cos[i][j] = std::cos(angle);
@@ -54,7 +50,6 @@ void precompute_freqs(int dim, unsigned int seq_len,
         sin[i][j] = std::sin(angle);
         sin[i][j + half_] = std::sin(angle); // repeated 2 times
       }
-#endif
     }
     freqs_cos = cos;
     freqs_sin = sin;
@@ -87,10 +82,6 @@ void apply_rotary_emb_tensor(nntrainer::Tensor &in, unsigned int dim,
   if (from >= max_timestep) {
     cos_ = std::vector<float>(dim);
     sin_ = std::vector<float>(dim);
-#ifdef USE_NEON
-    nntrainer::calc_trigonometric_vals_dup(half_, freqs.data(), cos_.data(),
-                                           sin_.data(), from);
-#else
     for (unsigned int i = 0; i < half_; ++i) {
       float angle = from * freqs[i];
       cos_[i] = std::cos(angle);
@@ -99,7 +90,6 @@ void apply_rotary_emb_tensor(nntrainer::Tensor &in, unsigned int dim,
       sin_[i] = std::sin(angle);
       sin_[i + half_] = std::sin(angle); // repeated 2 times
     }
-#endif
   } else {
     cos_.resize(max_timestep);
     sin_.resize(max_timestep);
@@ -133,10 +123,6 @@ void apply_rotary_emb_tensor(nntrainer::Tensor &in, unsigned int dim,
                   transformed_value = in.getValue<float>(b, c, h, span - half_);
                 }
                 value = value * cos_[k] + transformed_value * sin_[k];
-                // printf("CPU Batch: %u, Channel: %u, Height: %u, Width: %u, K:
-                // %u, Span: %u, Value: %f, Transformed Value: %f, cos_ptr[k]:
-                // %f, sin_ptr[k]: %f\n ",  b, c, h, w, k, span, value,
-                // transformed_value, cos_[k], sin_[k]);
                 out.setValue(b, c, h, span, value);
               }
             }
index 7a09e5cd5405633a477e7263dd1f86e981d275e2..d2a26cc9d3e489eefb5aabc972b32e2f08e3a2ad 100644 (file)
@@ -65,12 +65,6 @@ TEST(attention_kernels, rotary_emb_kernel_FP32) {
 
   B_fp32.copy(A_fp32);
 
-  // std::cout << "\nA_fp32 and B_fp32 before rotary embedding:" << std::endl;
-  // for (unsigned int i = 0; i < A_fp32.size(); ++i) {
-  //   std::cout << "Element " << i << " -> " << *(A_fp32.getData<float>() + i)
-  //   <<"\t"<<*(B_fp32.getData<float>() + i)<< std::endl;
-  // }
-
   apply_rotary_emb_cl(A_fp32, dim, from, max_timestep, rc);
   apply_rotary_emb_tensor(B_fp32, dim, from, max_timestep);