-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support missing cases for sweep tests (#15804)
### Ticket Link to Github Issue #15549 ### Problem description Provide context for the problem. Support various combinations of missing test cases ### What's changed Describe the approach used to solve the problem. Summarize the changes made and its impact. Add all missing combinations of test case ### Checklist - [x] Post commit CI passes : https://github.com/tenstorrent/tt-metal/actions/runs/12396806647 - [x] Blackhole Post commit (if applicable) : https://github.com/tenstorrent/tt-metal/actions/runs/12396812182 - [x] Model regression CI testing passes (if applicable) : https://github.com/tenstorrent/tt-metal/actions/runs/12396814398 - [x] Device performance regression CI testing passes (if applicable) : https://github.com/tenstorrent/tt-metal/actions/runs/12396816791 - [x] New/Existing tests provide coverage for changes --------- Signed-off-by: Amruth Sandhupatla <[email protected]>
- Loading branch information
1 parent
f1ccbb6
commit 26a041c
Showing
9 changed files
with
512 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from typing import Optional, Tuple | ||
from functools import partial | ||
|
||
import torch | ||
import random | ||
import ttnn | ||
from tests.sweep_framework.sweep_utils.utils import gen_shapes | ||
from tests.tt_eager.python_api_testing.sweep_tests.generation_funcs import gen_func_with_cast_tt | ||
|
||
from tests.ttnn.utils_for_testing import check_with_pcc, start_measuring_time, stop_measuring_time | ||
from models.utility_functions import torch_random | ||
|
||
# Override the default timeout in seconds for hang detection. | ||
TIMEOUT = 30 | ||
|
||
|
||
def run_sum( | ||
input_shape, | ||
dim, | ||
keepdim, | ||
input_a_dtype, | ||
input_a_layout, | ||
input_a_memory_config, | ||
output_memory_config, | ||
device, | ||
) -> list: | ||
data_seed = random.randint(0, 20000000) | ||
torch.manual_seed(data_seed) | ||
|
||
torch_input_tensor_a = gen_func_with_cast_tt( | ||
partial(torch_random, low=-100, high=100, dtype=torch.float32), input_a_dtype | ||
)(input_shape) | ||
|
||
dim = dim % len(input_shape) | ||
|
||
torch_output_tensor = torch.sum(torch_input_tensor_a, dim=dim, keepdim=keepdim) | ||
|
||
input_tensor_a = ttnn.from_torch( | ||
torch_input_tensor_a, | ||
dtype=input_a_dtype, | ||
layout=input_a_layout, | ||
device=device, | ||
memory_config=input_a_memory_config, | ||
) | ||
|
||
start_time = start_measuring_time() | ||
result = ttnn.sum(input_tensor_a, dim=dim, memory_config=output_memory_config) | ||
output_tensor = ttnn.to_torch(result) | ||
e2e_perf = stop_measuring_time(start_time) | ||
|
||
pcc = check_with_pcc(torch_output_tensor, output_tensor, 0.999) | ||
# print(f"input_shape {input_shape} pcc {pcc}") | ||
return [pcc, e2e_perf] |
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
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.