Skip to content

Commit 3ef7cc1

Browse files
authored
[Backend Tester] Add flow-specific skipped tests, skip argmin/max on Core ML due to native crashes, float16/64 on Vulkan (#13992)
Argmin and argmax are crashing on Core ML. Native crashes are hard to recover from. In the medium term, I'd like to look at using pytest-xdist, which, by nature of process isolation, can recover. But for now, I'm adding a way to skip tests on specific backend flows to allow running the remaining tests. I've also skipped Vulkan float16 and float64 tests, as they crash when using swiftshader (used in the CI for software execution of the Vulkan compute shaders). This should be re-visited in the future. There is also a little technical debt in the code duplication between operator and model tests. This will also be cleaned up shortly.
1 parent 8572720 commit 3ef7cc1

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

backends/test/suite/flow.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22

3-
from dataclasses import dataclass
3+
from dataclasses import dataclass, field
44
from typing import Callable
55

66
from executorch.backends.test.harness import Tester
@@ -35,6 +35,12 @@ class TestFlow:
3535
is_delegated: bool = True
3636
""" Indicates whether the flow is expected to generate CALL_DELEGATE nodes. """
3737

38+
skip_patterns: list[str] = field(default_factory=lambda: [])
39+
""" Tests with names containing any substrings in this list are skipped. """
40+
41+
def should_skip_test(self, test_name: str) -> bool:
42+
return any(pattern in test_name for pattern in self.skip_patterns)
43+
3844

3945
def all_flows() -> dict[str, TestFlow]:
4046
flows = []

backends/test/suite/flows/coreml.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def _create_coreml_flow(
1919
CoreMLTester, minimum_deployment_target=minimum_deployment_target
2020
),
2121
quantize=quantize,
22+
skip_patterns=["test_argmin", "test_argmax"],
2223
)
2324

2425

backends/test/suite/flows/vulkan.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def _create_vulkan_flow_base(
2020
tester_factory=VulkanTester,
2121
quantize=quantize_stage_factory is not None,
2222
quantize_stage_factory=quantize_stage_factory,
23+
skip_patterns=["float16", "float64"], # Not supported in swiftshader
2324
)
2425

2526

backends/test/suite/models/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ def wrapped_test(self):
5252
"use_dynamic_shapes": use_dynamic_shapes,
5353
}
5454
with TestContext(test_name, test_func.__name__, flow.name, params):
55+
if flow.should_skip_test(test_name):
56+
raise unittest.SkipTest(
57+
f"Skipping test due to matching flow {flow.name} skip patterns"
58+
)
59+
5560
test_func(self, flow, dtype, use_dynamic_shapes)
5661

5762
wrapped_test._name = test_func.__name__ # type: ignore

backends/test/suite/operators/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ def _make_wrapped_test(
9797
):
9898
def wrapped_test(self):
9999
with TestContext(test_name, test_base_name, flow.name, params):
100+
if flow.should_skip_test(test_name):
101+
raise unittest.SkipTest(
102+
f"Skipping test due to matching flow {flow.name} skip patterns"
103+
)
104+
100105
test_kwargs = copy.copy(params) or {}
101106
test_kwargs["flow"] = flow
102107

0 commit comments

Comments
 (0)