Skip to content

Commit

Permalink
#16147: Replace binary with binary_ng
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickroberts committed Feb 3, 2025
1 parent 27d4416 commit 92c9b5e
Show file tree
Hide file tree
Showing 13 changed files with 191 additions and 324 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ def test_run_eltwise_unary_comp(

@pytest.mark.parametrize("unary_kind", ["add_unary", "sub_unary", "mul_unary", "div_unary"])
@pytest.mark.parametrize("scalar", [-2.0, 1.0, 2.0, 8.0])
@skip_for_grayskull()
def test_run_eltwise_binop_to_unary_ops(
self,
unary_kind,
Expand Down
22 changes: 12 additions & 10 deletions tests/ttnn/unit_tests/gtests/test_graph_add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ INSTANTIATE_TEST_SUITE_P(
.b_Shape = ttnn::Shape(tt::tt_metal::Array4D{1, 3, 32, 32}),
.memory_config = ttnn::L1_MEMORY_CONFIG,
.expected_calltrace =
{"ttnn::add", "ttnn::prim::binary", "BinaryDeviceOperation", "tt::tt_metal::create_device_tensor"},
{"ttnn::add",
"ttnn::prim::binary_ng",
"BinaryNgDeviceOperation",
"tt::tt_metal::create_device_tensor"},
.expected_peak_L1_memory_usage = 30720,
.expected_intermediate_tensors_count = 0,
.expected_cb_peak_per_core = 3 * 4096,
Expand All @@ -154,18 +157,14 @@ INSTANTIATE_TEST_SUITE_P(
.memory_config = ttnn::L1_MEMORY_CONFIG,
.expected_calltrace =
{"ttnn::add",
"ttnn::repeat",
"ttnn::prim::old_infra_device_operation",
"RepeatDeviceOperation",
"tt::tt_metal::create_device_tensor",
"ttnn::prim::binary",
"BinaryDeviceOperation",
"ttnn::prim::binary_ng",
"BinaryNgDeviceOperation",
"tt::tt_metal::create_device_tensor"},
.expected_peak_L1_memory_usage = 92160,
.expected_peak_L1_memory_usage = 67584,
.expected_intermediate_tensors_count = 0,
.expected_cb_peak_per_core = 3 * 4096,
.expected_l1_output_per_core = 2048,
.expected_l1_peak_per_core = 2 * 2048,
.expected_l1_peak_per_core = 2048,
.expected_output_info = {graph::TensorInfo{
.shape = ttnn::Shape(tt::tt_metal::Array4D{4, 3, 32, 32}),
.size = 24576,
Expand All @@ -183,7 +182,10 @@ INSTANTIATE_TEST_SUITE_P(
{6 * 32, 32 * 32},
ShardOrientation::COL_MAJOR}},
.expected_calltrace =
{"ttnn::add", "ttnn::prim::binary", "BinaryDeviceOperation", "tt::tt_metal::create_device_tensor"},
{"ttnn::add",
"ttnn::prim::binary_ng",
"BinaryNgDeviceOperation",
"tt::tt_metal::create_device_tensor"},
.expected_peak_L1_memory_usage = 20054016,
.expected_intermediate_tensors_count = 0,
.expected_cb_peak_per_core = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,12 @@ INSTANTIATE_TEST_SUITE_P(
{BoardType::N300,
ttnn::graph::ResourceUsage{
.cb_peak_size_per_core = 3 * (2 * 2 * 32 * 32),
.l1_buffers_peak_per_core = 20480,
.l1_buffers_peak_per_core = 10240,
.l1_output_buffer_per_core = 10240}},
{BoardType::E150,
ttnn::graph::ResourceUsage{
.cb_peak_size_per_core = 3 * (2 * 2 * 32 * 32),
.l1_buffers_peak_per_core = 12288,
.l1_buffers_peak_per_core = 6144,
.l1_output_buffer_per_core = 6144}}}),
std::make_tuple( // broadcast
g_interleave_4_2_160_244_tiled,
Expand All @@ -429,7 +429,7 @@ INSTANTIATE_TEST_SUITE_P(
{BoardType::N300,
ttnn::graph::ResourceUsage{
.cb_peak_size_per_core = 3 * (2 * 2 * 32 * 32),
.l1_buffers_peak_per_core = 20480,
.l1_buffers_peak_per_core = 10240,
.l1_output_buffer_per_core = 10240}},
{BoardType::E150,
ttnn::graph::ResourceUsage{
Expand Down
5 changes: 3 additions & 2 deletions tests/ttnn/unit_tests/operations/eltwise/test_mul.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import ttnn

from models.utility_functions import skip_for_grayskull
from tests.ttnn.utils_for_testing import assert_with_pcc
from torch.nn import functional as F


# fmt: off
Expand Down Expand Up @@ -103,7 +103,8 @@ def test_multiply_int32_with_scalar(device, input_a, scalar):
@pytest.mark.parametrize("output_memory_config", [ttnn.DRAM_MEMORY_CONFIG])
@pytest.mark.parametrize("scalar", [0.125])
@pytest.mark.parametrize("batch_size", [6, 7, 8])
def test_multiply_with_scalar_sharded(device, scalar, batch_size, output_memory_config):
@skip_for_grayskull()
def test_multiply_float32_with_scalar_sharded(device, scalar, batch_size, output_memory_config):
torch.manual_seed(0)
torch_input_tensor_a = torch.rand((batch_size, 16, 384, 384), dtype=torch.float32)
torch_output_tensor = scalar * torch_input_tensor_a
Expand Down
Loading

0 comments on commit 92c9b5e

Please sign in to comment.