diff --git a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_add_hang.py b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_add_hang.py deleted file mode 100644 index ce2639ac782..00000000000 --- a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_add_hang.py +++ /dev/null @@ -1,72 +0,0 @@ -# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. - -# SPDX-License-Identifier: Apache-2.0 - -from loguru import logger -import random -import pytest -import torch -import ttnn - -from tests.ttnn.utils_for_testing import assert_with_pcc -from tests.ttnn.python_api_testing.sweep_tests import ttnn_ops - - -def run_eltwise_add_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): - torch.manual_seed(data_seed) - - x = torch.Tensor(size=input_shape[0]).uniform_(-100, 100).to(torch.bfloat16) - y = torch.Tensor(size=input_shape[1]).uniform_(-100, 100).to(torch.bfloat16) - - try: - # get ref result - ref_value = torch.add(x, y) - - x = ttnn_ops.setup_ttnn_tensor(x, device, dlayout[0], in_mem_config, dtype[0]) - y = ttnn_ops.setup_ttnn_tensor(y, device, dlayout[1], in_mem_config, dtype[1]) - - tt_result = ttnn.add(x, y) - tt_result = ttnn_ops.ttnn_tensor_to_torch(tt_result, output_mem_config) - logger.info(f"Op run {input_shape[0]} * {input_shape[1]} finished") - - except Exception as e: - logger.warning(f"Operation execution crashed") - raise e - - assert len(tt_result.shape) == len(ref_value.shape) - assert tt_result.shape == ref_value.shape - assert_with_pcc(ref_value, tt_result, 0.99) - - -test_sweep_args = [ - ( - [(150, 72), (150, 72)], - [ttnn.bfloat16, ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT, ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 17799073, - ), - ( - [(3, 201, 228), (3, 201, 228)], - [ttnn.bfloat16, ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT, ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 3121221, - ), - ( - [(6, 6, 230, 138), (6, 6, 230, 138)], - [ttnn.bfloat16, ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT, ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 10286194, - ), -] - - -def test_eltwise_add(device): - for i in range(30000): - for input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed in test_sweep_args: - run_eltwise_add_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device) diff --git a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_exp_hang.py b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_exp_hang.py deleted file mode 100644 index a308391a0fc..00000000000 --- a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_exp_hang.py +++ /dev/null @@ -1,70 +0,0 @@ -# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. - -# SPDX-License-Identifier: Apache-2.0 - -from loguru import logger -import random -import pytest -import torch -import ttnn - -from tests.ttnn.utils_for_testing import assert_with_pcc -from tests.ttnn.python_api_testing.sweep_tests import ttnn_ops - - -def run_eltwise_exp_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): - torch.manual_seed(data_seed) - - x = torch.Tensor(size=input_shape[0]).uniform_(-100, 100).to(torch.bfloat16) - - try: - # get ref result - ref_value = torch.exp(x) - - x = ttnn_ops.setup_ttnn_tensor(x, device, dlayout[0], in_mem_config, dtype[0]) - - tt_result = ttnn.exp(x) - tt_result = ttnn_ops.ttnn_tensor_to_torch(tt_result, output_mem_config) - logger.info(f"Op run for input dimension {input_shape[0]} finished") - - except Exception as e: - logger.warning(f"Operation execution crashed") - raise e - - assert len(tt_result.shape) == len(ref_value.shape) - assert tt_result.shape == ref_value.shape - assert_with_pcc(ref_value, tt_result, 0.99) - - -test_sweep_args = [ - ( - [(150, 72)], - [ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 17799073, - ), - ( - [(3, 201, 228)], - [ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 3121221, - ), - ( - [(6, 6, 230, 138)], - [ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 10286194, - ), -] - - -def test_eltwise_exp(device): - for i in range(30000): - for input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed in test_sweep_args: - run_eltwise_exp_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device) diff --git a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_gelu_hang.py b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_gelu_hang.py deleted file mode 100644 index b7a0a09b3e1..00000000000 --- a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_gelu_hang.py +++ /dev/null @@ -1,70 +0,0 @@ -# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. - -# SPDX-License-Identifier: Apache-2.0 - -from loguru import logger -import random -import pytest -import torch -import ttnn - -from tests.ttnn.utils_for_testing import assert_with_pcc -from tests.ttnn.python_api_testing.sweep_tests import ttnn_ops - - -def run_eltwise_gelu_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): - torch.manual_seed(data_seed) - - x = torch.Tensor(size=input_shape[0]).uniform_(-100, 100).to(torch.bfloat16) - - try: - # get ref result - ref_value = torch.nn.functional.gelu(x) - - x = ttnn_ops.setup_ttnn_tensor(x, device, dlayout[0], in_mem_config, dtype[0]) - - tt_result = ttnn.gelu(x) - tt_result = ttnn_ops.ttnn_tensor_to_torch(tt_result, output_mem_config) - logger.info(f"Op run for input dimension {input_shape[0]} finished") - - except Exception as e: - logger.warning(f"Operation execution crashed") - raise e - - assert len(tt_result.shape) == len(ref_value.shape) - assert tt_result.shape == ref_value.shape - assert_with_pcc(ref_value, tt_result, 0.99) - - -test_sweep_args = [ - ( - [(150, 72)], - [ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 17799073, - ), - ( - [(3, 201, 228)], - [ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 3121221, - ), - ( - [(6, 6, 230, 138)], - [ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 10286194, - ), -] - - -def test_eltwise_gelu(device): - for i in range(30000): - for input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed in test_sweep_args: - run_eltwise_gelu_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device) diff --git a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_i0_bw.py b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_i0_bw.py new file mode 100644 index 00000000000..c8467e8a547 --- /dev/null +++ b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_i0_bw.py @@ -0,0 +1,110 @@ +# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. + +# SPDX-License-Identifier: Apache-2.0 + +from loguru import logger +import random +import pytest +import torch +import ttnn + +from tests.sweep_framework.sweeps.eltwise.unary_backward.i0_bw.i0_bw import run as run_test + + +test_sweep_args = [ + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 16305027, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.L1_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 16305027, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.L1_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), +] + + +@pytest.mark.parametrize( + "input_shape, dtype, dlayout, in_mem_config, out_mem_config, data_seed", + (test_sweep_args), +) +def test_eltwise_i0_bw(input_shape, dtype, dlayout, in_mem_config, out_mem_config, data_seed, device): + random.seed(0) + + [pcc, e2e_perf] = run_test( + input_shape, dtype[0], dtype[1], dlayout[0], in_mem_config[0], in_mem_config[1], out_mem_config, device=device + ) + [passed, pcc_value] = pcc + + assert passed, f"pcc={pcc[1]}" diff --git a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_lerp.py b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_lerp.py new file mode 100644 index 00000000000..17992225fc6 --- /dev/null +++ b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_lerp.py @@ -0,0 +1,112 @@ +# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. + +# SPDX-License-Identifier: Apache-2.0 + +from loguru import logger +import random +import pytest +import torch +import ttnn + +from tests.sweep_framework.sweeps.eltwise.ternary.lerp.lerp import run as run_test + + +test_sweep_args = [ + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 16305027, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.L1_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 16305027, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.L1_MEMORY_CONFIG), + 3624344, + ), +] + + +@pytest.mark.parametrize( + "input_shape, dtype, dlayout, in_mem_config, out_mem_config, data_seed", + (test_sweep_args), +) +def test_eltwise_lerp(input_shape, dtype, dlayout, in_mem_config, out_mem_config, data_seed, device): + random.seed(0) + [pcc, e2e_perf] = run_test( + input_shape, + dtype[0], + dlayout[0], + in_mem_config[0], + dtype[1], + dlayout[0], + in_mem_config[1], + dtype[2], + dlayout[0], + in_mem_config[2], + out_mem_config, + device=device, + ) + [passed, pcc_value] = pcc + + assert passed, f"pcc={pcc[1]}" diff --git a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_mul_hang.py b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_mul_hang.py deleted file mode 100644 index 1436803c3d8..00000000000 --- a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_mul_hang.py +++ /dev/null @@ -1,72 +0,0 @@ -# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. - -# SPDX-License-Identifier: Apache-2.0 - -from loguru import logger -import random -import pytest -import torch -import ttnn - -from tests.ttnn.utils_for_testing import assert_with_pcc -from tests.ttnn.python_api_testing.sweep_tests import ttnn_ops - - -def run_eltwise_mul_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): - torch.manual_seed(data_seed) - - x = torch.Tensor(size=input_shape[0]).uniform_(-100, 100).to(torch.bfloat16) - y = torch.Tensor(size=input_shape[1]).uniform_(-100, 100).to(torch.bfloat16) - - try: - # get ref result - ref_value = torch.mul(x, y) - - x = ttnn_ops.setup_ttnn_tensor(x, device, dlayout[0], in_mem_config, dtype[0]) - y = ttnn_ops.setup_ttnn_tensor(y, device, dlayout[1], in_mem_config, dtype[1]) - - tt_result = ttnn.mul(x, y) - tt_result = ttnn_ops.ttnn_tensor_to_torch(tt_result, output_mem_config) - logger.info(f"Mul run {input_shape[0]} * {input_shape[1]} finished") - - except Exception as e: - logger.warning(f"Operation execution crashed") - raise e - - assert len(tt_result.shape) == len(ref_value.shape) - assert tt_result.shape == ref_value.shape - assert_with_pcc(ref_value, tt_result, 0.99) - - -test_sweep_args = [ - ( - [(150, 72), (150, 72)], - [ttnn.bfloat16, ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT, ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 17799073, - ), - ( - [(3, 201, 228), (3, 201, 228)], - [ttnn.bfloat16, ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT, ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 3121221, - ), - ( - [(6, 6, 230, 138), (6, 6, 230, 138)], - [ttnn.bfloat16, ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT, ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 10286194, - ), -] - - -def test_eltwise_mul(device): - for i in range(30000): - for input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed in test_sweep_args: - run_eltwise_mul_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device) diff --git a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_sub_hang.py b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_sub_hang.py deleted file mode 100644 index 8db5af5b8ed..00000000000 --- a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_sub_hang.py +++ /dev/null @@ -1,72 +0,0 @@ -# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. - -# SPDX-License-Identifier: Apache-2.0 - -from loguru import logger -import random -import pytest -import torch -import ttnn - -from tests.ttnn.utils_for_testing import assert_with_pcc -from tests.ttnn.python_api_testing.sweep_tests import ttnn_ops - - -def run_eltwise_sub_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): - torch.manual_seed(data_seed) - - x = torch.Tensor(size=input_shape[0]).uniform_(-100, 100).to(torch.bfloat16) - y = torch.Tensor(size=input_shape[1]).uniform_(-100, 100).to(torch.bfloat16) - - try: - # get ref result - ref_value = torch.sub(x, y) - - x = ttnn_ops.setup_ttnn_tensor(x, device, dlayout[0], in_mem_config, dtype[0]) - y = ttnn_ops.setup_ttnn_tensor(y, device, dlayout[1], in_mem_config, dtype[1]) - - tt_result = ttnn.sub(x, y) - tt_result = ttnn_ops.ttnn_tensor_to_torch(tt_result, output_mem_config) - logger.info(f"Op run {input_shape[0]} * {input_shape[1]} finished") - - except Exception as e: - logger.warning(f"Operation execution crashed") - raise e - - assert len(tt_result.shape) == len(ref_value.shape) - assert tt_result.shape == ref_value.shape - assert_with_pcc(ref_value, tt_result, 0.99) - - -test_sweep_args = [ - ( - [(150, 72), (150, 72)], - [ttnn.bfloat16, ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT, ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 17799073, - ), - ( - [(3, 201, 228), (3, 201, 228)], - [ttnn.bfloat16, ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT, ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 3121221, - ), - ( - [(6, 6, 230, 138), (6, 6, 230, 138)], - [ttnn.bfloat16, ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT, ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 10286194, - ), -] - - -def test_eltwise_sub(device): - for i in range(30000): - for input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed in test_sweep_args: - run_eltwise_sub_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device) diff --git a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_tan_bw.py b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_tan_bw.py new file mode 100644 index 00000000000..b6d0a6d55c5 --- /dev/null +++ b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_tan_bw.py @@ -0,0 +1,190 @@ +# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. + +# SPDX-License-Identifier: Apache-2.0 + +from loguru import logger +import random +import pytest +import torch +import ttnn + +from tests.sweep_framework.sweeps.eltwise.unary_backward.tan_bw.tan_bw import run as run_test + + +test_sweep_args = [ + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 16305027, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.L1_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 16305027, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.L1_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat8_b], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 16305027, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.L1_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 7, 21, 133), + [ttnn.bfloat16, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 16305027, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.DRAM_MEMORY_CONFIG, ttnn.DRAM_MEMORY_CONFIG], + (ttnn.L1_MEMORY_CONFIG), + 3624344, + ), + ( + (4, 6, 105, 245), + [ttnn.bfloat16, ttnn.bfloat16], + [ttnn.TILE_LAYOUT], + [ttnn.L1_MEMORY_CONFIG, ttnn.L1_MEMORY_CONFIG], + (ttnn.DRAM_MEMORY_CONFIG), + 3624344, + ), +] + + +@pytest.mark.parametrize( + "input_shape, dtype, dlayout, in_mem_config, out_mem_config, data_seed", + (test_sweep_args), +) +def test_eltwise_tan_bw(input_shape, dtype, dlayout, in_mem_config, out_mem_config, data_seed, device): + random.seed(0) + + [pcc, e2e_perf] = run_test( + input_shape, dtype[0], dtype[1], dlayout[0], in_mem_config[0], in_mem_config[1], out_mem_config, device=device + ) + [passed, pcc_value] = pcc + + assert passed, f"pcc={pcc[1]}" diff --git a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_tanh_hang.py b/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_tanh_hang.py deleted file mode 100644 index 975ead124d6..00000000000 --- a/tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_eltwise_tanh_hang.py +++ /dev/null @@ -1,70 +0,0 @@ -# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. - -# SPDX-License-Identifier: Apache-2.0 - -from loguru import logger -import random -import pytest -import torch -import ttnn - -from tests.ttnn.utils_for_testing import assert_with_pcc -from tests.ttnn.python_api_testing.sweep_tests import ttnn_ops - - -def run_eltwise_tanh_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): - torch.manual_seed(data_seed) - - x = torch.Tensor(size=input_shape[0]).uniform_(-100, 100).to(torch.bfloat16) - - try: - # get ref result - ref_value = torch.tanh(x) - - x = ttnn_ops.setup_ttnn_tensor(x, device, dlayout[0], in_mem_config, dtype[0]) - - tt_result = ttnn.tanh(x) - tt_result = ttnn_ops.ttnn_tensor_to_torch(tt_result, output_mem_config) - logger.info(f"tanh run for input dimension {input_shape[0]} finished") - - except Exception as e: - logger.warning(f"Operation execution crashed") - raise e - - assert len(tt_result.shape) == len(ref_value.shape) - assert tt_result.shape == ref_value.shape - assert_with_pcc(ref_value, tt_result, 0.99) - - -test_sweep_args = [ - ( - [(150, 72)], - [ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 17799073, - ), - ( - [(3, 201, 228)], - [ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 3121221, - ), - ( - [(6, 6, 230, 138)], - [ttnn.bfloat16], - [ttnn.ROW_MAJOR_LAYOUT], - (ttnn.DRAM_MEMORY_CONFIG), - (ttnn.DRAM_MEMORY_CONFIG), - 10286194, - ), -] - - -def test_eltwise_tanh(device): - for i in range(30000): - for input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed in test_sweep_args: - run_eltwise_tanh_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device)