Skip to content

Commit

Permalink
[Trivial] Unnecessary comments Removed
Browse files Browse the repository at this point in the history
Comments removed from the code.

Signed-off-by: Yash Singh <[email protected]>
  • Loading branch information
yashSingh0723 committed Aug 29, 2024
1 parent 2e1d2d9 commit 4a71cc7
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 18 deletions.
1 change: 0 additions & 1 deletion nntrainer/tensor/cl_operations/attention_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions nntrainer/tensor/cl_operations/attention_kernels_fp16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
9 changes: 0 additions & 9 deletions nntrainer/tensor/cl_operations/testing_rotarty_emb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,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);
Expand All @@ -99,7 +95,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);
Expand Down Expand Up @@ -133,10 +128,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);
}
}
Expand Down
6 changes: 0 additions & 6 deletions test/unittest/unittest_attention_kernels_cl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 4a71cc7

Please sign in to comment.