Skip to content

Commit d3ff5d0

Browse files
committed
[ExecuTorch] Arm Ethos: Add Linear operator tests
Pull Request resolved: #8663 As title. ghstack-source-id: 268685731 @exported-using-ghexport Differential Revision: [D70018299](https://our.internmc.facebook.com/intern/diff/D70018299/)
1 parent d651dcd commit d3ff5d0

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

backends/arm/test/ops/test_linear.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def forward(self, x):
127127
def _test_linear_tosa_MI_pipeline(
128128
self, module: torch.nn.Module, test_data: Tuple[torch.Tensor]
129129
):
130-
(
130+
tester = (
131131
ArmTester(
132132
module,
133133
example_inputs=test_data,
@@ -141,13 +141,14 @@ def _test_linear_tosa_MI_pipeline(
141141
.to_edge_transform_and_lower()
142142
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
143143
.to_executorch()
144-
.run_method_and_compare_outputs(inputs=test_data)
145144
)
145+
if conftest.is_option_enabled("tosa_ref_model"):
146+
tester.run_method_and_compare_outputs(inputs=test_data)
146147

147148
def _test_linear_tosa_BI_pipeline(
148149
self, module: torch.nn.Module, test_data: Tuple[torch.Tensor]
149150
):
150-
(
151+
tester = (
151152
ArmTester(
152153
module,
153154
example_inputs=test_data,
@@ -162,8 +163,9 @@ def _test_linear_tosa_BI_pipeline(
162163
.to_edge_transform_and_lower()
163164
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
164165
.to_executorch()
165-
.run_method_and_compare_outputs(inputs=test_data, qtol=1)
166166
)
167+
if conftest.is_option_enabled("tosa_ref_model"):
168+
tester.run_method_and_compare_outputs(inputs=test_data, qtol=1)
167169

168170
def _test_linear_tosa_ethosu_BI_pipeline(
169171
self,
@@ -186,9 +188,11 @@ def _test_linear_tosa_ethosu_BI_pipeline(
186188
.to_executorch()
187189
.serialize()
188190
)
191+
# TODO: Add FVP testing support.
189192
return tester
190193

191194
@parameterized.expand(test_data_suite_rank1 + test_data_suite_rank4)
195+
@pytest.mark.tosa_ref_model
192196
def test_linear_tosa_MI(
193197
self,
194198
test_name: str,
@@ -208,6 +212,7 @@ def test_linear_tosa_MI(
208212
)
209213

210214
@parameterized.expand(test_data_suite_rank1 + test_data_suite_rank4)
215+
@pytest.mark.tosa_ref_model
211216
def test_linear_tosa_BI(
212217
self,
213218
test_name: str,
@@ -249,6 +254,7 @@ def test_linear_tosa_u55_BI(
249254
tester.run_method_and_compare_outputs(qtol=1, inputs=test_data)
250255

251256
@parameterized.expand(test_data_suite_rank1 + test_data_suite_rank4)
257+
@pytest.mark.corstone_fvp
252258
def test_linear_tosa_u85_BI(
253259
self,
254260
test_name: str,

backends/arm/test/targets.bzl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ load("@bazel_skylib//lib:paths.bzl", "paths")
44

55
def define_arm_tests():
66
# TODO Add more tests
7-
test_files = native.glob(["passes/test_*.py"])
7+
test_files = []
88

9+
# Passes
10+
test_files += native.glob(["passes/test_*.py"])
911
# https://github.com/pytorch/executorch/issues/8606
1012
test_files.remove("passes/test_ioquantization_pass.py")
1113

14+
# Operators
15+
test_files += native.glob(["ops/test_linear.py"])
16+
1217
TESTS = {}
1318

1419
for test_file in test_files:
@@ -26,8 +31,8 @@ def define_arm_tests():
2631
"//executorch/kernels/quantized:custom_ops_generated_lib",
2732
],
2833
deps = [
29-
":arm_tester",
30-
":conftest",
34+
"//executorch/backends/arm/test:arm_tester",
35+
"//executorch/backends/arm/test:conftest",
3136
"//executorch/exir:lib",
3237
"fbsource//third-party/pypi/pytest:pytest",
3338
"fbsource//third-party/pypi/parameterized:parameterized",

0 commit comments

Comments
 (0)