Skip to content

Commit 50ec82e

Browse files
authored
Arm backend: Set qtol=1 for flaky tests. (#9641)
This was (accidentally) removed at a refactoring. Also takes the chance to use the new XfailIf.. decorator. Signed-off-by: Erik Lundell <[email protected]>
1 parent 785afce commit 50ec82e

File tree

4 files changed

+37
-90
lines changed

4 files changed

+37
-90
lines changed

backends/arm/test/ops/test_layer_norm.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -77,47 +77,31 @@ def test_native_layer_norm_tosa_BI(test_data):
7777
test_data[0],
7878
"torch.ops.aten.sub.Tensor", # Just check for sub op included in the layernorm decomposition
7979
)
80+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
8081
pipeline.run()
8182

8283

8384
@common.parametrize("test_data", test_data_suite)
85+
@common.XfailIfNoCorstone300
8486
def test_native_layer_norm_u55_BI(test_data):
8587
pipeline = EthosU55PipelineBI[input_t](
8688
test_data[1],
8789
test_data[0],
8890
"torch.ops.aten.sub.Tensor", # Just check for sub op included in the layernorm decomposition
91+
run_on_fvp=True,
8992
)
93+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
9094
pipeline.run()
9195

9296

9397
@common.parametrize("test_data", test_data_suite)
98+
@common.XfailIfNoCorstone320
9499
def test_native_layer_norm_u85_BI(test_data):
95-
pipeline = EthosU85PipelineBI[input_t](
96-
test_data[1],
97-
test_data[0],
98-
"torch.ops.aten.sub.Tensor", # Just check for sub op included in the layernorm decomposition
99-
)
100-
pipeline.run()
101-
102-
103-
@common.parametrize("test_data", test_data_suite)
104-
@common.SkipIfNoCorstone300
105-
def test_native_layer_norm_u55_BI_on_fvp(test_data):
106-
pipeline = EthosU55PipelineBI[input_t](
107-
test_data[1],
108-
test_data[0],
109-
"torch.ops.aten.sub.Tensor", # Just check for sub op included in the layernorm decomposition
110-
)
111-
pipeline.run()
112-
113-
114-
@common.parametrize("test_data", test_data_suite)
115-
@common.SkipIfNoCorstone320
116-
def test_native_layer_norm_u85_BI_on_fvp(test_data):
117100
pipeline = EthosU85PipelineBI[input_t](
118101
test_data[1],
119102
test_data[0],
120103
"torch.ops.aten.sub.Tensor", # Just check for sub op included in the layernorm decomposition
121104
run_on_fvp=True,
122105
)
106+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
123107
pipeline.run()

backends/arm/test/ops/test_logsoftmax.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def test_log_softmax_tosa_MI(test_data):
4747
pipeline.add_stage_after(
4848
"to_edge_transform_and_lower", pipeline.tester.check_not, [exir_op]
4949
)
50+
5051
pipeline.run()
5152

5253

@@ -55,22 +56,7 @@ def test_log_softmax_tosa_BI(test_data):
5556
data, dim = test_data
5657
pipeline = TosaPipelineBI[input_t1](LogSoftmax(dim), data, [])
5758
pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op])
58-
pipeline.run()
59-
60-
61-
@common.parametrize("test_data", LogSoftmax.test_data)
62-
def test_log_softmax_u55_BI(test_data):
63-
data, dim = test_data
64-
pipeline = EthosU55PipelineBI[input_t1](LogSoftmax(dim), data, [], run_on_fvp=False)
65-
pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op])
66-
pipeline.run()
67-
68-
69-
@common.parametrize("test_data", LogSoftmax.test_data)
70-
def test_log_softmax_u85_BI(test_data):
71-
data, dim = test_data
72-
pipeline = EthosU85PipelineBI[input_t1](LogSoftmax(dim), data, [], run_on_fvp=False)
73-
pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op])
59+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
7460
pipeline.run()
7561

7662

@@ -81,11 +67,12 @@ def test_log_softmax_u85_BI(test_data):
8167
"randn_mult_batches": "MLETORCH-433: Multiple batches not supported on FVP"
8268
},
8369
)
84-
@common.SkipIfNoCorstone300()
85-
def test_log_softmax_u55_BI_on_fvp(test_data):
70+
@common.XfailIfNoCorstone300()
71+
def test_log_softmax_u55_BI(test_data):
8672
data, dim = test_data
8773
pipeline = EthosU55PipelineBI[input_t1](LogSoftmax(dim), data, [], run_on_fvp=True)
8874
pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op])
75+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
8976
pipeline.run()
9077

9178

@@ -96,9 +83,10 @@ def test_log_softmax_u55_BI_on_fvp(test_data):
9683
"randn_mult_batches": "MLETORCH-433: Multiple batches not supported on FVP"
9784
},
9885
)
99-
@common.SkipIfNoCorstone320
100-
def test_log_softmax_u85_BI_on_fvp(test_data):
86+
@common.XfailIfNoCorstone320
87+
def test_log_softmax_u85_BI(test_data):
10188
data, dim = test_data
10289
pipeline = EthosU85PipelineBI[input_t1](LogSoftmax(dim), data, [], run_on_fvp=True)
10390
pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op])
91+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
10492
pipeline.run()

