diff --git a/tests/tt_eager/python_api_testing/sweep_tests/op_map.py b/tests/tt_eager/python_api_testing/sweep_tests/op_map.py index 7eb0e2663a6..630a419ab3f 100644 --- a/tests/tt_eager/python_api_testing/sweep_tests/op_map.py +++ b/tests/tt_eager/python_api_testing/sweep_tests/op_map.py @@ -1186,10 +1186,6 @@ "tt_op": tt_lib_ops.abs_bw, "pytorch_op": pytorch_ops.abs_bw, }, - "relu-bw": { - "tt_op": tt_lib_ops.relu_bw, - "pytorch_op": pytorch_ops.relu_bw, - }, "gt-bw": { "tt_op": tt_lib_ops.gt_bw, "pytorch_op": pytorch_ops.gt_bw, diff --git a/tests/tt_eager/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/grayskull/pytorch_backward_relu.yaml b/tests/tt_eager/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/grayskull/pytorch_backward_relu.yaml deleted file mode 100644 index a3c8dfaf012..00000000000 --- a/tests/tt_eager/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/grayskull/pytorch_backward_relu.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- -test-list: - - relu-bw: - shape: - start-shape: [1, 1, 32, 32] - end-shape: [6, 12, 256, 256] - interval: [1, 1, 32, 32] - num-shapes: 2 - num-samples: 64 - args-sampling-strategy: "all" - datagen: - function: gen_rand - args: - low: -100 - high: 100 - comparison: - function: comp_pcc - args-gen: gen_scalar_args - args: - data-layout: ["TILE"] - data-type: ["BFLOAT16"] - buffer-type: ["DRAM", "L1", "SYSTEM_MEMORY"] - out-buffer-type: ["DRAM", "L1"] - output-file: backward_relu_sweep.csv - env: - # TT_PCI_DMA_BUF_SIZE: "1048576" - - relu-bw: - shape: - start-shape: [1, 1, 2, 2] - end-shape: [6, 12, 256, 256] - interval: [1, 1, 1, 2] - num-shapes: 2 - num-samples: 64 - args-sampling-strategy: "all" - datagen: - function: gen_rand - args: - low: -100 - high: 100 - comparison: - function: comp_pcc - args-gen: gen_scalar_args - args: - data-layout: ["ROW_MAJOR"] - data-type: ["BFLOAT16"] - buffer-type: ["DRAM", "L1", "SYSTEM_MEMORY"] - out-buffer-type: ["DRAM", "L1"] - output-file: backward_relu_sweep.csv - env: - # TT_PCI_DMA_BUF_SIZE: "1048576" diff --git a/tests/tt_eager/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/wormhole/pytorch_backward_relu.yaml b/tests/tt_eager/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/wormhole/pytorch_backward_relu.yaml deleted file mode 100644 index a3c8dfaf012..00000000000 --- a/tests/tt_eager/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/wormhole/pytorch_backward_relu.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- -test-list: - - relu-bw: - shape: - start-shape: [1, 1, 32, 32] - end-shape: [6, 12, 256, 256] - interval: [1, 1, 32, 32] - num-shapes: 2 - num-samples: 64 - args-sampling-strategy: "all" - datagen: - function: gen_rand - args: - low: -100 - high: 100 - comparison: - function: comp_pcc - args-gen: gen_scalar_args - args: - data-layout: ["TILE"] - data-type: ["BFLOAT16"] - buffer-type: ["DRAM", "L1", "SYSTEM_MEMORY"] - out-buffer-type: ["DRAM", "L1"] - output-file: backward_relu_sweep.csv - env: - # TT_PCI_DMA_BUF_SIZE: "1048576" - - relu-bw: - shape: - start-shape: [1, 1, 2, 2] - end-shape: [6, 12, 256, 256] - interval: [1, 1, 1, 2] - num-shapes: 2 - num-samples: 64 - args-sampling-strategy: "all" - datagen: - function: gen_rand - args: - low: -100 - high: 100 - comparison: - function: comp_pcc - args-gen: gen_scalar_args - args: - data-layout: ["ROW_MAJOR"] - data-type: ["BFLOAT16"] - buffer-type: ["DRAM", "L1", "SYSTEM_MEMORY"] - out-buffer-type: ["DRAM", "L1"] - output-file: backward_relu_sweep.csv - env: - # TT_PCI_DMA_BUF_SIZE: "1048576" diff --git a/tests/tt_eager/python_api_testing/sweep_tests/tt_lib_ops.py b/tests/tt_eager/python_api_testing/sweep_tests/tt_lib_ops.py index ef464693c67..3ef66409a07 100644 --- a/tests/tt_eager/python_api_testing/sweep_tests/tt_lib_ops.py +++ b/tests/tt_eager/python_api_testing/sweep_tests/tt_lib_ops.py @@ -3067,26 +3067,6 @@ def abs_bw( return tt2torch_tensor(t2) -@setup_host_and_device -def relu_bw( - x, - y, - *args, - device, - dtype, - layout, - input_mem_config, - output_mem_config, - **kwargs, -): - t0 = setup_tt_tensor(x, device, layout[0], input_mem_config[0], dtype[0]) - t1 = setup_tt_tensor(y, device, layout[1], input_mem_config[1], dtype[1]) - - t2 = ttl.tensor.relu_bw(t0, t1, output_mem_config)[0] - - return tt2torch_tensor(t2) - - @setup_host_and_device def gt_bw( x, diff --git a/tests/ttnn/python_api_testing/sweep_tests/op_map.py b/tests/ttnn/python_api_testing/sweep_tests/op_map.py index ba3c5b1e05a..4a6e08ee93c 100644 --- a/tests/ttnn/python_api_testing/sweep_tests/op_map.py +++ b/tests/ttnn/python_api_testing/sweep_tests/op_map.py @@ -773,4 +773,8 @@ "tt_op": ttnn_ops.addalpha_bw, "pytorch_op": pytorch_ops.addalpha_bw, }, + "relu-bw": { + "tt_op": ttnn_ops.relu_bw, + "pytorch_op": pytorch_ops.relu_bw, + }, } diff --git a/tests/ttnn/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/grayskull/ttnn_backward_relu_test.yaml b/tests/ttnn/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/grayskull/ttnn_backward_relu_test.yaml new file mode 100644 index 00000000000..92a3cc60aef --- /dev/null +++ b/tests/ttnn/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/grayskull/ttnn_backward_relu_test.yaml @@ -0,0 +1,27 @@ +--- +test-list: + - relu-bw: + shape: + start-shape: [1, 1, 32, 32] + end-shape: [6, 12, 256, 256] + interval: [1, 1, 32, 32] + num-shapes: 2 + num-samples: 128 + num-dims: [2, 3, 4] + args-sampling-strategy: "all" + datagen: + function: gen_rand + args: + low: -100 + high: 100 + comparison: + function: comp_pcc + args-gen: gen_scalar_args + args: + data-layout: ["TILE"] + data-type: ["BFLOAT16"] + buffer-type: ["DRAM", "L1"] + out-buffer-type: ["DRAM", "L1"] + output-file: backward_relu_sweep.csv + env: + # TT_PCI_DMA_BUF_SIZE: "1048576" diff --git a/tests/ttnn/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/wormhole/ttnn_backward_relu_test.yaml b/tests/ttnn/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/wormhole/ttnn_backward_relu_test.yaml new file mode 100644 index 00000000000..92a3cc60aef --- /dev/null +++ b/tests/ttnn/python_api_testing/sweep_tests/test_configs/ci_sweep_tests_working/wormhole/ttnn_backward_relu_test.yaml @@ -0,0 +1,27 @@ +--- +test-list: + - relu-bw: + shape: + start-shape: [1, 1, 32, 32] + end-shape: [6, 12, 256, 256] + interval: [1, 1, 32, 32] + num-shapes: 2 + num-samples: 128 + num-dims: [2, 3, 4] + args-sampling-strategy: "all" + datagen: + function: gen_rand + args: + low: -100 + high: 100 + comparison: + function: comp_pcc + args-gen: gen_scalar_args + args: + data-layout: ["TILE"] + data-type: ["BFLOAT16"] + buffer-type: ["DRAM", "L1"] + out-buffer-type: ["DRAM", "L1"] + output-file: backward_relu_sweep.csv + env: + # TT_PCI_DMA_BUF_SIZE: "1048576" diff --git a/tests/ttnn/python_api_testing/sweep_tests/ttnn_ops.py b/tests/ttnn/python_api_testing/sweep_tests/ttnn_ops.py index 57a4d9d3d66..7d7e51b7fea 100644 --- a/tests/ttnn/python_api_testing/sweep_tests/ttnn_ops.py +++ b/tests/ttnn/python_api_testing/sweep_tests/ttnn_ops.py @@ -3707,3 +3707,22 @@ def rsqrt_bw( t2 = ttnn.rsqrt_bw(t0, t1, memory_config=output_mem_config)[0] return ttnn_tensor_to_torch(t2) + + +def relu_bw( + x, + y, + *args, + device, + dtype, + layout, + input_mem_config, + output_mem_config, + **kwargs, +): + t0 = setup_ttnn_tensor(x, device, layout[0], input_mem_config[0], dtype[0]) + t1 = setup_ttnn_tensor(y, device, layout[1], input_mem_config[1], dtype[1]) + + t2 = ttnn.relu_bw(t0, t1, memory_config=output_mem_config)[0] + + return ttnn_tensor_to_torch(t2)