Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#13676: Add unit tests for io_bw, tan_bw, and lerp #15002

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can write unpacking this way
(passed, pcc_value), 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]}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use unpacked value pcc_value

Loading
Loading