Skip to content

Commit

Permalink
Migrated backward comparison op sweeps: gt, lt, ne (#10726)
Browse files Browse the repository at this point in the history
* #10147: Migrated comparison ops

* #10147: Linter

* #10147: Corrected op map

* #10147: Remove tt eager tests
  • Loading branch information
npetrovic-tenstorrent authored Jul 27, 2024
1 parent 248bf99 commit f78fd9d
Show file tree
Hide file tree
Showing 12 changed files with 210 additions and 204 deletions.
12 changes: 0 additions & 12 deletions tests/tt_eager/python_api_testing/sweep_tests/op_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,18 +1186,6 @@
"tt_op": tt_lib_ops.abs_bw,
"pytorch_op": pytorch_ops.abs_bw,
},
"gt-bw": {
"tt_op": tt_lib_ops.gt_bw,
"pytorch_op": pytorch_ops.gt_bw,
},
"lt-bw": {
"tt_op": tt_lib_ops.gt_bw,
"pytorch_op": pytorch_ops.gt_bw,
},
"ne-bw": {
"tt_op": tt_lib_ops.ne_bw,
"pytorch_op": pytorch_ops.ne_bw,
},
"binary-le-bw": {
"tt_op": tt_lib_ops.binary_le_bw,
"pytorch_op": pytorch_ops.binary_le_bw,
Expand Down

This file was deleted.

This file was deleted.

54 changes: 0 additions & 54 deletions tests/tt_eager/python_api_testing/sweep_tests/tt_lib_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -3077,60 +3077,6 @@ def abs_bw(
return tt2torch_tensor(t2)


@setup_host_and_device
def gt_bw(
x,
*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 = ttl.tensor.gt_bw(t0, output_mem_config)[0]

return tt2torch_tensor(t1)


@setup_host_and_device
def lt_bw(
x,
*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 = ttl.tensor.lt_bw(t0, output_mem_config)[0]

return tt2torch_tensor(t1)


@setup_host_and_device
def ne_bw(
x,
*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 = ttl.tensor.ne_bw(t0, output_mem_config)[0]

return tt2torch_tensor(t1)


@setup_host_and_device
def binary_le_bw(
x, # grad_tensor
Expand Down
12 changes: 12 additions & 0 deletions tests/ttnn/python_api_testing/sweep_tests/op_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,4 +777,16 @@
"tt_op": ttnn_ops.relu_bw,
"pytorch_op": pytorch_ops.relu_bw,
},
"gt-bw": {
"tt_op": ttnn_ops.gt_bw,
"pytorch_op": pytorch_ops.gt_bw,
},
"lt-bw": {
"tt_op": ttnn_ops.gt_bw,
"pytorch_op": pytorch_ops.gt_bw,
},
"ne-bw": {
"tt_op": ttnn_ops.ne_bw,
"pytorch_op": pytorch_ops.ne_bw,
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test-list:
start-shape: [1, 1, 32, 32]
end-shape: [6, 12, 256, 256]
interval: [1, 1, 32, 32]
num-shapes: 1
num-shapes: 2
num-samples: 64
args-sampling-strategy: "all"
datagen:
Expand All @@ -14,12 +14,12 @@ test-list:
low: -100
high: 100
comparison:
function: comp_pcc_list
args-gen: gen_dtype_layout_device
function: comp_pcc
args-gen: gen_scalar_args
args:
data-layout: ["TILE"]
data-type: ["BFLOAT16"]
buffer-type: ["DRAM", "L1", "SYSTEM_MEMORY"]
buffer-type: ["DRAM", "L1"]
out-buffer-type: ["DRAM", "L1"]
output-file: backward_gt_sweep.csv
env:
Expand All @@ -29,7 +29,7 @@ test-list:
start-shape: [1, 1, 2, 2]
end-shape: [6, 12, 256, 256]
interval: [1, 1, 1, 2]
num-shapes: 1
num-shapes: 2
num-samples: 64
args-sampling-strategy: "all"
datagen:
Expand All @@ -38,12 +38,12 @@ test-list:
low: -100
high: 100
comparison:
function: comp_pcc_list
args-gen: gen_dtype_layout_device
function: comp_pcc
args-gen: gen_scalar_args
args:
data-layout: ["ROW_MAJOR"]
data-type: ["BFLOAT16"]
buffer-type: ["DRAM", "L1", "SYSTEM_MEMORY"]
buffer-type: ["DRAM", "L1"]
out-buffer-type: ["DRAM", "L1"]
output-file: backward_gt_sweep.csv
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test-list:
start-shape: [1, 1, 32, 32]
end-shape: [6, 12, 256, 256]
interval: [1, 1, 32, 32]
num-shapes: 1
num-shapes: 2
num-samples: 64
args-sampling-strategy: "all"
datagen:
Expand All @@ -14,22 +14,22 @@ test-list:
low: -100
high: 100
comparison:
function: comp_pcc_list
args-gen: gen_dtype_layout_device
function: comp_pcc
args-gen: gen_scalar_args
args:
data-layout: ["TILE"]
data-type: ["BFLOAT16"]
buffer-type: ["DRAM", "L1", "SYSTEM_MEMORY"]
buffer-type: ["DRAM", "L1"]
out-buffer-type: ["DRAM", "L1"]
output-file: backward_lt_sweep.csv
output-file: backward_gt_sweep.csv
env:
# TT_PCI_DMA_BUF_SIZE: "1048576"
- lt-bw:
shape:
start-shape: [1, 1, 2, 2]
end-shape: [6, 12, 256, 256]
interval: [1, 1, 1, 2]
num-shapes: 1
num-shapes: 2
num-samples: 64
args-sampling-strategy: "all"
datagen:
Expand All @@ -38,13 +38,13 @@ test-list:
low: -100
high: 100
comparison:
function: comp_pcc_list
args-gen: gen_dtype_layout_device
function: comp_pcc
args-gen: gen_scalar_args
args:
data-layout: ["ROW_MAJOR"]
data-type: ["BFLOAT16"]
buffer-type: ["DRAM", "L1", "SYSTEM_MEMORY"]
buffer-type: ["DRAM", "L1"]
out-buffer-type: ["DRAM", "L1"]
output-file: backward_lt_sweep.csv
output-file: backward_gt_sweep.csv
env:
# TT_PCI_DMA_BUF_SIZE: "1048576"
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test-list:
start-shape: [1, 1, 32, 32]
end-shape: [6, 12, 256, 256]
interval: [1, 1, 32, 32]
num-shapes: 1
num-shapes: 2
num-samples: 64
args-sampling-strategy: "all"
datagen:
Expand All @@ -14,22 +14,22 @@ test-list:
low: -100
high: 100
comparison:
function: comp_pcc_list
args-gen: gen_dtype_layout_device
function: comp_pcc
args-gen: gen_scalar_args
args:
data-layout: ["TILE"]
data-type: ["BFLOAT16"]
buffer-type: ["DRAM", "L1", "SYSTEM_MEMORY"]
buffer-type: ["DRAM", "L1"]
out-buffer-type: ["DRAM", "L1"]
output-file: backward_lt_sweep.csv
output-file: backward_gt_sweep.csv
env:
# TT_PCI_DMA_BUF_SIZE: "1048576"
- lt-bw:
shape:
start-shape: [1, 1, 2, 2]
end-shape: [6, 12, 256, 256]
interval: [1, 1, 1, 2]
num-shapes: 1
num-shapes: 2
num-samples: 64
args-sampling-strategy: "all"
datagen:
Expand All @@ -38,13 +38,13 @@ test-list:
low: -100
high: 100
comparison:
function: comp_pcc_list
args-gen: gen_dtype_layout_device
function: comp_pcc
args-gen: gen_scalar_args
args:
data-layout: ["ROW_MAJOR"]
data-type: ["BFLOAT16"]
buffer-type: ["DRAM", "L1", "SYSTEM_MEMORY"]
buffer-type: ["DRAM", "L1"]
out-buffer-type: ["DRAM", "L1"]
output-file: backward_lt_sweep.csv
output-file: backward_gt_sweep.csv
env:
# TT_PCI_DMA_BUF_SIZE: "1048576"
Loading

0 comments on commit f78fd9d

Please sign in to comment.