Skip to content

Commit 5e39f74

Browse files
Erik-LundellYIWENX14
authored andcommitted
[Arm backend] Refactor runner_utils, removing RunnerUtil (#7722)
As the execution of models on reference_model or on FVP has simplified, there is no longer need for a class to handle the execution. Instead, running a model should should only be a function call with the model, inputs and some metadata. This makes it easier to reuse runner_utils.
1 parent 731f494 commit 5e39f74

File tree

8 files changed

+202
-421
lines changed

8 files changed

+202
-421
lines changed

backends/arm/test/common.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,3 @@ def get_u85_compile_spec_unbuilt(
145145
.dump_intermediate_artifacts_to(artifact_path)
146146
)
147147
return compile_spec
148-
149-
150-
def get_target_board(compile_spec: list[CompileSpec]) -> str | None:
151-
for spec in compile_spec:
152-
if spec.key == "compile_flags":
153-
flags = spec.value.decode()
154-
if "u55" in flags:
155-
return "corstone-300"
156-
elif "u85" in flags:
157-
return "corstone-320"
158-
return None

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)