From ff8f5b9a70fa5385db1e828d5ef402e0f357574e Mon Sep 17 00:00:00 2001 From: Radomir Djogo Date: Sat, 21 Dec 2024 01:15:16 +0000 Subject: [PATCH 1/3] #16165: Add binary sfpu div init --- .../eltwise/test_binary_composite.py | 1 - .../llk_api/llk_sfpu/ckernel_sfpu_binary.h | 8 +++-- .../llk_math_eltwise_binary_sfpu_binop.h | 5 ++-- .../llk_api/llk_sfpu/ckernel_sfpu_binary.h | 8 +++-- .../llk_math_eltwise_binary_sfpu_binop.h | 5 ++-- .../compute_kernel_api/eltwise_binary_sfpu.h | 12 +++++++- tt_metal/third_party/tt_llk_blackhole | 2 +- tt_metal/third_party/tt_llk_wormhole_b0 | 2 +- .../eltwise/binary/common/binary_op_utils.cpp | 30 +++++++++++++++---- .../compute/eltwise_binary_sfpu_kernel.cpp | 9 ++---- 10 files changed, 58 insertions(+), 24 deletions(-) diff --git a/tests/ttnn/unit_tests/operations/eltwise/test_binary_composite.py b/tests/ttnn/unit_tests/operations/eltwise/test_binary_composite.py index 346c8549e98..97cff73907d 100644 --- a/tests/ttnn/unit_tests/operations/eltwise/test_binary_composite.py +++ b/tests/ttnn/unit_tests/operations/eltwise/test_binary_composite.py @@ -990,7 +990,6 @@ def test_nei_ttnn(input_shapes, scalar, device): assert comp_pass -@pytest.mark.skip(reason="#16165: Test is broken if you run after individually.") @pytest.mark.parametrize( "input_shapes", ( diff --git a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h index 6c23abe0a26..56bc3323bfa 100644 --- a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h +++ b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h @@ -14,10 +14,14 @@ namespace ckernel { namespace sfpu { template -inline void calculate_sfpu_binary(const uint dst_offset) -{ +inline void calculate_sfpu_binary(const uint dst_offset) { _calculate_sfpu_binary_(dst_offset); } +template +inline void sfpu_binary_init() { + _sfpu_binary_init_(); +} + } // namespace sfpu } // namespace ckernel diff --git a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h index 09fcb4a530d..e870ffc804b 100644 --- a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h +++ b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h @@ -12,9 +12,10 @@ namespace ckernel { // New LLK SFPU APIs -template +template inline void llk_math_eltwise_binary_sfpu_binop_init() { - llk_math_eltwise_binary_sfpu_init(); + llk_math_eltwise_binary_sfpu_init( + ckernel::sfpu::sfpu_binary_init); } template diff --git a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h index 6c23abe0a26..56bc3323bfa 100644 --- a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h +++ b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h @@ -14,10 +14,14 @@ namespace ckernel { namespace sfpu { template -inline void calculate_sfpu_binary(const uint dst_offset) -{ +inline void calculate_sfpu_binary(const uint dst_offset) { _calculate_sfpu_binary_(dst_offset); } +template +inline void sfpu_binary_init() { + _sfpu_binary_init_(); +} + } // namespace sfpu } // namespace ckernel diff --git a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h index 09fcb4a530d..e870ffc804b 100644 --- a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h +++ b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h @@ -12,9 +12,10 @@ namespace ckernel { // New LLK SFPU APIs -template +template inline void llk_math_eltwise_binary_sfpu_binop_init() { - llk_math_eltwise_binary_sfpu_init(); + llk_math_eltwise_binary_sfpu_init( + ckernel::sfpu::sfpu_binary_init); } template diff --git a/tt_metal/include/compute_kernel_api/eltwise_binary_sfpu.h b/tt_metal/include/compute_kernel_api/eltwise_binary_sfpu.h index 23995891940..274c1ad219c 100644 --- a/tt_metal/include/compute_kernel_api/eltwise_binary_sfpu.h +++ b/tt_metal/include/compute_kernel_api/eltwise_binary_sfpu.h @@ -61,6 +61,16 @@ ALWI void power_binary_tile(uint32_t idst0, uint32_t idst1) { /** * Please refer to documentation for any_init. */ -ALWI void eltwise_binop_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } +ALWI void add_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } + +ALWI void sub_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } + +ALWI void mul_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } + +ALWI void div_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } + +ALWI void rsub_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } + +ALWI void power_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } } // namespace ckernel diff --git a/tt_metal/third_party/tt_llk_blackhole b/tt_metal/third_party/tt_llk_blackhole index c5735f6d4a8..041753e8a96 160000 --- a/tt_metal/third_party/tt_llk_blackhole +++ b/tt_metal/third_party/tt_llk_blackhole @@ -1 +1 @@ -Subproject commit c5735f6d4a8b66b6e46f26c4c655abb694875bd7 +Subproject commit 041753e8a96342c13fcd3a3220a13054e69f0910 diff --git a/tt_metal/third_party/tt_llk_wormhole_b0 b/tt_metal/third_party/tt_llk_wormhole_b0 index 33a7f6a0267..d36e0cd178b 160000 --- a/tt_metal/third_party/tt_llk_wormhole_b0 +++ b/tt_metal/third_party/tt_llk_wormhole_b0 @@ -1 +1 @@ -Subproject commit 33a7f6a026719af509a119d8a4e8e36c7c31854c +Subproject commit d36e0cd178b29624d3db8f6de5c9f7e54170d24c diff --git a/ttnn/cpp/ttnn/operations/eltwise/binary/common/binary_op_utils.cpp b/ttnn/cpp/ttnn/operations/eltwise/binary/common/binary_op_utils.cpp index d5c6d4382e5..846d7fc0f68 100644 --- a/ttnn/cpp/ttnn/operations/eltwise/binary/common/binary_op_utils.cpp +++ b/ttnn/cpp/ttnn/operations/eltwise/binary/common/binary_op_utils.cpp @@ -186,14 +186,30 @@ std::map get_defines_fp32( new_defines.insert({"ADD_INT32_INIT", fmt::format("add_int32_tile_init();")}); op_name = "add_int32_tile"; } else { + new_defines.insert({"BINOP_INIT", fmt::format("add_binary_tile_init();")}); op_name = "add_binary_tile"; } break; - case BinaryOpType::SUB: op_name = "sub_binary_tile"; break; - case BinaryOpType::MUL: op_name = "mul_binary_tile"; break; - case BinaryOpType::RSUB: op_name = "rsub_binary_tile"; break; - case BinaryOpType::POWER: op_name = "power_binary_tile"; break; - case BinaryOpType::DIV_FAST: op_name = "div_binary_tile"; break; + case BinaryOpType::SUB: + new_defines.insert({"BINOP_INIT", fmt::format("sub_binary_tile_init();")}); + op_name = "sub_binary_tile"; + break; + case BinaryOpType::MUL: + new_defines.insert({"BINOP_INIT", fmt::format("mul_binary_tile_init();")}); + op_name = "mul_binary_tile"; + break; + case BinaryOpType::RSUB: + new_defines.insert({"BINOP_INIT", fmt::format("rsub_binary_tile_init();")}); + op_name = "rsub_binary_tile"; + break; + case BinaryOpType::POWER: + new_defines.insert({"BINOP_INIT", fmt::format("power_binary_tile_init();")}); + op_name = "power_binary_tile"; + break; + case BinaryOpType::DIV_FAST: + new_defines.insert({"BINOP_INIT", fmt::format("div_binary_tile_init();")}); + op_name = "div_binary_tile"; + break; case BinaryOpType::BITWISE_AND: new_defines.insert({"BITWISE_INIT", fmt::format("binary_bitwise_tile_init();")}); op_name = "and_binary_tile"; @@ -219,12 +235,14 @@ std::map get_defines_fp32( // PRE_IN1_0 ====> Applies prescaling for second input new_defines.merge(get_defines(UnaryOpType::EXP, std::vector{0}, "PRE_IN0_0")); new_defines.merge(get_defines(UnaryOpType::EXP, std::vector{0}, "PRE_IN1_0")); + new_defines.insert({"BINOP_INIT", fmt::format("add_binary_tile_init();")}); op_name = "add_binary_tile"; new_defines.merge(get_defines(UnaryOpType::LOG, std::nullopt, "0", idst1)); break; case BinaryOpType::LOGADDEXP2: new_defines.merge(get_defines(UnaryOpType::EXP2, std::nullopt, "PRE_IN0_0")); new_defines.merge(get_defines(UnaryOpType::EXP2, std::nullopt, "PRE_IN1_0")); + new_defines.insert({"BINOP_INIT", fmt::format("add_binary_tile_init();")}); op_name = "add_binary_tile"; new_defines.merge(get_defines(UnaryOpType::LOG2, std::nullopt, "0", idst1)); break; @@ -241,12 +259,14 @@ std::map get_defines_fp32( new_defines.merge(get_defines(UnaryOpType::NEZ, std::nullopt, "0", idst1)); break; case BinaryOpType::BIAS_GELU: + new_defines.insert({"BINOP_INIT", fmt::format("add_binary_tile_init();")}); op_name = "add_binary_tile"; new_defines.merge(get_defines(UnaryOpType::GELU, std::vector{0}, "0", idst1)); break; case BinaryOpType::LOGICAL_OR: new_defines.merge(get_defines(UnaryOpType::NEZ, std::nullopt, "PRE_IN0_0")); new_defines.merge(get_defines(UnaryOpType::NEZ, std::nullopt, "PRE_IN1_0")); + new_defines.insert({"BINOP_INIT", fmt::format("add_binary_tile_init();")}); op_name = "add_binary_tile"; new_defines.merge(get_defines(UnaryOpType::GTZ, std::nullopt, "0", idst1)); break; diff --git a/ttnn/cpp/ttnn/operations/eltwise/binary/device/kernels/compute/eltwise_binary_sfpu_kernel.cpp b/ttnn/cpp/ttnn/operations/eltwise/binary/device/kernels/compute/eltwise_binary_sfpu_kernel.cpp index 6970e4aa498..0d4aa04d128 100644 --- a/ttnn/cpp/ttnn/operations/eltwise/binary/device/kernels/compute/eltwise_binary_sfpu_kernel.cpp +++ b/ttnn/cpp/ttnn/operations/eltwise/binary/device/kernels/compute/eltwise_binary_sfpu_kernel.cpp @@ -16,10 +16,6 @@ #define PRE_SCALE defined SFPU_OP_INIT_PRE_IN0_0 || defined SFPU_OP_INIT_PRE_IN1_0 -#if defined(ADD_INT32_INIT) || defined(BITWISE_INIT) || defined(SHIFT_INIT) -#define INT32_INIT -#endif - namespace NAMESPACE { void MAIN { uint32_t per_core_block_cnt = get_arg_val(0); @@ -111,10 +107,9 @@ void MAIN { for (uint32_t i = 0; i < per_core_block_size; ++i) { copy_tile(cb_inp1, i, i * 2 + 1); -#ifndef INT32_INIT - eltwise_binop_tile_init(); +#ifdef BINOP_INIT + BINOP_INIT #endif - #ifdef ADD_INT32_INIT ADD_INT32_INIT #endif From d487e903d8c6c042cd8141513b3b9a0cd8d70f61 Mon Sep 17 00:00:00 2001 From: Radomir Djogo Date: Mon, 30 Dec 2024 22:27:10 +0000 Subject: [PATCH 2/3] #16165: Add enum classes for op type template param --- .../llk_api/llk_sfpu/ckernel_sfpu_binary.h | 8 ++-- .../llk_sfpu/ckernel_sfpu_binary_bitwise.h | 4 +- .../llk_math_eltwise_binary_sfpu_binop.h | 11 ++---- .../llk_math_eltwise_binary_sfpu_bitwise.h | 4 +- .../llk_api/llk_sfpu/ckernel_sfpu_binary.h | 8 ++-- .../llk_sfpu/ckernel_sfpu_binary_bitwise.h | 4 +- .../llk_math_eltwise_binary_sfpu_binop.h | 11 ++---- .../llk_math_eltwise_binary_sfpu_bitwise.h | 4 +- .../compute_kernel_api/binary_bitwise_sfpu.h | 7 ++-- .../compute_kernel_api/eltwise_binary_sfpu.h | 37 ++++++++++++------- tt_metal/third_party/tt_llk_blackhole | 2 +- tt_metal/third_party/tt_llk_wormhole_b0 | 2 +- 12 files changed, 53 insertions(+), 49 deletions(-) diff --git a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h index 56bc3323bfa..cd93354265f 100644 --- a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h +++ b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h @@ -13,14 +13,14 @@ using namespace sfpi; namespace ckernel { namespace sfpu { -template +template inline void calculate_sfpu_binary(const uint dst_offset) { - _calculate_sfpu_binary_(dst_offset); + _calculate_sfpu_binary_(dst_offset); } -template +template inline void sfpu_binary_init() { - _sfpu_binary_init_(); + _sfpu_binary_init_(); } } // namespace sfpu diff --git a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary_bitwise.h b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary_bitwise.h index 9648858daac..b8986c3be49 100644 --- a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary_bitwise.h +++ b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/ckernel_sfpu_binary_bitwise.h @@ -13,9 +13,9 @@ using namespace sfpi; namespace ckernel { namespace sfpu { -template +template inline void calculate_sfpu_binary_bitwise(const uint dst_offset) { - _calculate_sfpu_binary_bitwise_(dst_offset); + _calculate_sfpu_binary_bitwise_(dst_offset); } } // namespace sfpu diff --git a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h index e870ffc804b..c2c68fb6420 100644 --- a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h +++ b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h @@ -12,19 +12,16 @@ namespace ckernel { // New LLK SFPU APIs -template +template inline void llk_math_eltwise_binary_sfpu_binop_init() { llk_math_eltwise_binary_sfpu_init( - ckernel::sfpu::sfpu_binary_init); + ckernel::sfpu::sfpu_binary_init); } -template +template inline void llk_math_eltwise_binary_sfpu_binop(uint dst_index0, uint32_t dst_index1, int vector_mode = VectorMode::RC) { llk_math_eltwise_binary_sfpu_params( - ckernel::sfpu::calculate_sfpu_binary, - dst_index0, - dst_index1, - vector_mode); + ckernel::sfpu::calculate_sfpu_binary, dst_index0, dst_index1, vector_mode); } } // namespace ckernel diff --git a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_bitwise.h b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_bitwise.h index de2b20a8c70..51c523f47df 100644 --- a/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_bitwise.h +++ b/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_bitwise.h @@ -17,11 +17,11 @@ inline void llk_math_eltwise_binary_sfpu_bitwise_init() { llk_math_eltwise_binary_sfpu_init(); } -template +template inline void llk_math_eltwise_binary_sfpu_bitwise( uint dst_index0, uint32_t dst_index1, int vector_mode = VectorMode::RC) { llk_math_eltwise_binary_sfpu_params( - ckernel::sfpu::calculate_sfpu_binary_bitwise, dst_index0, dst_index1, vector_mode); + ckernel::sfpu::calculate_sfpu_binary_bitwise, dst_index0, dst_index1, vector_mode); } } // namespace ckernel diff --git a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h index 56bc3323bfa..cd93354265f 100644 --- a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h +++ b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary.h @@ -13,14 +13,14 @@ using namespace sfpi; namespace ckernel { namespace sfpu { -template +template inline void calculate_sfpu_binary(const uint dst_offset) { - _calculate_sfpu_binary_(dst_offset); + _calculate_sfpu_binary_(dst_offset); } -template +template inline void sfpu_binary_init() { - _sfpu_binary_init_(); + _sfpu_binary_init_(); } } // namespace sfpu diff --git a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary_bitwise.h b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary_bitwise.h index 9648858daac..b8986c3be49 100644 --- a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary_bitwise.h +++ b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/ckernel_sfpu_binary_bitwise.h @@ -13,9 +13,9 @@ using namespace sfpi; namespace ckernel { namespace sfpu { -template +template inline void calculate_sfpu_binary_bitwise(const uint dst_offset) { - _calculate_sfpu_binary_bitwise_(dst_offset); + _calculate_sfpu_binary_bitwise_(dst_offset); } } // namespace sfpu diff --git a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h index e870ffc804b..c2c68fb6420 100644 --- a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h +++ b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_binop.h @@ -12,19 +12,16 @@ namespace ckernel { // New LLK SFPU APIs -template +template inline void llk_math_eltwise_binary_sfpu_binop_init() { llk_math_eltwise_binary_sfpu_init( - ckernel::sfpu::sfpu_binary_init); + ckernel::sfpu::sfpu_binary_init); } -template +template inline void llk_math_eltwise_binary_sfpu_binop(uint dst_index0, uint32_t dst_index1, int vector_mode = VectorMode::RC) { llk_math_eltwise_binary_sfpu_params( - ckernel::sfpu::calculate_sfpu_binary, - dst_index0, - dst_index1, - vector_mode); + ckernel::sfpu::calculate_sfpu_binary, dst_index0, dst_index1, vector_mode); } } // namespace ckernel diff --git a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_bitwise.h b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_bitwise.h index de2b20a8c70..51c523f47df 100644 --- a/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_bitwise.h +++ b/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_binary_sfpu_bitwise.h @@ -17,11 +17,11 @@ inline void llk_math_eltwise_binary_sfpu_bitwise_init() { llk_math_eltwise_binary_sfpu_init(); } -template +template inline void llk_math_eltwise_binary_sfpu_bitwise( uint dst_index0, uint32_t dst_index1, int vector_mode = VectorMode::RC) { llk_math_eltwise_binary_sfpu_params( - ckernel::sfpu::calculate_sfpu_binary_bitwise, dst_index0, dst_index1, vector_mode); + ckernel::sfpu::calculate_sfpu_binary_bitwise, dst_index0, dst_index1, vector_mode); } } // namespace ckernel diff --git a/tt_metal/include/compute_kernel_api/binary_bitwise_sfpu.h b/tt_metal/include/compute_kernel_api/binary_bitwise_sfpu.h index 1ec6d40ceca..c2ccb257940 100644 --- a/tt_metal/include/compute_kernel_api/binary_bitwise_sfpu.h +++ b/tt_metal/include/compute_kernel_api/binary_bitwise_sfpu.h @@ -33,17 +33,16 @@ namespace ckernel { * 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 | */ -enum { AND_BINARY = 0, OR_BINARY = 1, XOR_BINARY = 2 }; ALWI void and_binary_tile(uint32_t idst0, uint32_t idst1) { - MATH((llk_math_eltwise_binary_sfpu_bitwise(idst0, idst1))); + MATH((llk_math_eltwise_binary_sfpu_bitwise(idst0, idst1))); } ALWI void or_binary_tile(uint32_t idst0, uint32_t idst1) { - MATH((llk_math_eltwise_binary_sfpu_bitwise(idst0, idst1))); + MATH((llk_math_eltwise_binary_sfpu_bitwise(idst0, idst1))); } ALWI void xor_binary_tile(uint32_t idst0, uint32_t idst1) { - MATH((llk_math_eltwise_binary_sfpu_bitwise(idst0, idst1))); + MATH((llk_math_eltwise_binary_sfpu_bitwise(idst0, idst1))); } /** diff --git a/tt_metal/include/compute_kernel_api/eltwise_binary_sfpu.h b/tt_metal/include/compute_kernel_api/eltwise_binary_sfpu.h index 274c1ad219c..1e9a68d0842 100644 --- a/tt_metal/include/compute_kernel_api/eltwise_binary_sfpu.h +++ b/tt_metal/include/compute_kernel_api/eltwise_binary_sfpu.h @@ -33,44 +33,55 @@ namespace ckernel { * 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 | */ -enum { ADD_BINARY = 0, SUB_BINARY = 1, MUL_BINARY = 2, DIV_BINARY = 3, RSUB_BINARY = 4, POW_BINARY = 5 }; ALWI void add_binary_tile(uint32_t idst0, uint32_t idst1) { - MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); + MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); } ALWI void sub_binary_tile(uint32_t idst0, uint32_t idst1) { - MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); + MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); } ALWI void mul_binary_tile(uint32_t idst0, uint32_t idst1) { - MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); + MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); } ALWI void div_binary_tile(uint32_t idst0, uint32_t idst1) { - MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); + MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); } ALWI void rsub_binary_tile(uint32_t idst0, uint32_t idst1) { - MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); + MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); } ALWI void power_binary_tile(uint32_t idst0, uint32_t idst1) { - MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); + MATH((llk_math_eltwise_binary_sfpu_binop(idst0, idst1))); } /** * Please refer to documentation for any_init. */ -ALWI void add_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } +ALWI void add_binary_tile_init() { + MATH((llk_math_eltwise_binary_sfpu_binop_init())); +} -ALWI void sub_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } +ALWI void sub_binary_tile_init() { + MATH((llk_math_eltwise_binary_sfpu_binop_init())); +} -ALWI void mul_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } +ALWI void mul_binary_tile_init() { + MATH((llk_math_eltwise_binary_sfpu_binop_init())); +} -ALWI void div_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } +ALWI void div_binary_tile_init() { + MATH((llk_math_eltwise_binary_sfpu_binop_init())); +} -ALWI void rsub_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } +ALWI void rsub_binary_tile_init() { + MATH((llk_math_eltwise_binary_sfpu_binop_init())); +} -ALWI void power_binary_tile_init() { MATH((llk_math_eltwise_binary_sfpu_binop_init())); } +ALWI void power_binary_tile_init() { + MATH((llk_math_eltwise_binary_sfpu_binop_init())); +} } // namespace ckernel diff --git a/tt_metal/third_party/tt_llk_blackhole b/tt_metal/third_party/tt_llk_blackhole index 041753e8a96..d938b6f37bb 160000 --- a/tt_metal/third_party/tt_llk_blackhole +++ b/tt_metal/third_party/tt_llk_blackhole @@ -1 +1 @@ -Subproject commit 041753e8a96342c13fcd3a3220a13054e69f0910 +Subproject commit d938b6f37bbda3003dcc72b6ab3ec7147fa9fa25 diff --git a/tt_metal/third_party/tt_llk_wormhole_b0 b/tt_metal/third_party/tt_llk_wormhole_b0 index d36e0cd178b..33c5c880d25 160000 --- a/tt_metal/third_party/tt_llk_wormhole_b0 +++ b/tt_metal/third_party/tt_llk_wormhole_b0 @@ -1 +1 @@ -Subproject commit d36e0cd178b29624d3db8f6de5c9f7e54170d24c +Subproject commit 33c5c880d25388d9a7995a1e40cbe7eb9496e96e From f98f708894d3678d6007ca8c3b26a89f2b987896 Mon Sep 17 00:00:00 2001 From: Radomir Djogo Date: Thu, 2 Jan 2025 16:44:59 +0000 Subject: [PATCH 3/3] #16165: Update llk submodules --- tt_metal/third_party/tt_llk_blackhole | 2 +- tt_metal/third_party/tt_llk_wormhole_b0 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tt_metal/third_party/tt_llk_blackhole b/tt_metal/third_party/tt_llk_blackhole index d938b6f37bb..3d746ec2619 160000 --- a/tt_metal/third_party/tt_llk_blackhole +++ b/tt_metal/third_party/tt_llk_blackhole @@ -1 +1 @@ -Subproject commit d938b6f37bbda3003dcc72b6ab3ec7147fa9fa25 +Subproject commit 3d746ec261901fb5bf3b4e2f16d62fe1c03dccc9 diff --git a/tt_metal/third_party/tt_llk_wormhole_b0 b/tt_metal/third_party/tt_llk_wormhole_b0 index 33c5c880d25..a2645b5d639 160000 --- a/tt_metal/third_party/tt_llk_wormhole_b0 +++ b/tt_metal/third_party/tt_llk_wormhole_b0 @@ -1 +1 @@ -Subproject commit 33c5c880d25388d9a7995a1e40cbe7eb9496e96e +Subproject commit a2645b5d639c03f54c2e84f4972462dd23606dca