Skip to content

Commit

Permalink
#15122: Fix add int32 LLK
Browse files Browse the repository at this point in the history
  • Loading branch information
rdjogoTT committed Dec 10, 2024
1 parent b32ae29 commit ae9b42d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ using namespace sfpi;
namespace ckernel {
namespace sfpu {

template <bool APPROXIMATION_MODE, int ITERATIONS = 8>
template <bool APPROXIMATION_MODE, bool SIGN_MAGNITUDE_FORMAT, int ITERATIONS = 8>
inline void calculate_add_int32(const uint dst_offset) {
_add_int32_<APPROXIMATION_MODE, ITERATIONS>(dst_offset);
_add_int32_<APPROXIMATION_MODE, SIGN_MAGNITUDE_FORMAT, ITERATIONS>(dst_offset);
}

} // namespace sfpu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ inline void llk_math_eltwise_binary_sfpu_add_int32_init() {
llk_math_eltwise_binary_sfpu_init<SfpuType::unused, APPROXIMATE>();
}

template <bool APPROXIMATE>
template <bool APPROXIMATE, bool SIGN_MAGNITUDE_FORMAT>
inline void llk_math_eltwise_binary_sfpu_add_int32(
uint dst_index0, uint32_t dst_index1, int vector_mode = VectorMode::RC) {
llk_math_eltwise_binary_sfpu_params<APPROXIMATE>(
ckernel::sfpu::calculate_add_int32<APPROXIMATE>, dst_index0, dst_index1, vector_mode);
ckernel::sfpu::calculate_add_int32<APPROXIMATE, SIGN_MAGNITUDE_FORMAT>, dst_index0, dst_index1, vector_mode);
}

} // namespace ckernel
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ using namespace sfpi;
namespace ckernel {
namespace sfpu {

template <bool APPROXIMATION_MODE, int ITERATIONS = 8>
template <bool APPROXIMATION_MODE, bool SIGN_MAGNITUDE_FORMAT, int ITERATIONS = 8>
inline void calculate_add_int32(const uint dst_offset) {
_add_int32_<APPROXIMATION_MODE, ITERATIONS>(dst_offset);
_add_int32_<APPROXIMATION_MODE, SIGN_MAGNITUDE_FORMAT, ITERATIONS>(dst_offset);
}

} // namespace sfpu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ inline void llk_math_eltwise_binary_sfpu_add_int32_init() {
llk_math_eltwise_binary_sfpu_init<SfpuType::unused, APPROXIMATE>();
}

template <bool APPROXIMATE>
template <bool APPROXIMATE, bool SIGN_MAGNITUDE_FORMAT>
inline void llk_math_eltwise_binary_sfpu_add_int32(
uint dst_index0, uint32_t dst_index1, int vector_mode = VectorMode::RC) {
llk_math_eltwise_binary_sfpu_params<APPROXIMATE>(
ckernel::sfpu::calculate_add_int32<APPROXIMATE>, dst_index0, dst_index1, vector_mode);
ckernel::sfpu::calculate_add_int32<APPROXIMATE, SIGN_MAGNITUDE_FORMAT>, dst_index0, dst_index1, vector_mode);
}

} // namespace ckernel
17 changes: 10 additions & 7 deletions tt_metal/include/compute_kernel_api/add_int32_sfpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ namespace ckernel {
*
* Return value: None
*
* | Argument | Description | Type | Valid Range |
* Required |
* |----------------|-----------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | idst0 | The index of the tile in DST register buffer to use as first operand | uint32_t | Must be less
* than the size of the DST register buffer | True | | idst1 | The index of the tile in DST register buffer
* to use as second operand | uint32_t | Must be less than the size of the DST register buffer | True |
* | Argument | Description | Type |
* Valid Range | Required |
* |-----------------------|-----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | idst0 | The index of the tile in DST register buffer to use as first operand | uint32_t |
* Must be less than the size of the DST register buffer | True | | idst1 | The index of the tile in
* DST register buffer to use as second operand | uint32_t | Must be less than the size of the DST register buffer
* | True | | sign_magnitude_format | Whether the Int32 values are in sign-magnitude format (not 2's complement) |
* bool | | False |
*/
template <bool sign_magnitude_format = false>
ALWI void add_int32_tile(uint32_t idst0, uint32_t idst1) {
MATH((llk_math_eltwise_binary_sfpu_add_int32<APPROX>(idst0, idst1)));
MATH((llk_math_eltwise_binary_sfpu_add_int32<APPROX, sign_magnitude_format>(idst0, idst1)));
}

/**
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 ae9b42d

Please sign in to comment.