Skip to content

Commit 894258c

Browse files
committed
Arm backend: Refactor OpNotSupportedPipeline to allow for Tosa 1.0
Change-Id: Ieb0e0104a9ebc15f319453f983edfaf0016d4050
1 parent f7ed853 commit 894258c

18 files changed

+105
-38
lines changed

backends/arm/test/ops/test_amax.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ def test_amax_u55_BI_not_delegated():
8787
pipeline = OpNotSupportedPipeline[Amax.input_t](
8888
Amax(dim, keep_dims),
8989
data,
90-
"TOSA-0.80+BI+u55",
9190
{" executorch_exir_dialects_edge__ops_aten_amax_default": 1},
91+
quantize=True,
92+
u55_subset=True,
9293
)
9394
pipeline.run()
9495

@@ -128,14 +129,12 @@ def test_max_dim_tosa_BI_to_amax(test_data: Max.input_t):
128129
def test_max_dim_tosa_BI_not_delegated():
129130
data, dim = Max.test_data()["rank_4_dim_3"]()
130131
pipeline = OpNotSupportedPipeline[Max.input_t](
131-
MaxWithIndex(dim), data, "TOSA-0.80+BI", {}
132+
MaxWithIndex(dim), data, {}, quantize=True
132133
)
133134
pipeline.run()
134135

135136

136137
def test_max_dim_tosa_MI_not_delegated():
137138
data, dim = Max.test_data["rank_4_dim_3"]()
138-
pipeline = OpNotSupportedPipeline[Max.input_t](
139-
MaxWithIndex(dim), data, "TOSA-0.80+MI", {}
140-
)
139+
pipeline = OpNotSupportedPipeline[Max.input_t](MaxWithIndex(dim), data, {})
141140
pipeline.run()

backends/arm/test/ops/test_amin.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ def test_amin_u55_BI_not_delegated():
9696
pipeline = OpNotSupportedPipeline[Amin.input_t](
9797
Amin(dim, keep_dims),
9898
data,
99-
"TOSA-0.80+BI+u55",
10099
{" executorch_exir_dialects_edge__ops_aten_amin_default": 1},
100+
quantize=True,
101+
u55_subset=True,
101102
)
102103
pipeline.run()
103104

@@ -137,14 +138,15 @@ def test_min_dim_tosa_BI_to_amin(test_data: Min.input_t):
137138
def test_min_dim_tosa_BI_not_delegated():
138139
data, dim = Min.test_data["rank_4_dim_3"]()
139140
pipeline = OpNotSupportedPipeline[Min.input_t](
140-
MinWithIndex(dim), data, "TOSA-0.80+BI+u55", {}
141+
MinWithIndex(dim),
142+
data,
143+
{},
144+
quantize=True,
141145
)
142146
pipeline.run()
143147

144148

145149
def test_min_dim_tosa_MI_not_delegated():
146150
data, dim = Min.test_data["rank_4_dim_3"]()
147-
pipeline = OpNotSupportedPipeline[Min.input_t](
148-
MinWithIndex(dim), data, "TOSA-0.80+MI", {}
149-
)
151+
pipeline = OpNotSupportedPipeline[Min.input_t](MinWithIndex(dim), data, {})
150152
pipeline.run()

backends/arm/test/ops/test_any.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@ def test_any_u55_BI(test_data: input_t1):
143143
# Tests that we don't delegate these ops since they are not supported on U55.
144144
op, test_input = test_data()
145145
pipeline = OpNotSupportedPipeline[input_t1](
146-
op, test_input(), "TOSA-0.80+BI+u55", {op.exir_op: 1}
146+
op,
147+
test_input(),
148+
{op.exir_op: 1},
149+
quantize=True,
150+
u55_subset=True,
147151
)
148152
pipeline.run()
149153

backends/arm/test/ops/test_avg_pool2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ def test_avg_pool2d_tosa_BI_not_delegated(reject_module):
159159
pipeline = OpNotSupportedPipeline[input_t](
160160
module=model,
161161
test_data=(test_data,),
162-
tosa_version="TOSA-0.80+BI",
163162
non_delegated_ops={},
164163
n_expected_delegates=0,
164+
quantize=True,
165165
)
166166
pipeline.run()

