From 26e4aaf54e475f724399343dbb1f917279a9ecfe Mon Sep 17 00:00:00 2001 From: Gregory James Comer Date: Wed, 10 Sep 2025 16:09:36 -0700 Subject: [PATCH] Update [ghstack-poisoned] --- backends/test/suite/flows/vulkan.py | 2 +- backends/test/suite/models/__init__.py | 4 +++- backends/test/suite/operators/__init__.py | 4 +++- backends/test/suite/runner.py | 21 ++++++++++++++++++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/backends/test/suite/flows/vulkan.py b/backends/test/suite/flows/vulkan.py index fffcfdd69cf..a3a4fb55aba 100644 --- a/backends/test/suite/flows/vulkan.py +++ b/backends/test/suite/flows/vulkan.py @@ -20,7 +20,7 @@ def _create_vulkan_flow_base( tester_factory=VulkanTester, quantize=quantize_stage_factory is not None, quantize_stage_factory=quantize_stage_factory, - skip_patterns=["float16", "float64"], # Not supported in swiftshader + skip_patterns=["float16", "float64"], # Not supported in swiftshader ) diff --git a/backends/test/suite/models/__init__.py b/backends/test/suite/models/__init__.py index a6775dd8246..ea44275a463 100644 --- a/backends/test/suite/models/__init__.py +++ b/backends/test/suite/models/__init__.py @@ -53,7 +53,9 @@ def wrapped_test(self): } with TestContext(test_name, test_func.__name__, flow.name, params): if flow.should_skip_test(test_name): - raise unittest.SkipTest(f"Skipping test due to matching flow {flow.name} skip patterns") + raise unittest.SkipTest( + f"Skipping test due to matching flow {flow.name} skip patterns" + ) test_func(self, flow, dtype, use_dynamic_shapes) diff --git a/backends/test/suite/operators/__init__.py b/backends/test/suite/operators/__init__.py index 464eb1aaf55..9c550b3a49c 100644 --- a/backends/test/suite/operators/__init__.py +++ b/backends/test/suite/operators/__init__.py @@ -98,7 +98,9 @@ def _make_wrapped_test( def wrapped_test(self): with TestContext(test_name, test_base_name, flow.name, params): if flow.should_skip_test(test_name): - raise unittest.SkipTest(f"Skipping test due to matching flow {flow.name} skip patterns") + raise unittest.SkipTest( + f"Skipping test due to matching flow {flow.name} skip patterns" + ) test_kwargs = copy.copy(params) or {} test_kwargs["flow"] = flow diff --git a/backends/test/suite/runner.py b/backends/test/suite/runner.py index 3729d94cdf3..c5ca5e1298c 100644 --- a/backends/test/suite/runner.py +++ b/backends/test/suite/runner.py @@ -35,6 +35,7 @@ TestResult, ) from executorch.exir import EdgeProgramManager +from executorch.exir.dialects._ops import ops as exir_ops # A list of all runnable test suites and the corresponding python package. @@ -44,6 +45,24 @@ } +def _graph_has_unsupported_patterns(program: torch.export.ExportedProgram) -> bool: + # Returns true if the model contains patterns that will fail when running on the ET + # portable kernel library. + + # Check for 3d convolutions. All convs (1d, 2d, 3d) use the same op, so we need to look at + # the input meta to determine the rank. + for node in program.graph.nodes: + if ( + node.op == "call_function" + and node.target == exir_ops.edge.aten.convolution.default + ): + in_rank = node.args[0].meta["val"].dim() + if in_rank != 4: + return True + + return False + + def _get_test_seed(test_base_name: str) -> int: # Set the seed based on the test base name to give consistent inputs between backends. Add the # run seed to allow for reproducible results, but still allow for run-to-run variation. @@ -163,7 +182,7 @@ def build_result( # Check if any undelegated ops are in the unsupported ops set. has_unsupported_ops = any( op in UNSUPPORTED_PORTABLE_OPS for op in undelegated_op_counts.keys() - ) + ) or _graph_has_unsupported_patterns(edge_manager._etrecord.edge_dialect_program) # Skip the test if there are unsupported portable ops remaining. if has_unsupported_ops: