From c60b7d288e248650391cf3d72eb300d225430c6f Mon Sep 17 00:00:00 2001 From: Digant Desai Date: Thu, 8 May 2025 21:56:00 -0700 Subject: [PATCH] Arm Backend: Use tosa_ref_model only if it is avaiable (#10778) Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/10778 As Title Reviewed By: kirklandsign Differential Revision: D74420616 --- backends/arm/test/conftest.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/backends/arm/test/conftest.py b/backends/arm/test/conftest.py index 2d247f7bd42..936a4f64a10 100644 --- a/backends/arm/test/conftest.py +++ b/backends/arm/test/conftest.py @@ -44,10 +44,20 @@ def pytest_configure(config): if getattr(config.option, "fast_fvp", False): pytest._test_options["fast_fvp"] = config.option.fast_fvp # type: ignore[attr-defined] + pytest._test_options["tosa_version"] = "0.80" # type: ignore[attr-defined] if config.option.arm_run_tosa_version: pytest._test_options["tosa_version"] = config.option.arm_run_tosa_version - pytest._test_options["tosa_ref_model"] = True # type: ignore[attr-defined] + # Not all deployments of ET have the TOSA reference model available. + # Make sure we don't try to use it if it's not available. + try: + if pytest._test_options["tosa_version"] == "0.80": + import tosa_tools.v0_80.tosa_reference_model as tosa_reference_model + else: + import tosa_tools.tosa_ref_model as tosa_reference_model + except ImportError: + pytest._test_options["tosa_ref_model"] = False # type: ignore[attr-defined] + tosa_reference_model = None # noqa logging.basicConfig(level=logging.INFO, stream=sys.stdout)