backends/arm/test/ops/test_bitwise.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ def test_bitwise_and_tensor_tosa_BI(test_data: input_t2):
8787
def test_bitwise_and_tensor_u55_BI(test_data: input_t2):
8888
# Tests that we don't delegate these ops since they are not supported on U55.
8989
pipeline = OpNotSupportedPipeline[input_t2](
90-
And(), test_data(), "TOSA-0.80+BI+u55", {And().exir_op: 1}
90+
And(),
91+
test_data(),
92+
{And().exir_op: 1},
93+
quantize=True,
94+
u55_subset=True,
9195
)
9296
pipeline.run()
9397

@@ -126,7 +130,11 @@ def test_bitwise_xor_tensor_tosa_BI(test_data: input_t2):
126130
def test_bitwise_xor_tensor_u55_BI(test_data: input_t2):
127131
# Tests that we don't delegate these ops since they are not supported on U55.
128132
pipeline = OpNotSupportedPipeline[input_t2](
129-
Xor(), test_data(), "TOSA-0.80+BI+u55", {Xor().exir_op: 1}
133+
Xor(),
134+
test_data(),
135+
{Xor().exir_op: 1},
136+
quantize=True,
137+
u55_subset=True,
130138
)
131139
pipeline.run()
132140

@@ -161,7 +169,11 @@ def test_bitwise_or_tensor_tosa_BI(test_data: input_t2):
161169
def test_bitwise_or_tensor_u55_BI(test_data: input_t2):
162170
# Tests that we don't delegate these ops since they are not supported on U55.
163171
pipeline = OpNotSupportedPipeline[input_t2](
164-
Or(), test_data(), "TOSA-0.80+BI+u55", {Or().exir_op: 1}
172+
Or(),
173+
test_data(),
174+
{Or().exir_op: 1},
175+
quantize=True,
176+
u55_subset=True,
165177
)
166178
pipeline.run()
167179

backends/arm/test/ops/test_conv2d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ def test_convolution_2d_u55_BI_not_delegated(module: Conv2d):
445445
OpNotSupportedPipeline(
446446
module(),
447447
module().get_inputs(),
448-
"TOSA-0.80+BI+u55",
449448
{"executorch_exir_dialects_edge__ops_aten_convolution_default": 1},
449+
quantize=True,
450+
u55_subset=True,
450451
).run()

backends/arm/test/ops/test_conv3d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ def test_convolution_u55_BI_not_delegated_3d(module: Conv3d):
400400
OpNotSupportedPipeline(
401401
module(),
402402
module().get_inputs(),
403-
"TOSA-0.80+BI+u55",
404403
{"executorch_exir_dialects_edge__ops_aten_convolution_default": 1},
404+
quantize=True,
405+
u55_subset=True,
405406
).run()

backends/arm/test/ops/test_eq.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ def test_eq_scalar_u55_BI_tensor(test_module):
127127
pipeline = OpNotSupportedPipeline[input_t](
128128
test_module(),
129129
test_module().get_inputs(),
130-
"TOSA-0.80+BI+u55",
131130
{Equal.exir_op: 1},
131+
quantize=True,
132+
u55_subset=True,
132133
)
133134
pipeline.run()
134135

@@ -140,9 +141,10 @@ def test_eq_scalar_u55_BI(test_module):
140141
pipeline = OpNotSupportedPipeline[input_t](
141142
test_module(),
142143
test_module().get_inputs(),
143-
"TOSA-0.80+BI+u55",
144144
{Equal.exir_op: 1},
145145
n_expected_delegates=1,
146+
quantize=True,
147+
u55_subset=True,
146148
)
147149
pipeline.run()
148150

backends/arm/test/ops/test_ge.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ def test_ge_tensor_u55_BI(test_module):
127127
pipeline = OpNotSupportedPipeline[input_t](
128128
test_module(),
129129
test_module().get_inputs(),
130-
"TOSA-0.80+BI+u55",
131130
{GreaterEqual.exir_op: 1},
131+
quantize=True,
132+
u55_subset=True,
132133
)
133134
pipeline.run()
134135

@@ -140,9 +141,10 @@ def test_ge_scalar_u55_BI(test_module):
140141
pipeline = OpNotSupportedPipeline[input_t](
141142
test_module(),
142143
test_module().get_inputs(),
143-
"TOSA-0.80+BI+u55",
144144
{GreaterEqual.exir_op: 1},
145145
n_expected_delegates=1,
146+
quantize=True,
147+
u55_subset=True,
146148
)
147149
pipeline.run()
148150

