Skip to content

Commit d02a499

Browse files
Arm backend: Renamed testing suite (pytorch#16361)
Renamed all tests in the ARM test suite to follow ARM test naming convention. Signed-off-by: Michiel Olieslagers <michiel.olieslagers@arm.com>
1 parent 2abce02 commit d02a499

113 files changed

Lines changed: 528 additions & 548 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎backends/arm/test/misc/test_bn_relu_folding_qat.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def forward(self, x: torch.Tensor):
108108
"test_data",
109109
models,
110110
)
111-
def test_qat_tosa_INT(test_data):
111+
def test_bn_relu_folding_qat_tosa_INT(test_data):
112112
model, per_channel = test_data
113113
pipeline = TosaPipelineINT[input_t1](model, model.test_data, [], [], qtol=1)
114114
quantizer = TOSAQuantizer(TosaSpecification.create_from_string("TOSA-1.0+INT"))

‎backends/arm/test/misc/test_call_operator_submodule.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _false_branch(arg: torch.Tensor) -> torch.Tensor:
5151
return torch.cond(predicate, _true_branch, _false_branch, [x])
5252

5353

54-
def test_call_operator_runs_once_for_cond_submodules() -> None:
54+
def test_call_operator_runs_once_for_cond_submodules_tosa_FP() -> None:
5555
module = _CondModule()
5656
example_inputs = (torch.randn(2, 3),)
5757
exported = torch.export.export(module, example_inputs)

‎backends/arm/test/misc/test_compile_spec.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
# Copyright 2025 Arm Limited and/or its affiliates.
2+
#
3+
# This source code is licensed under the BSD-style license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
16
from executorch.backends.arm.ethosu import EthosUCompileSpec
27
from executorch.backends.arm.tosa.compile_spec import TosaCompileSpec
38
from executorch.backends.arm.vgf import VgfCompileSpec
49
from pytest import raises
510

611

