Skip to content

Commit

Permalink
#13439: sin/cos llk bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rdjogoTT committed Oct 15, 2024
1 parent aee03c7 commit baf384d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ sfpi_inline vFloat sfpu_sine_maclaurin_series(vFloat val) {
tmp = tmp * val * val;
output += 0.0000027557 * tmp;

// x^11/11!
tmp = tmp * val * val;
output += -0.00000002505 * tmp;

if constexpr (not APPROXIMATION_MODE) {
// x^11/11!
tmp = tmp * val * val;
Expand Down Expand Up @@ -155,7 +151,7 @@ inline void calculate_sine() {
for (int d = 0; d < ITERATIONS; d++) {
vFloat v = dst_reg[0];
v = 0.318309886183791f * v; // *1/pi to get number of pi rads.
vInt whole_v = float_to_int16(v);
vInt whole_v = float_to_int16(v, 0);
vFloat whole_v_float = int32_to_float(whole_v, 0);
v = v - whole_v_float;
v *= 3.141592653589793f; // fractional * pi to get it in [-pi:pi]
Expand All @@ -177,7 +173,7 @@ inline void calculate_cosine() {
for (int d = 0; d < ITERATIONS; d++) {
vFloat v = dst_reg[0];
v = 0.318309886183791f * v; // *1/pi to get number of pi rads.
vInt whole_v = float_to_int16(v);
vInt whole_v = float_to_int16(v, 0);
vFloat whole_v_float = int32_to_float(whole_v, 0);
v = v - whole_v_float;
v *= 3.141592653589793f; // fractional * pi to get it in [-pi:pi]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ sfpi_inline vFloat sfpu_sine_maclaurin_series(vFloat val)
tmp = tmp*val*val;
output += 0.0000027557*tmp;

// x^11/11!
tmp = tmp*val*val;
output += -0.00000002505*tmp;

if constexpr (not APPROXIMATION_MODE) {
// x^11/11!
tmp = tmp*val*val;
Expand Down Expand Up @@ -166,7 +162,7 @@ inline void calculate_sine()
{
vFloat v = dst_reg[0];
v = 0.318309886183791f*v; // *1/pi to get number of pi rads.
vInt whole_v = float_to_int16(v);
vInt whole_v = float_to_int16(v, 0);
vFloat whole_v_float = int32_to_float(whole_v, 0);
v = v - whole_v_float;
v *= 3.141592653589793f; // fractional * pi to get it in [-pi:pi]
Expand All @@ -190,7 +186,7 @@ inline void calculate_cosine()
{
vFloat v = dst_reg[0];
v = 0.318309886183791f*v; // *1/pi to get number of pi rads.
vInt whole_v = float_to_int16(v);
vInt whole_v = float_to_int16(v, 0);
vFloat whole_v_float = int32_to_float(whole_v, 0);
v = v - whole_v_float;
v *= 3.141592653589793f; // fractional * pi to get it in [-pi:pi]
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/third_party/tt_llk_blackhole
2 changes: 1 addition & 1 deletion tt_metal/third_party/tt_llk_wormhole_b0

0 comments on commit baf384d

Please sign in to comment.