-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#8638: Make unit and sweep tests to show ttnn max and ttnn min operat…
…ion failures
- Loading branch information
1 parent
e5ead49
commit ad507e8
Showing
14 changed files
with
391 additions
and
73 deletions.
There are no files selected for viewing
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
113 changes: 113 additions & 0 deletions
113
tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_min_max.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,113 @@ | ||
# 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_min_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, dim, 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.min(x, dim) | ||
|
||
tt_result = ttnn_ops.min( | ||
x, | ||
dim=dim, | ||
device=device, | ||
dtype=dtype, | ||
layout=dlayout, | ||
input_mem_config=in_mem_config, | ||
output_mem_config=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_with_pcc(ref_value, tt_result, 0.99) | ||
|
||
|
||
def run_max_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, dim, 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.max(x, dim) | ||
|
||
tt_result = ttnn_ops.max( | ||
x, | ||
dim=dim, | ||
device=device, | ||
dtype=dtype, | ||
layout=dlayout, | ||
input_mem_config=in_mem_config, | ||
output_mem_config=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_with_pcc(ref_value, tt_result, 0.99) | ||
|
||
|
||
test_sweep_args = [ | ||
( | ||
[(198, 216)], | ||
[ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT], | ||
[ttnn.DRAM_MEMORY_CONFIG], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
-1, | ||
), | ||
( | ||
[(7, 156, 245)], | ||
[ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT], | ||
[ttnn.DRAM_MEMORY_CONFIG], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
-1, | ||
), | ||
( | ||
[(2, 5, 72, 49)], | ||
[ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT], | ||
[ttnn.DRAM_MEMORY_CONFIG], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
-1, | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, dim", | ||
(test_sweep_args), | ||
) | ||
def test_min(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, dim, device): | ||
run_min_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, dim, device) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, dim", | ||
(test_sweep_args), | ||
) | ||
def test_max(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, dim, device): | ||
run_max_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, dim, device) |
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
50 changes: 50 additions & 0 deletions
50
...n_api_testing/sweep_tests/test_configs/ci_sweep_tests_broken/grayskull/ttnn_max_test.yaml
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,50 @@ | ||
--- | ||
test-list: | ||
- ttnn-max: | ||
shape: | ||
start-shape: [1, 1, 1, 1] | ||
end-shape: [6, 12, 256, 256] | ||
interval: [1, 1, 1, 1] | ||
num-dims: [2, 3, 4] | ||
num-shapes: 1 | ||
num-samples: 64 | ||
args-sampling-strategy: "all" | ||
datagen: | ||
function: gen_rand | ||
args: | ||
low: -100 | ||
high: 100 | ||
comparison: | ||
function: comp_equal | ||
args-gen: gen_min_max_dim_args | ||
sanitize-args: False | ||
args: | ||
data-layout: ["TILE"] | ||
data-type: ["BFLOAT16"] | ||
buffer-type: ["DRAM", "L1"] | ||
out-buffer-type: ["DRAM", "L1"] | ||
output-file: max_sweep.csv | ||
- ttnn-max: | ||
shape: | ||
start-shape: [1, 1, 32, 32] | ||
end-shape: [6, 12, 256, 256] | ||
interval: [1, 1, 32, 32] | ||
num-dims: [2, 3, 4] | ||
num-shapes: 1 | ||
num-samples: 64 | ||
args-sampling-strategy: "all" | ||
datagen: | ||
function: gen_rand | ||
args: | ||
low: -100 | ||
high: 100 | ||
comparison: | ||
function: comp_pcc | ||
args-gen: gen_min_max_dim_args | ||
sanitize-args: False | ||
args: | ||
data-layout: ["TILE"] | ||
data-type: ["BFLOAT16"] | ||
buffer-type: ["DRAM", "L1"] | ||
out-buffer-type: ["DRAM", "L1"] | ||
output-file: max_sweep.csv |
50 changes: 50 additions & 0 deletions
50
...n_api_testing/sweep_tests/test_configs/ci_sweep_tests_broken/grayskull/ttnn_min_test.yaml
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,50 @@ | ||
--- | ||
test-list: | ||
- ttnn-min: | ||
shape: | ||
start-shape: [1, 1, 1, 1] | ||
end-shape: [6, 12, 256, 256] | ||
interval: [1, 1, 1, 1] | ||
num-dims: [2, 3, 4] | ||
num-shapes: 1 | ||
num-samples: 64 | ||
args-sampling-strategy: "all" | ||
datagen: | ||
function: gen_rand | ||
args: | ||
low: -100 | ||
high: 100 | ||
comparison: | ||
function: comp_equal | ||
args-gen: gen_min_max_dim_args | ||
sanitize-args: False | ||
args: | ||
data-layout: ["TILE"] | ||
data-type: ["BFLOAT16"] | ||
buffer-type: ["DRAM", "L1"] | ||
out-buffer-type: ["DRAM", "L1"] | ||
output-file: min_sweep.csv | ||
- ttnn-min: | ||
shape: | ||
start-shape: [1, 1, 32, 32] | ||
end-shape: [6, 12, 256, 256] | ||
interval: [1, 1, 32, 32] | ||
num-dims: [2, 3, 4] | ||
num-shapes: 1 | ||
num-samples: 64 | ||
args-sampling-strategy: "all" | ||
datagen: | ||
function: gen_rand | ||
args: | ||
low: -100 | ||
high: 100 | ||
comparison: | ||
function: comp_pcc | ||
args-gen: gen_min_max_dim_args | ||
sanitize-args: False | ||
args: | ||
data-layout: ["TILE"] | ||
data-type: ["BFLOAT16"] | ||
buffer-type: ["DRAM", "L1"] | ||
out-buffer-type: ["DRAM", "L1"] | ||
output-file: min_sweep.csv |
50 changes: 50 additions & 0 deletions
50
...on_api_testing/sweep_tests/test_configs/ci_sweep_tests_broken/wormhole/ttnn_max_test.yaml
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,50 @@ | ||
--- | ||
test-list: | ||
- ttnn-max: | ||
shape: | ||
start-shape: [1, 1, 1, 1] | ||
end-shape: [6, 12, 256, 256] | ||
interval: [1, 1, 1, 1] | ||
num-dims: [2, 3, 4] | ||
num-shapes: 1 | ||
num-samples: 64 | ||
args-sampling-strategy: "all" | ||
datagen: | ||
function: gen_rand | ||
args: | ||
low: -100 | ||
high: 100 | ||
comparison: | ||
function: comp_equal | ||
args-gen: gen_min_max_dim_args | ||
sanitize-args: False | ||
args: | ||
data-layout: ["TILE"] | ||
data-type: ["BFLOAT16"] | ||
buffer-type: ["DRAM", "L1"] | ||
out-buffer-type: ["DRAM", "L1"] | ||
output-file: max_sweep.csv | ||
- ttnn-max: | ||
shape: | ||
start-shape: [1, 1, 32, 32] | ||
end-shape: [6, 12, 256, 256] | ||
interval: [1, 1, 32, 32] | ||
num-dims: [2, 3, 4] | ||
num-shapes: 1 | ||
num-samples: 64 | ||
args-sampling-strategy: "all" | ||
datagen: | ||
function: gen_rand | ||
args: | ||
low: -100 | ||
high: 100 | ||
comparison: | ||
function: comp_pcc | ||
args-gen: gen_min_max_dim_args | ||
sanitize-args: False | ||
args: | ||
data-layout: ["TILE"] | ||
data-type: ["BFLOAT16"] | ||
buffer-type: ["DRAM", "L1"] | ||
out-buffer-type: ["DRAM", "L1"] | ||
output-file: max_sweep.csv |
50 changes: 50 additions & 0 deletions
50
...on_api_testing/sweep_tests/test_configs/ci_sweep_tests_broken/wormhole/ttnn_min_test.yaml
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,50 @@ | ||
--- | ||
test-list: | ||
- ttnn-min: | ||
shape: | ||
start-shape: [1, 1, 1, 1] | ||
end-shape: [6, 12, 256, 256] | ||
interval: [1, 1, 1, 1] | ||
num-dims: [2, 3, 4] | ||
num-shapes: 1 | ||
num-samples: 64 | ||
args-sampling-strategy: "all" | ||
datagen: | ||
function: gen_rand | ||
args: | ||
low: -100 | ||
high: 100 | ||
comparison: | ||
function: comp_equal | ||
args-gen: gen_min_max_dim_args | ||
sanitize-args: False | ||
args: | ||
data-layout: ["TILE"] | ||
data-type: ["BFLOAT16"] | ||
buffer-type: ["DRAM", "L1"] | ||
out-buffer-type: ["DRAM", "L1"] | ||
output-file: min_sweep.csv | ||
- ttnn-min: | ||
shape: | ||
start-shape: [1, 1, 32, 32] | ||
end-shape: [6, 12, 256, 256] | ||
interval: [1, 1, 32, 32] | ||
num-dims: [2, 3, 4] | ||
num-shapes: 1 | ||
num-samples: 64 | ||
args-sampling-strategy: "all" | ||
datagen: | ||
function: gen_rand | ||
args: | ||
low: -100 | ||
high: 100 | ||
comparison: | ||
function: comp_pcc | ||
args-gen: gen_min_max_dim_args | ||
sanitize-args: False | ||
args: | ||
data-layout: ["TILE"] | ||
data-type: ["BFLOAT16"] | ||
buffer-type: ["DRAM", "L1"] | ||
out-buffer-type: ["DRAM", "L1"] | ||
output-file: min_sweep.csv |
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
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
Oops, something went wrong.