Skip to content

Commit

Permalink
#5424: Cleanup lrelu
Browse files Browse the repository at this point in the history
  • Loading branch information
pgardnerTT committed Oct 17, 2024
1 parent 7bc85e3 commit fbf1fa2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,9 @@ inline void relu_max(uint uint_threshold)
}

template <bool APPROXIMATION_MODE>
inline void calculate_lrelu(uint slope)
inline void calculate_lrelu(const uint slope, const int iterations)
{
// SFPU microcode
Converter c_slope;
c_slope.u = slope;
vFloat s = c_slope.f;

#pragma GCC unroll 0
for (int d = 0; d < 8; d++) {
vFloat v = dst_reg[0];

v_if (v < 0.0f) {
v *= s;
}
v_endif;

dst_reg[0] = v;

dst_reg++;
}
_calculate_lrelu_<APPROXIMATION_MODE>(iterations, slope);
}

} // namespace sfpu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ inline void llk_math_eltwise_unary_sfpu_relu_min_init() {
}


template <bool APPROXIMATE>
inline void llk_math_eltwise_unary_sfpu_lrelu(uint dst_index, uint param0 = 0) {
template <bool APPROXIMATE, int ITERATIONS=8>
inline void llk_math_eltwise_unary_sfpu_lrelu(uint dst_index, uint param0 = 0, uint param1 = ITERATIONS) {
llk_math_eltwise_unary_sfpu_params<APPROXIMATE>(
ckernel::sfpu::calculate_lrelu<APPROXIMATE>,
dst_index,
(int)VectorMode::RC,
param0);
param0,
param1);
}

template <bool APPROXIMATE>
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/third_party/tt_llk_wormhole_b0

0 comments on commit fbf1fa2

Please sign in to comment.