backends/arm/test/ops/test_gt.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ def test_gt_tensor_u55_BI(test_module):
128128
pipeline = OpNotSupportedPipeline[input_t](
129129
test_module(),
130130
test_module().get_inputs(),
131-
"TOSA-0.80+BI+u55",
132131
{Greater.exir_op: 1},
132+
quantize=True,
133+
u55_subset=True,
133134
)
134135
pipeline.run()
135136

@@ -141,9 +142,10 @@ def test_gt_scalar_u55_BI(test_module):
141142
pipeline = OpNotSupportedPipeline[input_t](
142143
test_module(),
143144
test_module().get_inputs(),
144-
"TOSA-0.80+BI+u55",
145145
{Greater.exir_op: 1},
146146
n_expected_delegates=1,
147+
quantize=True,
148+
u55_subset=True,
147149
)
148150
pipeline.run()
149151

backends/arm/test/ops/test_le.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ def test_le_tensor_u55_BI_not_delegated(test_module):
8585
pipeline = OpNotSupportedPipeline[input_t](
8686
test_module(),
8787
test_module().get_inputs(),
88-
"TOSA-0.80+BI+u55",
8988
{exir_op: 1},
89+
quantize=True,
90+
u55_subset=True,
9091
)
9192
pipeline.run()
9293

backends/arm/test/ops/test_logical.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ def test_logical_and_tosa_BI(test_data: input_t2):
103103
def test_logical_and_u55_BI_not_delegated(test_data: input_t2):
104104
# Tests that we don't delegate these ops since they are not supported on U55.
105105
pipeline = OpNotSupportedPipeline[input_t2](
106-
And(), test_data(), "TOSA-0.80+BI+u55", {And().exir_op: 1}
106+
And(),
107+
test_data(),
108+
{And().exir_op: 1},
109+
quantize=True,
110+
u55_subset=True,
107111
)
108112
pipeline.run()
109113

@@ -142,7 +146,11 @@ def test_logical_xor_tosa_BI(test_data: input_t2):
142146
def test_logical_xor_u55_BI_not_delegated(test_data: input_t2):
143147
# Tests that we don't delegate these ops since they are not supported on U55.
144148
pipeline = OpNotSupportedPipeline[input_t2](
145-
Xor(), test_data(), "TOSA-0.80+BI+u55", {Xor().exir_op: 1}
149+
Xor(),
150+
test_data(),
151+
{Xor().exir_op: 1},
152+
quantize=True,
153+
u55_subset=True,
146154
)
147155
pipeline.run()
148156

@@ -177,7 +185,11 @@ def test_logical_or_tosa_BI(test_data: input_t2):
177185
def test_logical_or_u55_BI_not_delegated(test_data: input_t2):
178186
# Tests that we don't delegate these ops since they are not supported on U55.
179187
pipeline = OpNotSupportedPipeline[input_t2](
180-
Or(), test_data(), "TOSA-0.80+BI+u55", {Or().exir_op: 1}
188+
Or(),
189+
test_data(),
190+
{Or().exir_op: 1},
191+
quantize=True,
192+
u55_subset=True,
181193
)
182194
pipeline.run()
183195

@@ -216,7 +228,11 @@ def test_logical_not_tosa_BI(test_data: input_t2):
216228
def test_logical_not_u55_BI_not_delegated(test_data: input_t2):
217229
# Tests that we don't delegate these ops since they are not supported on U55.
218230
pipeline = OpNotSupportedPipeline[input_t2](
219-
Not(), test_data(), "TOSA-0.80+BI+u55", {Not().exir_op: 1}
231+
Not(),
232+
test_data(),
233+
{Not().exir_op: 1},
234+
quantize=True,
235+
u55_subset=True,
220236
)
221237
pipeline.run()
222238

backends/arm/test/ops/test_lt.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ def test_lt_tensor_u55_BI_not_delegated(test_module):
128128
pipeline = OpNotSupportedPipeline[input_t](
129129
test_module(),
130130
test_module().get_inputs(),
131-
"TOSA-0.80+BI+u55",
132131
{LessThan.exir_op: 1},
132+
quantize=True,
133+
u55_subset=True,
133134
)
134135
pipeline.run()
135136

@@ -141,9 +142,10 @@ def test_lt_scalar_u55_BI_not_delegated(test_module):
141142
pipeline = OpNotSupportedPipeline[input_t](
142143
test_module(),
143144
test_module().get_inputs(),
144-
"TOSA-0.80+BI+u55",
145145
{LessThan.exir_op: 1},
146146
n_expected_delegates=1,
147+
quantize=True,
148+
u55_subset=True,
147149
)
148150
pipeline.run()
149151

