Skip to content

Commit 0501978

Browse files
committed
Merge branch 'main' of https://github.com/pytorch/executorch into dev/refactor_unittests
2 parents 2daf99c + f4e77c7 commit 0501978

File tree

8 files changed

+230
-442
lines changed

8 files changed

+230
-442
lines changed

backends/arm/test/common.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
from executorch.backends.arm.arm_backend import ArmCompileSpecBuilder
1818
from executorch.backends.arm.tosa_specification import TosaSpecification
1919
from executorch.exir.backend.compile_spec_schema import CompileSpec
20-
from runner_utils import corstone300_installed, corstone320_installed, RunnerUtil
20+
from runner_utils import (
21+
arm_executor_runner_exists,
22+
corstone300_installed,
23+
corstone320_installed,
24+
)
2125

2226

2327
def get_time_formatted_path(path: str, log_prefix: str) -> str:
@@ -151,27 +155,14 @@ def get_u85_compile_spec_unbuilt(
151155
return compile_spec
152156

153157

154-
def get_target_board(compile_spec: list[CompileSpec]) -> str | None:
155-
for spec in compile_spec:
156-
if spec.key == "compile_flags":
157-
flags = spec.value.decode()
158-
if "u55" in flags:
159-
return "corstone-300"
160-
elif "u85" in flags:
161-
return "corstone-320"
162-
return None
163-
164-
165158
SkipIfNoCorstone300 = pytest.mark.skipif(
166-
not corstone300_installed()
167-
or not RunnerUtil.arm_executor_runner_exists("corstone-300"),
159+
not corstone300_installed() or not arm_executor_runner_exists("corstone-300"),
168160
reason="Did not find Corstone-300 FVP or executor_runner on path",
169161
)
170162
"""Skips a test if Corsone300 FVP is not installed, or if the executor runner is not built"""
171163

172164
SkipIfNoCorstone320 = pytest.mark.skipif(
173-
not corstone320_installed()
174-
or not RunnerUtil.arm_executor_runner_exists("corstone-320"),
165+
not corstone320_installed() or not arm_executor_runner_exists("corstone-320"),
175166
reason="Did not find Corstone-320 FVP or executor_runner on path",
176167
)
177168
"""Skips a test if Corsone320 FVP is not installed, or if the executor runner is not built."""

backends/arm/test/models/test_mobilenet_v2_arm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_mv2_u55_BI(self):
9898
)
9999
if conftest.is_option_enabled("corstone_fvp"):
100100
tester.run_method_and_compare_outputs(
101-
atol=1.0, qtol=1, inputs=self.model_inputs, target_board="corstone-300"
101+
atol=1.0, qtol=1, inputs=self.model_inputs
102102
)
103103

104104
@pytest.mark.slow
@@ -118,5 +118,5 @@ def test_mv2_u85_BI(self):
118118
)
119119
if conftest.is_option_enabled("corstone_fvp"):
120120
tester.run_method_and_compare_outputs(
121-
atol=1.0, qtol=1, inputs=self.model_inputs, target_board="corstone-320"
121+
atol=1.0, qtol=1, inputs=self.model_inputs
122122
)

backends/arm/test/ops/test_max_pool.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,7 @@ def test_maxpool2d_tosa_u55_BI(
173173
(test_data,),
174174
)
175175
if conftest.is_option_enabled("corstone_fvp"):
176-
tester.run_method_and_compare_outputs(
177-
qtol=1, inputs=(test_data,), target_board="corstone-300"
178-
)
176+
tester.run_method_and_compare_outputs(qtol=1, inputs=(test_data,))
179177

180178
@parameterized.expand(test_data_suite)
181179
@pytest.mark.corstone_fvp
@@ -191,9 +189,7 @@ def test_maxpool2d_tosa_u85_BI(
191189
(test_data,),
192190
)
193191
if conftest.is_option_enabled("corstone_fvp"):
194-
tester.run_method_and_compare_outputs(
195-
qtol=1, inputs=(test_data,), target_board="corstone-320"
196-
)
192+
tester.run_method_and_compare_outputs(qtol=1, inputs=(test_data,))
197193

198194
@parameterized.expand(test_data_suite_mult_batches)
199195
def test_maxpool2d_tosa_MI_mult_batches(
@@ -232,9 +228,7 @@ def test_maxpool2d_tosa_u55_BI_mult_batches(
232228
(test_data,),
233229
)
234230
if conftest.is_option_enabled("corstone_fvp"):
235-
tester.run_method_and_compare_outputs(
236-
qtol=1, inputs=(test_data,), target_board="corstone-300"
237-
)
231+
tester.run_method_and_compare_outputs(qtol=1, inputs=(test_data,))
238232

239233
@parameterized.expand(test_data_suite_mult_batches)
240234
@pytest.mark.corstone_fvp
@@ -251,6 +245,4 @@ def test_maxpool2d_tosa_u85_BI_mult_batches(
251245
(test_data,),
252246
)
253247
if conftest.is_option_enabled("corstone_fvp"):
254-
tester.run_method_and_compare_outputs(
255-
qtol=1, inputs=(test_data,), target_board="corstone-320"
256-
)
248+
tester.run_method_and_compare_outputs(qtol=1, inputs=(test_data,))

backends/arm/test/ops/test_maximum.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ def test_maximum_u55_BI(self, operand1: torch.Tensor, operand2: torch.Tensor):
121121
self.Maximum(), common.get_u55_compile_spec(), test_data
122122
)
123123
if conftest.is_option_enabled("corstone_fvp"):
124-
tester.run_method_and_compare_outputs(
125-
qtol=1, inputs=test_data, target_board="corstone-300"
126-
)
124+
tester.run_method_and_compare_outputs(qtol=1, inputs=test_data)
127125

128126
@parameterized.expand(Maximum.test_parameters)
129127
def test_maximum_u85_BI(self, operand1: torch.Tensor, operand2: torch.Tensor):
@@ -132,6 +130,4 @@ def test_maximum_u85_BI(self, operand1: torch.Tensor, operand2: torch.Tensor):
132130
self.Maximum(), common.get_u85_compile_spec(), test_data
133131
)
134132
if conftest.is_option_enabled("corstone_fvp"):
135-
tester.run_method_and_compare_outputs(
136-
qtol=1, inputs=test_data, target_board="corstone-320"
137-
)
133+
tester.run_method_and_compare_outputs(qtol=1, inputs=test_data)

backends/arm/test/ops/test_minimum.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ def test_minimum_u55_BI(self, operand1: torch.Tensor, operand2: torch.Tensor):
121121
self.Minimum(), common.get_u55_compile_spec(), test_data
122122
)
123123
if conftest.is_option_enabled("corstone_fvp"):
124-
tester.run_method_and_compare_outputs(
125-
qtol=1, inputs=test_data, target_board="corstone-300"
126-
)
124+
tester.run_method_and_compare_outputs(qtol=1, inputs=test_data)
127125

128126
@parameterized.expand(Minimum.test_parameters)
129127
def test_minimum_u85_BI(self, operand1: torch.Tensor, operand2: torch.Tensor):
@@ -133,5 +131,6 @@ def test_minimum_u85_BI(self, operand1: torch.Tensor, operand2: torch.Tensor):
133131
)
134132
if conftest.is_option_enabled("corstone_fvp"):
135133
tester.run_method_and_compare_outputs(
136-
qtol=1, inputs=test_data, target_board="corstone-320"
134+
qtol=1,
135+
inputs=test_data,
137136
)

0 commit comments

Comments
 (0)