From 73c492bc80923948b3a8e80be7c1e7095cf00f70 Mon Sep 17 00:00:00 2001 From: Max Ren Date: Mon, 7 Apr 2025 17:04:33 -0700 Subject: [PATCH 1/2] Update [ghstack-poisoned] --- CMakeLists.txt | 4 ++++ pytest.ini | 2 -- runtime/executor/test/CMakeLists.txt | 20 ++++++++++++++++++++ setup.py | 1 + tools/cmake/cmake_deps.toml | 14 ++++++++++++++ 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dbb66afdaa..1ac7de469b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -810,6 +810,10 @@ if(EXECUTORCH_BUILD_PYBIND) torch ) + if(EXECUTORCH_BUILD_TESTS) + list(APPEND _dep_libs test_backend_compiler_lib) + endif() + if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED) list(APPEND _dep_libs optimized_native_cpu_ops_lib) else() diff --git a/pytest.ini b/pytest.ini index cd647c43a1c..8c661aa9ee4 100644 --- a/pytest.ini +++ b/pytest.ini @@ -63,8 +63,6 @@ addopts = --ignore=exir/backend/test/demos --ignore=exir/backend/test/test_backends.py --ignore=exir/backend/test/test_backends_lifted.py - --ignore=exir/backend/test/test_compatibility.py - --ignore=exir/backend/test/test_lowered_backend_module.py --ignore=exir/backend/test/test_partitioner.py --ignore=exir/tests/test_common.py --ignore=exir/tests/test_memory_format_ops_pass_aten.py diff --git a/runtime/executor/test/CMakeLists.txt b/runtime/executor/test/CMakeLists.txt index 2de32c9176a..3003a5d2c74 100644 --- a/runtime/executor/test/CMakeLists.txt +++ b/runtime/executor/test/CMakeLists.txt @@ -152,3 +152,23 @@ target_include_directories( PRIVATE "${CMAKE_INSTALL_PREFIX}/schema/include" "${EXECUTORCH_ROOT}/third-party/flatbuffers/include" ) + +list(TRANSFORM _test_backend_compiler_lib__srcs PREPEND "${EXECUTORCH_ROOT}/") +add_library( + test_backend_compiler_lib + STATIC + ${_test_backend_compiler_lib__srcs} +) + +target_link_libraries( + test_backend_compiler_lib + PUBLIC + executorch_core +) + +target_link_options_shared_lib(test_backend_compiler_lib) + +install( + TARGETS test_backend_compiler_lib + DESTINATION lib +) diff --git a/setup.py b/setup.py index 44fb9a712a3..e29ce76ff7e 100644 --- a/setup.py +++ b/setup.py @@ -718,6 +718,7 @@ def run(self): # enabled. TODO(dbort): Remove this override once this option is # managed by cmake itself. "-DEXECUTORCH_SEPARATE_FLATCC_HOST_PROJECT=OFF", + "-DEXECUTORCH_BUILD_TESTS=ON", ] build_args = [f"-j{self.parallel}"] diff --git a/tools/cmake/cmake_deps.toml b/tools/cmake/cmake_deps.toml index ee810c2bfd5..9913a02c4d5 100644 --- a/tools/cmake/cmake_deps.toml +++ b/tools/cmake/cmake_deps.toml @@ -150,6 +150,20 @@ deps = [ "optimized_cpublas", "portable_kernels", ] + +[targets.test_backend_compiler_lib] +buck_targets = [ + "//runtime/executor/test:test_backend_compiler_lib", +] +filters = [ + ".cpp$", +] +excludes = [ +] +deps = [ + "executorch", + "executorch_core", +] # ---------------------------------- core end ---------------------------------- # ---------------------------------- extension start ---------------------------------- [targets.extension_data_loader] From 13409b0584e5e229d35f97a1adb2871af9c5563b Mon Sep 17 00:00:00 2001 From: Max Ren Date: Mon, 7 Apr 2025 18:08:28 -0700 Subject: [PATCH 2/2] Update [ghstack-poisoned] --- exir/backend/test/test_lowered_backend_module.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/exir/backend/test/test_lowered_backend_module.py b/exir/backend/test/test_lowered_backend_module.py index dcc5841bc3e..6cdaf92b3d2 100644 --- a/exir/backend/test/test_lowered_backend_module.py +++ b/exir/backend/test/test_lowered_backend_module.py @@ -22,7 +22,6 @@ from executorch.extension.pybindings.portable_lib import ( # @manual _load_for_executorch_from_buffer, ) -from hypothesis import given, settings, strategies as st from torch.export import export @@ -65,7 +64,6 @@ def forward(self, *args): .executorch_program ) - @settings(deadline=500000) def test_emit_lowered_backend_module_end_to_end(self): class SinModule(torch.nn.Module): def __init__(self): @@ -109,11 +107,7 @@ def forward(self, x): torch.allclose(model_outputs[0], expected_res, atol=1e-03, rtol=1e-03) ) - @given( - unlift=st.booleans(), # verify both lifted and unlifted graph - ) - @settings(deadline=500000) - def test_emit_lowered_backend_module(self, unlift): + def test_emit_lowered_backend_module(self): module_list = [ models.Emformer(), models.Repeat(), @@ -166,11 +160,7 @@ def test_emit_lowered_backend_module(self, unlift): _ = lowered_model.buffer() self.validate_lowered_module_program(program) - @given( - unlift=st.booleans(), # verify both lifted and unlifted graph - ) - @settings(deadline=500000) - def test_emit_nested_lowered_backend_module(self, unlift): + def test_emit_nested_lowered_backend_module(self): module_list = [ models.Emformer(), models.Repeat(),