backends/arm/test/ops/test_ne.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,12 @@ def test_ne_tensor_u55_BI(test_module):
126126
pipeline = OpNotSupportedPipeline[input_t](
127127
test_module,
128128
test_module.get_inputs(),
129-
"TOSA-0.80+BI+u55",
130129
{
131130
NotEqual.decomposed_exir_ops[0]: 1,
132131
NotEqual.decomposed_exir_ops[1]: 1,
133132
},
133+
quantize=True,
134+
u55_subset=True,
134135
)
135136
pipeline.run()
136137

@@ -143,11 +144,12 @@ def test_ne_scalar_u55_BI(test_module):
143144
pipeline = OpNotSupportedPipeline[input_t](
144145
test_module,
145146
test_module.get_inputs(),
146-
"TOSA-0.80+BI+u55",
147147
{
148148
NotEqual.decomposed_exir_ops[0]: 1,
149149
NotEqual.decomposed_exir_ops[1]: 1,
150150
},
151+
quantize=True,
152+
u55_subset=True,
151153
n_expected_delegates=1,
152154
)
153155
pipeline.run()

backends/arm/test/ops/test_sigmoid_16bit.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ def test_sigmoid_tosa_BI_add_sigmoid(test_data):
134134
@pytest.mark.flaky(reruns=32) # Flaky due to Vela bug: MLBEDSW-10642
135135
def test_sigmoid_u55_BI(test_data):
136136
pipeline = OpNotSupportedPipeline(
137-
Sigmoid(), (test_data(),), "TOSA-0.80+BI+u55", {Sigmoid.exir_op: 1}
137+
Sigmoid(),
138+
(test_data(),),
139+
{Sigmoid.exir_op: 1},
140+
quantize=True,
141+
u55_subset=True,
138142
)
139143
pipeline.change_args("quantize", get_16bit_sigmoid_quantizer(True))
140144
pipeline.run()
@@ -149,9 +153,10 @@ def test_sigmoid_u55_BI_add_sigmoid(test_data):
149153
pipeline = OpNotSupportedPipeline(
150154
SigmoidAddSigmoid(),
151155
(test_data(),),
152-
"TOSA-0.80+BI+u55",
153156
{Sigmoid.exir_op: 3},
154157
n_expected_delegates=1,
158+
quantize=True,
159+
u55_subset=True,
155160
)
156161
pipeline.change_args("quantize", get_16bit_sigmoid_quantizer(True))
157162
pipeline.run()

backends/arm/test/ops/test_sigmoid_32bit.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ def test_sigmoid_tosa_BI_add_sigmoid(test_data):
136136
@pytest.mark.flaky(reruns=32) # Flaky due to Vela bug: MLBEDSW-10642
137137
def test_sigmoid_u55_BI(test_data):
138138
pipeline = OpNotSupportedPipeline(
139-
Sigmoid(), (test_data(),), "TOSA-0.80+BI+u55", {Sigmoid.exir_op: 1}
139+
Sigmoid(),
140+
(test_data(),),
141+
{Sigmoid.exir_op: 1},
142+
quantize=True,
143+
u55_subset=True,
140144
)
141145
pipeline.change_args("quantize", get_32bit_sigmoid_quantizer(True))
142146
pipeline.run()
@@ -148,9 +152,10 @@ def test_sigmoid_u55_BI_add_sigmoid(test_data):
148152
pipeline = OpNotSupportedPipeline(
149153
SigmoidAddSigmoid(),
150154
(test_data(),),
151-
"TOSA-0.80+BI+u55",
152155
{Sigmoid.exir_op: 3},
153156
n_expected_delegates=1,
157+
quantize=True,
158+
u55_subset=True,
154159
)
155160
pipeline.change_args("quantize", get_32bit_sigmoid_quantizer(True))
156161
pipeline.run()

backends/arm/test/ops/test_where.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,13 @@ def test_where_self_u55_BI_not_delegated(test_module):
181181
pipeline = OpNotSupportedPipeline[input_t](
182182
test_module(),
183183
test_module().get_inputs(),
184-
"TOSA-0.80+BI+u55",
185184
{
186185
exir_op: 1,
187186
"executorch_exir_dialects_edge__ops_aten_full_default": num_exir,
188187
},
189188
num_delegates,
189+
quantize=True,
190+
u55_subset=True,
190191
)
191192
pipeline.change_args(
192193
"quantize", Quantize(quantizer, get_symmetric_quantization_config())

0 commit comments

Comments
 (0)