7-
def test_ethos_u_compile_spec():
12+
def test_ethos_u_compile_spec_no_target():
813
compile_spec = (
914
EthosUCompileSpec("ethos-u55", extra_flags=["--my-flag"])
1015
.dump_intermediate_artifacts_to("my_path")
@@ -23,7 +28,7 @@ def test_ethos_u_compile_spec():
2328
EthosUCompileSpec.from_list(spec_list)
2429

2530

26-
def test_vgf_compile_spec():
31+
def test_vgf_compile_spec_no_target():
2732
compile_spec = (
2833
VgfCompileSpec(compiler_flags=["--my-flag"])
2934
.dump_intermediate_artifacts_to("my_path")
@@ -41,7 +46,7 @@ def test_vgf_compile_spec():
4146
EthosUCompileSpec.from_list(spec_list)
4247

4348

44-
def test_tosa_compile_spec():
49+
def test_tosa_compile_spec_no_target():
4550
compile_spec = TosaCompileSpec("TOSA-1.0+INT")
4651
spec_list = compile_spec.to_list()
4752

‎backends/arm/test/misc/test_conv_relu_residual_add.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def forward(self, x):
5151
}
5252

5353

54-
def test_tosa_FP():
54+
def test_conv_relu_residual_add_tosa_FP():
5555
pipeline = TosaPipelineFP[input_t](
5656
model,
5757
model_inputs,
@@ -63,7 +63,7 @@ def test_tosa_FP():
6363

6464

6565
@common.parametrize("per_channel_quantization", quant_test_data)
66-
def test_tosa_INT(per_channel_quantization):
66+
def test_conv_relu_residual_add_tosa_INT(per_channel_quantization):
6767
pipeline = TosaPipelineINT[input_t](
6868
model,
6969
model_inputs,
@@ -86,7 +86,7 @@ def test_tosa_INT(per_channel_quantization):
8686
@pytest.mark.slow
8787
@common.XfailIfNoCorstone300
8888
@common.parametrize("per_channel_quantization", quant_test_data)
89-
def test_tosa_u55_INT(per_channel_quantization):
89+
def test_conv_relu_residual_add_u55_INT(per_channel_quantization):
9090
pipeline = EthosU55PipelineINT[input_t](
9191
model,
9292
model_inputs,
@@ -102,7 +102,7 @@ def test_tosa_u55_INT(per_channel_quantization):
102102
@pytest.mark.slow
103103
@common.XfailIfNoCorstone320
104104
@common.parametrize("per_channel_quantization", quant_test_data)
105-
def test_tosa_u85_INT(per_channel_quantization):
105+
def test_conv_relu_residual_add_u85_INT(per_channel_quantization):
106106
pipeline = EthosU85PipelineINT[input_t](
107107
model,
108108
model_inputs,

‎backends/arm/test/misc/test_custom_partition.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def forward(self, x: torch.Tensor, y: torch.Tensor):
4646

4747

4848
@common.parametrize("test_data", CustomPartitioning.inputs)
49-
def test_single_reject(caplog, test_data: input_t1):
49+
def test_single_reject_tosa_FP(caplog, test_data: input_t1):
5050
caplog.set_level(logging.INFO)
5151

5252
module = CustomPartitioning()
@@ -66,7 +66,7 @@ def test_single_reject(caplog, test_data: input_t1):
6666

6767

6868
@common.parametrize("test_data", CustomPartitioning.inputs)
69-
def test_multiple_reject(test_data: input_t1):
69+
def test_multiple_reject_tosa_FP(test_data: input_t1):
7070
module = CustomPartitioning()
7171
pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[])
7272
check = DontPartition(
@@ -85,7 +85,7 @@ def test_multiple_reject(test_data: input_t1):
8585

8686

8787
@common.parametrize("test_data", CustomPartitioning.inputs)
88-
def test_torch_op_reject(caplog, test_data: input_t1):
88+
def test_torch_op_reject_tosa_FP(caplog, test_data: input_t1):
8989
caplog.set_level(logging.INFO)
9090

9191
module = CustomPartitioning()
@@ -105,7 +105,7 @@ def test_torch_op_reject(caplog, test_data: input_t1):
105105

106106

107107
@common.parametrize("test_data", CustomPartitioning.inputs)
108-
def test_string_op_reject(test_data: input_t1):
108+
def test_string_op_reject_tosa_FP(test_data: input_t1):
109109
module = CustomPartitioning()
110110
check = DontPartition("aten.sigmoid.default")
111111
pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[])
@@ -122,7 +122,7 @@ def test_string_op_reject(test_data: input_t1):
122122

123123

124124
@common.parametrize("test_data", CustomPartitioning.inputs)
125-
def test_name_reject(caplog, test_data: input_t1):
125+
def test_name_reject_tosa_FP(caplog, test_data: input_t1):
126126
caplog.set_level(logging.INFO)
127127

128128
module = CustomPartitioning()
@@ -139,7 +139,7 @@ def test_name_reject(caplog, test_data: input_t1):
139139

140140

141141
@common.parametrize("test_data", CustomPartitioning.inputs)
142-
def test_module_reject(test_data: input_t1):
142+
def test_module_reject_tosa_FP(test_data: input_t1):
143143
module = NestedModule()
144144
check = DontPartitionModule(module_name="CustomPartitioning")
145145
pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[])
@@ -153,7 +153,7 @@ def test_module_reject(test_data: input_t1):
153153

154154

155155
@common.parametrize("test_data", CustomPartitioning.inputs)
156-
def test_inexact_module_reject(caplog, test_data: input_t1):
156+
def test_inexact_module_reject_tosa_FP(caplog, test_data: input_t1):
157157
caplog.set_level(logging.INFO)
158158

159159
module = NestedModule()
@@ -170,7 +170,7 @@ def test_inexact_module_reject(caplog, test_data: input_t1):
170170

171171

172172
@common.parametrize("test_data", CustomPartitioning.inputs)
173-
def test_module_instance_reject(test_data: input_t1):
173+
def test_module_instance_reject_tosa_FP(test_data: input_t1):
174174
module = NestedModule()
175175
check = DontPartitionModule(instance_name="nested")
176176
pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[])

‎backends/arm/test/misc/test_debug_feats.py‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ def _is_tosa_marker_in_file(tmp_file):
7777

7878

7979
@common.parametrize("test_data", Linear.inputs)
80-
def test_FP_artifact(test_data: input_t1):
80+
def test_artifact_tosa_FP(test_data: input_t1):
8181
model = Linear()
8282
tmp_file = common.get_time_formatted_path(
83-
tempfile.mkdtemp(), test_FP_artifact.__name__
83+
tempfile.mkdtemp(), test_artifact_tosa_FP.__name__
8484
)
8585
_tosa_FP_pipeline(model, test_data, dump_file=tmp_file)
8686
assert os.path.exists(tmp_file), f"File {tmp_file} was not created"
@@ -90,10 +90,10 @@ def test_FP_artifact(test_data: input_t1):
9090

9191

9292
@common.parametrize("test_data", Linear.inputs)
93-
def test_INT_artifact(test_data: input_t1):
93+
def test_artifact_tosa_INT(test_data: input_t1):
9494
model = Linear()
9595
tmp_file = common.get_time_formatted_path(
96-
tempfile.mkdtemp(), test_INT_artifact.__name__
96+
tempfile.mkdtemp(), test_artifact_tosa_INT.__name__
9797
)
9898
_tosa_INT_pipeline(model, test_data, dump_file=tmp_file)
9999
assert os.path.exists(tmp_file), f"File {tmp_file} was not created"
@@ -106,7 +106,7 @@ def test_INT_artifact(test_data: input_t1):
106106

107107

108108
@common.parametrize("test_data", Linear.inputs)
109-
def test_numerical_diff_print(test_data: input_t1):
109+
def test_numerical_diff_print_tosa_INT(test_data: input_t1):
110110
aten_ops: list[str] = []
111111
exir_ops: list[str] = []
112112
pipeline = TosaPipelineINT[input_t1](
@@ -134,7 +134,7 @@ def test_numerical_diff_print(test_data: input_t1):
134134

135135

136136
@common.parametrize("test_data", Linear.inputs)
137-
def test_dump_ops_and_dtypes(test_data: input_t1):
137+
def test_dump_ops_and_dtypes_tosa_INT(test_data: input_t1):
138138
aten_ops: list[str] = []
139139
exir_ops: list[str] = []
140140
pipeline = TosaPipelineINT[input_t1](Linear(), test_data, aten_ops, exir_ops)
@@ -154,7 +154,7 @@ def test_dump_ops_and_dtypes(test_data: input_t1):
154154

155155

156156
@common.parametrize("test_data", Linear.inputs)
157-
def test_dump_ops_and_dtypes_parseable(test_data: input_t1):
157+
def test_dump_ops_and_dtypes_parseable_tosa_INT(test_data: input_t1):
158158
aten_ops: list[str] = []
159159
exir_ops: list[str] = []
160160
pipeline = TosaPipelineINT[input_t1](Linear(), test_data, aten_ops, exir_ops)
@@ -181,7 +181,7 @@ def test_dump_ops_and_dtypes_parseable(test_data: input_t1):
181181

182182

183183
@common.parametrize("test_data", Linear.inputs)
184-
def test_collate_tosa_INT_tests(test_data: input_t1):
184+
def test_collate_tests_tosa_INT(test_data: input_t1):
185185
# Set the environment variable to trigger the collation of TOSA tests
186186
os.environ["TOSA_TESTCASES_BASE_PATH"] = "test_collate_tosa_tests"
187187
# Clear out the directory
@@ -192,7 +192,7 @@ def test_collate_tosa_INT_tests(test_data: input_t1):
192192
pipeline.run()
193193

194194
test_collate_dir = (
195-
"test_collate_tosa_tests/tosa-int/test_collate_tosa_INT_tests[randn]"
195+
"test_collate_tosa_tests/tosa-int/test_collate_tests_tosa_INT[randn]"
196196
)
197197
# test that the output directory is created and contains the expected files
198198
assert os.path.exists(test_collate_dir)
@@ -205,7 +205,7 @@ def test_collate_tosa_INT_tests(test_data: input_t1):
205205

206206

207207
@common.parametrize("test_data", Linear.inputs)
208-
def test_dump_tosa_debug_json(test_data: input_t1):
208+
def test_dump_tosa_debug_json_tosa_INT(test_data: input_t1):
209209
with tempfile.TemporaryDirectory() as tmpdir:
210210
aten_ops: list[str] = []
211211
exir_ops: list[str] = []
@@ -238,7 +238,7 @@ def test_dump_tosa_debug_json(test_data: input_t1):
238238

239239

240240
@common.parametrize("test_data", Linear.inputs)
241-
def test_dump_tosa_debug_tosa(test_data: input_t1):
241+
def test_dump_tosa_debug_tosa_FP(test_data: input_t1):
242242
output_dir = "test_dump_tosa_debug"
243243

244244
aten_ops: list[str] = []
@@ -283,7 +283,7 @@ def test_dump_tosa_debug_tosa(test_data: input_t1):
283283

284284

285285
@common.parametrize("test_data", Linear.inputs)
286-
def test_dump_tosa_ops(capsys, test_data: input_t1):
286+
def test_dump_tosa_ops_tosa_INT(capsys, test_data: input_t1):
287287
aten_ops: list[str] = []
288288
exir_ops: list[str] = []
289289
pipeline = TosaPipelineINT[input_t1](Linear(), test_data, aten_ops, exir_ops)
@@ -304,7 +304,7 @@ def forward(self, x):
304304

305305
@common.parametrize("test_data", Add.inputs)
306306
@common.XfailIfNoCorstone300
307-
def test_fail_dump_tosa_ops(capsys, test_data: input_t1):
307+
def test_fail_dump_ops_u55_INT(capsys, test_data: input_t1):
308308
aten_ops: list[str] = []
309309
exir_ops: list[str] = []
310310
pipeline = EthosU55PipelineINT[input_t1](

‎backends/arm/test/misc/test_debug_hook.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def _compare_node_and_schema(debug_event: DebugSchema, mocked_node):
160160

161161

162162
@common.parametrize("test_data", TESTCASES)
163-
def test_debug_hook_add_json(test_data: DebugHookTestCase):
163+
def test_debug_hook_add_json_no_target(test_data: DebugHookTestCase):
164164
hook = DebugHook(ArmCompileSpec.DebugMode.JSON)
165165
hook.add(cast(Node, test_data.mock_node), test_data.tosa_op, test_data.op_id)
166166

@@ -173,7 +173,7 @@ def test_debug_hook_add_json(test_data: DebugHookTestCase):
173173

174174

175175
@common.parametrize("test_data", TESTCASES)
176-
def test_debug_hook_add_tosa(test_data: DebugHookTestCase):
176+
def test_debug_hook_add_tosa_no_target(test_data: DebugHookTestCase):
177177
hook = DebugHook(ArmCompileSpec.DebugMode.TOSA)
178178
hook.add(cast(Node, test_data.mock_node), test_data.tosa_op, test_data.op_id)
179179

‎backends/arm/test/misc/test_dw_convs_with_shared_weights.py‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
from typing import Any, Tuple
77

88
import torch
9-
from executorch.backends.arm._passes.rewrite_conv_pass import RewriteConvPass
109
from executorch.backends.arm.test.tester.test_pipeline import (
11-
PassPipeline,
1210
TosaPipelineFP,
1311
TosaPipelineINT,
1412
)
@@ -32,27 +30,17 @@ def get_inputs(self) -> input_t:
3230
return (torch.randn(1, 6, 24, 24),)
3331

3432

35-
def test_convs_tosa_fp():
33+
def test_convs_tosa_FP():
3634
module = DWConvsModule()
3735
pipeline = TosaPipelineFP[input_t](
3836
module, module.get_inputs(), aten_op=[], exir_op=[]
3937
)
4038
pipeline.run()
4139

4240

43-
def test_convs_tosa_int():
41+
def test_convs_tosa_INT():
4442
module = DWConvsModule()
4543
pipeline = TosaPipelineINT[input_t](
4644
module, module.get_inputs(), aten_op=[], exir_op=[]
4745
)
4846
pipeline.run()
49-
50-
51-
def test_rewrite_conv_pass():
52-
module = DWConvsModule()
53-
pipeline = PassPipeline(
54-
module, module.get_inputs(), passes_with_exported_program=[RewriteConvPass]
55-
)
56-
# We can't run TOSA backend dialect operators in eager mode
57-
pipeline.pop_stage("run_method_and_compare_outputs")
58-
pipeline.run()

‎backends/arm/test/misc/test_extract_io_params_tosa.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def forward(self, x, y):
4040
),
4141
],
4242
)
43-
def test_roundtrip_extracts_io_params(
43+
def test_roundtrip_extracts_io_params_tosa_INT(
4444
compile_spec_cls: type[TosaCompileSpec] | type[VgfCompileSpec],
4545
quantizer_cls,
4646
partitioner_cls,

‎backends/arm/test/misc/test_mixed_type_lowering.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def forward(self, x, y):
5353
return self.sigmoid(x + y) * x
5454

5555

56-
def test_mixed_type_lowering():
56+
def test_mixed_type_lowering_tosa_INT_FP():
5757
model = AddSigmoidMul()
5858
input_data = (torch.randn(1, 16, 16, 16), torch.randn(1, 16, 16, 16))
5959

0 commit comments

Comments
 (0)