From a6fc2e5fc669b36389013147a21e4aa8dd11a692 Mon Sep 17 00:00:00 2001 From: VirdhatchaniKN Date: Thu, 4 Apr 2024 12:44:07 +0000 Subject: [PATCH] #6737: Fix erfc --- .../grayskull/metal/llk_api/llk_sfpu/ckernel_sfpu_erf_erfc.h | 2 +- .../wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_erf_erfc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tt_metal/hw/ckernels/grayskull/metal/llk_api/llk_sfpu/ckernel_sfpu_erf_erfc.h b/tt_metal/hw/ckernels/grayskull/metal/llk_api/llk_sfpu/ckernel_sfpu_erf_erfc.h index 11f5b87e3645..d2dec31e6ce2 100644 --- a/tt_metal/hw/ckernels/grayskull/metal/llk_api/llk_sfpu/ckernel_sfpu_erf_erfc.h +++ b/tt_metal/hw/ckernels/grayskull/metal/llk_api/llk_sfpu/ckernel_sfpu_erf_erfc.h @@ -55,7 +55,7 @@ inline void calculate_erfc() { // SFPU microcode: for (int d = 0; d < ITERATIONS; d++) { vFloat x = dst_reg[0]; - v_if(x < 0.0f) { x = 1.0 + (calculate_erf_body(x)); } + v_if(x < 0.0f) { x = -x; x = 1.0 + (calculate_erf_body(x)); } v_else { x = 1.0 - (calculate_erf_body(x)); } v_endif; dst_reg[0] = x; diff --git a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_erf_erfc.h b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_erf_erfc.h index c2e38508b4a0..b404c0773d7a 100644 --- a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_erf_erfc.h +++ b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_erf_erfc.h @@ -53,7 +53,7 @@ inline void calculate_erfc() { // SFPU microcode: for (int d = 0; d < 8; d++) { vFloat x = dst_reg[0]; - v_if(x < 0.0f) { x = 1.0 + (calculate_erf_body(x)); } + v_if(x < 0.0f) { x = -x; x = 1.0 + (calculate_erf_body(x)); } v_else { x = 1.0 - (calculate_erf_body(x)); } v_endif; dst_reg[0] = x;