-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
“Nenad
committed
Mar 5, 2024
1 parent
5d283ea
commit b3f80f4
Showing
20 changed files
with
673 additions
and
11 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
tests/ttnn/python_api_testing/non_working_unit_tests/grayskull/test_eltwise_ldexp.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# 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_ldexp_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.ldexp(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.ldexp(x, y) | ||
tt_result = ttnn_ops.ttnn_tensor_to_torch(tt_result, output_mem_config) | ||
|
||
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 = [ | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat8_b, ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat16, ttnn.bfloat8_b], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat8_b, ttnn.bfloat8_b], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed", | ||
(test_sweep_args), | ||
) | ||
def test_ldexp(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): | ||
run_ldexp_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device) |
73 changes: 73 additions & 0 deletions
73
tests/ttnn/python_api_testing/non_working_unit_tests/grayskull/test_eltwise_logaddexp.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# 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_logaddexp_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.logaddexp(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.logaddexp(x, y) | ||
tt_result = ttnn_ops.ttnn_tensor_to_torch(tt_result, output_mem_config) | ||
|
||
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 = [ | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat8_b, ttnn.bfloat8_b], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat16, ttnn.bfloat8_b], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat8_b, ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed", | ||
(test_sweep_args), | ||
) | ||
def test_logaddexp(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): | ||
run_logaddexp_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device) |
73 changes: 73 additions & 0 deletions
73
tests/ttnn/python_api_testing/non_working_unit_tests/grayskull/test_eltwise_logaddexp2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# 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_logaddexp2_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.logaddexp2(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.logaddexp2(x, y) | ||
tt_result = ttnn_ops.ttnn_tensor_to_torch(tt_result, output_mem_config) | ||
|
||
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 = [ | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat8_b, ttnn.bfloat8_b], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat16, ttnn.bfloat8_b], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat8_b, ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed", | ||
(test_sweep_args), | ||
) | ||
def test_logaddexp2(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): | ||
run_logaddexp2_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device) |
73 changes: 73 additions & 0 deletions
73
tests/ttnn/python_api_testing/non_working_unit_tests/grayskull/test_logical_and.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# 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_and_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.logical_and(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.logical_and(x, y) | ||
tt_result = ttnn_ops.ttnn_tensor_to_torch(tt_result, output_mem_config) | ||
|
||
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 = [ | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat8_b, ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat16, ttnn.bfloat8_b], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat8_b, ttnn.bfloat8_b], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed", | ||
(test_sweep_args), | ||
) | ||
def test_and(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): | ||
run_and_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device) |
73 changes: 73 additions & 0 deletions
73
tests/ttnn/python_api_testing/non_working_unit_tests/grayskull/test_logical_or.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# 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_or_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.logical_or(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.logical_or(x, y) | ||
tt_result = ttnn_ops.ttnn_tensor_to_torch(tt_result, output_mem_config) | ||
|
||
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 = [ | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat8_b, ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat16, ttnn.bfloat8_b], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(160, 128), (160, 128)], | ||
[ttnn.bfloat8_b, ttnn.bfloat8_b], | ||
[ttnn.TILE_LAYOUT, ttnn.TILE_LAYOUT], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed", | ||
(test_sweep_args), | ||
) | ||
def test_or(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): | ||
run_or_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device) |
Oops, something went wrong.