backends/arm/test/ops/test_mean_dim.py

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -139,48 +139,36 @@ def test_mean_tosa_MI(test_data):
139139

140140
@common.parametrize("test_data", MeanDim.test_data_suite)
141141
def test_mean_tosa_BI(test_data):
142-
TosaPipelineBI[input_t](
143-
MeanDim(test_data[1], test_data[2]),
144-
(test_data[0],),
145-
"torch.ops.aten.sum.dim_IntList", # Just check for sum op included in the mean decomposition
146-
).run()
147-
148-
149-
@common.parametrize("test_data", MeanDim.test_data_suite)
150-
def test_mean_u55(test_data):
151-
EthosU55PipelineBI[input_t](
152-
MeanDim(test_data[1], test_data[2]),
153-
(test_data[0],),
154-
"torch.ops.aten.sum.dim_IntList", # Just check for sum op included in the mean decomposition
155-
).run()
156-
157-
158-
@common.parametrize("test_data", MeanDim.test_data_suite)
159-
def test_mean_u85(test_data):
160-
EthosU85PipelineBI[input_t](
142+
pipeline = TosaPipelineBI[input_t](
161143
MeanDim(test_data[1], test_data[2]),
162144
(test_data[0],),
163145
"torch.ops.aten.sum.dim_IntList", # Just check for sum op included in the mean decomposition
164-
).run()
146+
)
147+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
148+
pipeline.run()
165149

166150

167151
@common.parametrize("test_data", MeanDim.test_data_suite)
168-
@common.SkipIfNoCorstone300
169-
def test_mean_u55_on_fvp(test_data):
170-
EthosU55PipelineBI[input_t](
152+
@common.XfailIfNoCorstone300
153+
def test_mean_u55_BI(test_data):
154+
pipeline = EthosU55PipelineBI[input_t](
171155
MeanDim(test_data[1], test_data[2]),
172156
(test_data[0],),
173157
"torch.ops.aten.sum.dim_IntList", # Just check for sum op included in the mean decomposition
174158
run_on_fvp=True,
175-
).run()
159+
)
160+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
161+
pipeline.run()
176162

177163

178164
@common.parametrize("test_data", MeanDim.test_data_suite)
179-
@common.SkipIfNoCorstone320
180-
def test_mean_u85_on_fvp(test_data):
181-
EthosU85PipelineBI[input_t](
165+
@common.XfailIfNoCorstone320
166+
def test_mean_u85_BI(test_data):
167+
pipeline = EthosU85PipelineBI[input_t](
182168
MeanDim(test_data[1], test_data[2]),
183169
(test_data[0],),
184170
"torch.ops.aten.sum.dim_IntList", # Just check for sum op included in the mean decomposition
185171
run_on_fvp=True,
186-
).run()
172+
)
173+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
174+
pipeline.run()

backends/arm/test/ops/test_softmax.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,7 @@ def test_softmax_tosa_BI(test_data):
5757
data, dim = test_data
5858
pipeline = TosaPipelineBI[input_t1](Softmax(dim), data, [])
5959
pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op])
60-
pipeline.run()
61-
62-
63-
@common.parametrize("test_data", Softmax.test_data)
64-
def test_softmax_u55_BI(test_data):
65-
data, dim = test_data
66-
pipeline = EthosU55PipelineBI[input_t1](Softmax(dim), data, [], run_on_fvp=False)
67-
pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op])
68-
pipeline.run()
69-
70-
71-
@common.parametrize("test_data", Softmax.test_data)
72-
def test_softmax_u85_BI(test_data):
73-
data, dim = test_data
74-
pipeline = EthosU85PipelineBI[input_t1](Softmax(dim), data, [], run_on_fvp=False)
75-
pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op])
60+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
7661
pipeline.run()
7762

7863

@@ -83,11 +68,12 @@ def test_softmax_u85_BI(test_data):
8368
"randn_mult_batches": "MLETORCH-433: Multiple batches not supported on FVP"
8469
},
8570
)
86-
@common.SkipIfNoCorstone300
87-
def test_softmax_u55_BI_on_fvp(test_data):
71+
@common.XfailIfNoCorstone300
72+
def test_softmax_u55_BI(test_data):
8873
data, dim = test_data
8974
pipeline = EthosU55PipelineBI[input_t1](Softmax(dim), data, [], run_on_fvp=True)
9075
pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op])
76+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
9177
pipeline.run()
9278

9379

@@ -98,9 +84,10 @@ def test_softmax_u55_BI_on_fvp(test_data):
9884
"randn_mult_batches": "MLETORCH-433: Multiple batches not supported on FVP"
9985
},
10086
)
101-
@common.SkipIfNoCorstone320
102-
def test_softmax_u85_BI_on_fvp(test_data):
87+
@common.XfailIfNoCorstone320
88+
def test_softmax_u85_BI(test_data):
10389
data, dim = test_data
10490
pipeline = EthosU85PipelineBI[input_t1](Softmax(dim), data, [], run_on_fvp=True)
10591
pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op])
92+
pipeline.change_args("run_method_and_compare_outputs", qtol=1)
10693
pipeline.run()

0 commit comments

Comments
 (0)