From 1d669e16e2f6bec64efefa0c891605af885e8aee Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 5 May 2025 15:02:25 -0700 Subject: [PATCH 01/18] [CMake] Update extension/ deps executorch->executorch_core --- extension/data_loader/CMakeLists.txt | 2 +- tools/cmake/cmake_deps.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/extension/data_loader/CMakeLists.txt b/extension/data_loader/CMakeLists.txt index 0af3fbcc161..6779160bcaf 100644 --- a/extension/data_loader/CMakeLists.txt +++ b/extension/data_loader/CMakeLists.txt @@ -18,7 +18,7 @@ endif() list(TRANSFORM _extension_data_loader__srcs PREPEND "${EXECUTORCH_ROOT}/") add_library(extension_data_loader ${_extension_data_loader__srcs}) -target_link_libraries(extension_data_loader executorch) +target_link_libraries(extension_data_loader executorch_core) target_include_directories(extension_data_loader PUBLIC ${EXECUTORCH_ROOT}/..) target_compile_options(extension_data_loader PUBLIC ${_common_compile_options}) diff --git a/tools/cmake/cmake_deps.toml b/tools/cmake/cmake_deps.toml index 9913a02c4d5..2bfaf0b78b6 100644 --- a/tools/cmake/cmake_deps.toml +++ b/tools/cmake/cmake_deps.toml @@ -178,7 +178,6 @@ filters = [ ] deps = [ "executorch_core", - "executorch", ] [targets.extension_flat_tensor_schema] From 7e5aa83d219292c12bf4c58afc24686e3607925b Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 5 May 2025 15:15:03 -0700 Subject: [PATCH 02/18] test more --- extension/flat_tensor/CMakeLists.txt | 2 +- extension/llm/runner/CMakeLists.txt | 2 +- extension/runner_util/CMakeLists.txt | 2 +- tools/cmake/cmake_deps.toml | 8 ++------ 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/extension/flat_tensor/CMakeLists.txt b/extension/flat_tensor/CMakeLists.txt index caacd96b557..44cb7d236d4 100644 --- a/extension/flat_tensor/CMakeLists.txt +++ b/extension/flat_tensor/CMakeLists.txt @@ -18,7 +18,7 @@ endif() list(TRANSFORM _extension_flat_tensor__srcs PREPEND "${EXECUTORCH_ROOT}/") add_library(extension_flat_tensor ${_extension_flat_tensor__srcs}) -target_link_libraries(extension_flat_tensor executorch extension_data_loader) +target_link_libraries(extension_flat_tensor executorch_core extension_data_loader) target_include_directories( extension_flat_tensor PUBLIC ${EXECUTORCH_ROOT}/.. diff --git a/extension/llm/runner/CMakeLists.txt b/extension/llm/runner/CMakeLists.txt index e23f5c2c58d..4b481aac78a 100644 --- a/extension/llm/runner/CMakeLists.txt +++ b/extension/llm/runner/CMakeLists.txt @@ -43,7 +43,7 @@ target_include_directories( add_library(extension_llm_runner STATIC ${_extension_llm_runner__srcs}) -set(runner_deps executorch extension_data_loader extension_module +set(runner_deps executorch_core extension_data_loader extension_module extension_tensor ) diff --git a/extension/runner_util/CMakeLists.txt b/extension/runner_util/CMakeLists.txt index 19aa884fd77..3483b3babf3 100644 --- a/extension/runner_util/CMakeLists.txt +++ b/extension/runner_util/CMakeLists.txt @@ -18,7 +18,7 @@ endif() list(TRANSFORM _extension_runner_util__srcs PREPEND "${EXECUTORCH_ROOT}/") add_library(extension_runner_util ${_extension_runner_util__srcs}) -target_link_libraries(extension_runner_util executorch) +target_link_libraries(extension_runner_util executorch_core) target_include_directories(extension_runner_util PUBLIC ${EXECUTORCH_ROOT}/..) target_compile_options(extension_runner_util PUBLIC ${_common_compile_options}) diff --git a/tools/cmake/cmake_deps.toml b/tools/cmake/cmake_deps.toml index 2bfaf0b78b6..3a5f0061d40 100644 --- a/tools/cmake/cmake_deps.toml +++ b/tools/cmake/cmake_deps.toml @@ -196,9 +196,9 @@ filters = [ ".cpp$", ] deps = [ + "extension_data_loader", "extension_flat_tensor_schema", "executorch_core", - "executorch", ] [targets.extension_module] @@ -209,9 +209,9 @@ filters = [ ".cpp$", ] deps = [ - "executorch", "executorch_core", "extension_data_loader", + "extension_flat_tensor", ] [targets.extension_runner_util] @@ -222,7 +222,6 @@ filters = [ ".cpp$", ] deps = [ - "executorch", "executorch_core", ] @@ -234,7 +233,6 @@ filters = [ ".cpp$", ] deps = [ - "executorch", "executorch_core", "extension_module", "extension_runner_util", @@ -248,7 +246,6 @@ filters = [ ".cpp$", ] deps = [ - "executorch", "executorch_core", ] @@ -260,7 +257,6 @@ filters = [ ".cpp$", ] deps = [ - "executorch", "executorch_core", ] From db89e736fbd4faeeebced10d1aa7e80072c8c780 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 5 May 2025 15:34:52 -0700 Subject: [PATCH 03/18] Add deps --- extension/flat_tensor/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extension/flat_tensor/CMakeLists.txt b/extension/flat_tensor/CMakeLists.txt index 44cb7d236d4..b32c466c31a 100644 --- a/extension/flat_tensor/CMakeLists.txt +++ b/extension/flat_tensor/CMakeLists.txt @@ -18,7 +18,10 @@ endif() list(TRANSFORM _extension_flat_tensor__srcs PREPEND "${EXECUTORCH_ROOT}/") add_library(extension_flat_tensor ${_extension_flat_tensor__srcs}) -target_link_libraries(extension_flat_tensor executorch_core extension_data_loader) +target_link_libraries( + extension_flat_tensor executorch_core extension_data_loader + extension_flat_tensor_schema +) target_include_directories( extension_flat_tensor PUBLIC ${EXECUTORCH_ROOT}/.. From 4aaeacf75b45780d57864e5fc09e2ff947c0c68c Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 5 May 2025 15:50:57 -0700 Subject: [PATCH 04/18] Don't address flat_tensor yet --- extension/flat_tensor/CMakeLists.txt | 5 +---- tools/cmake/cmake_deps.toml | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/extension/flat_tensor/CMakeLists.txt b/extension/flat_tensor/CMakeLists.txt index b32c466c31a..caacd96b557 100644 --- a/extension/flat_tensor/CMakeLists.txt +++ b/extension/flat_tensor/CMakeLists.txt @@ -18,10 +18,7 @@ endif() list(TRANSFORM _extension_flat_tensor__srcs PREPEND "${EXECUTORCH_ROOT}/") add_library(extension_flat_tensor ${_extension_flat_tensor__srcs}) -target_link_libraries( - extension_flat_tensor executorch_core extension_data_loader - extension_flat_tensor_schema -) +target_link_libraries(extension_flat_tensor executorch extension_data_loader) target_include_directories( extension_flat_tensor PUBLIC ${EXECUTORCH_ROOT}/.. diff --git a/tools/cmake/cmake_deps.toml b/tools/cmake/cmake_deps.toml index 3a5f0061d40..6e94aeb0467 100644 --- a/tools/cmake/cmake_deps.toml +++ b/tools/cmake/cmake_deps.toml @@ -197,8 +197,7 @@ filters = [ ] deps = [ "extension_data_loader", - "extension_flat_tensor_schema", - "executorch_core", + "executorch", ] [targets.extension_module] From b4e56f3c9adbb9aa5b5235aae1918bd470e2b09d Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 5 May 2025 16:23:43 -0700 Subject: [PATCH 05/18] Try again --- extension/flat_tensor/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extension/flat_tensor/CMakeLists.txt b/extension/flat_tensor/CMakeLists.txt index caacd96b557..cd6640a204b 100644 --- a/extension/flat_tensor/CMakeLists.txt +++ b/extension/flat_tensor/CMakeLists.txt @@ -18,7 +18,10 @@ endif() list(TRANSFORM _extension_flat_tensor__srcs PREPEND "${EXECUTORCH_ROOT}/") add_library(extension_flat_tensor ${_extension_flat_tensor__srcs}) -target_link_libraries(extension_flat_tensor executorch extension_data_loader) +target_link_libraries( + extension_flat_tensor executorch_core extension_data_loader + flat_tensor_schema +) target_include_directories( extension_flat_tensor PUBLIC ${EXECUTORCH_ROOT}/.. From 792239c7f2930f618d902f8de6db5db0a374b532 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 5 May 2025 16:30:26 -0700 Subject: [PATCH 06/18] missing --- tools/cmake/cmake_deps.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/cmake/cmake_deps.toml b/tools/cmake/cmake_deps.toml index 77698fc02e7..bf1072dd920 100644 --- a/tools/cmake/cmake_deps.toml +++ b/tools/cmake/cmake_deps.toml @@ -196,6 +196,7 @@ filters = [ ".cpp$", ] deps = [ + "extension_flat_tensor_schema", "extension_data_loader", "executorch", ] From e1c7bfdbfcae164d43e1181766a14e756d3046bc Mon Sep 17 00:00:00 2001 From: Hansong <107070759+kirklandsign@users.noreply.github.com> Date: Mon, 5 May 2025 16:52:46 -0700 Subject: [PATCH 07/18] Update CMakeLists.txt --- extension/module/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extension/module/CMakeLists.txt b/extension/module/CMakeLists.txt index abf95f866f0..37d8acff1d5 100644 --- a/extension/module/CMakeLists.txt +++ b/extension/module/CMakeLists.txt @@ -27,7 +27,9 @@ if(CMAKE_TOOLCHAIN_IOS else() add_library(extension_module SHARED ${_extension_module__srcs}) endif() -target_link_libraries(extension_module PRIVATE executorch_core extension_data_loader extension_flat_tensor) +target_link_libraries(extension_module PRIVATE executorch_core extension_data_loader) +# Expose the header include path +target_link_libraries(extension_module PUBLIC extension_flat_tensor) target_include_directories(extension_module PUBLIC ${EXECUTORCH_ROOT}/..) target_compile_options( extension_module PUBLIC -Wno-deprecated-declarations -fPIC @@ -37,8 +39,10 @@ target_compile_options( # after cleaning up CMake targets. add_library(extension_module_static STATIC ${_extension_module__srcs}) target_link_libraries( - extension_module_static PRIVATE executorch_core extension_data_loader extension_flat_tensor + extension_module_static PRIVATE executorch_core extension_data_loader ) +# Expose the header include path +target_link_libraries(extension_module_static PUBLIC extension_flat_tensor) target_include_directories(extension_module_static PUBLIC ${EXECUTORCH_ROOT}/..) target_compile_options( extension_module_static PUBLIC -Wno-deprecated-declarations -fPIC From 7c07d5e427b4d3c4478253449172cf806f96c731 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 May 2025 11:42:49 -0700 Subject: [PATCH 08/18] module update --- extension/module/targets.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/module/targets.bzl b/extension/module/targets.bzl index d8019ce9c4e..78077df6387 100644 --- a/extension/module/targets.bzl +++ b/extension/module/targets.bzl @@ -28,6 +28,6 @@ def define_common_targets(): "//executorch/extension/flat_tensor:flat_tensor_data_map" + aten_suffix, ], exported_deps = [ - "//executorch/runtime/executor:program" + aten_suffix, + "//executorch/runtime/executor:program_no_prim_ops" + aten_suffix, ], ) From cd26efab825820db990dce0f28cc31a8cf610b29 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 May 2025 14:14:31 -0700 Subject: [PATCH 09/18] Fix --- extension/android/CMakeLists.txt | 1 + extension/module/CMakeLists.txt | 10 +++++----- tools/cmake/cmake_deps.toml | 6 +++++- tools/cmake/executorch-config.cmake | 1 + 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/extension/android/CMakeLists.txt b/extension/android/CMakeLists.txt index 3a1fe79d8f5..b2f7b8d9f47 100644 --- a/extension/android/CMakeLists.txt +++ b/extension/android/CMakeLists.txt @@ -72,6 +72,7 @@ list( link_libraries executorch extension_data_loader + extension_flat_tensor extension_module extension_runner_util extension_tensor diff --git a/extension/module/CMakeLists.txt b/extension/module/CMakeLists.txt index 37d8acff1d5..cd22f1ccfc2 100644 --- a/extension/module/CMakeLists.txt +++ b/extension/module/CMakeLists.txt @@ -27,9 +27,10 @@ if(CMAKE_TOOLCHAIN_IOS else() add_library(extension_module SHARED ${_extension_module__srcs}) endif() -target_link_libraries(extension_module PRIVATE executorch_core extension_data_loader) -# Expose the header include path -target_link_libraries(extension_module PUBLIC extension_flat_tensor) +target_link_libraries( + extension_module PRIVATE executorch_core extension_data_loader + extension_flat_tensor +) target_include_directories(extension_module PUBLIC ${EXECUTORCH_ROOT}/..) target_compile_options( extension_module PUBLIC -Wno-deprecated-declarations -fPIC @@ -40,9 +41,8 @@ target_compile_options( add_library(extension_module_static STATIC ${_extension_module__srcs}) target_link_libraries( extension_module_static PRIVATE executorch_core extension_data_loader + extension_flat_tensor ) -# Expose the header include path -target_link_libraries(extension_module_static PUBLIC extension_flat_tensor) target_include_directories(extension_module_static PUBLIC ${EXECUTORCH_ROOT}/..) target_compile_options( extension_module_static PUBLIC -Wno-deprecated-declarations -fPIC diff --git a/tools/cmake/cmake_deps.toml b/tools/cmake/cmake_deps.toml index bf1072dd920..80d462e7756 100644 --- a/tools/cmake/cmake_deps.toml +++ b/tools/cmake/cmake_deps.toml @@ -196,9 +196,9 @@ filters = [ ".cpp$", ] deps = [ + "executorch_core", "extension_flat_tensor_schema", "extension_data_loader", - "executorch", ] [targets.extension_module] @@ -234,6 +234,8 @@ filters = [ ] deps = [ "executorch_core", + "extension_data_loader", + "extension_flat_tensor", "extension_module", "extension_tensor", ] @@ -448,7 +450,9 @@ deps = [ "executorch", "executorch_core", "extension_data_loader", + "extension_flat_tensor", "extension_module", + "extension_tensor", "extension_threadpool", "optimized_cpublas", "portable_kernels", diff --git a/tools/cmake/executorch-config.cmake b/tools/cmake/executorch-config.cmake index 56c7fa2d7d4..a8e756fbb77 100644 --- a/tools/cmake/executorch-config.cmake +++ b/tools/cmake/executorch-config.cmake @@ -66,6 +66,7 @@ set(lib_list etdump bundled_program extension_data_loader + extension_flat_tensor ${FLATCCRT_LIB} coreml_util coreml_inmemoryfs From ef2fa9387d9627d77648e8be13502fb8bc23454a Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 May 2025 14:17:54 -0700 Subject: [PATCH 10/18] flat tensor doesn't dep on extension_data_loader --- extension/flat_tensor/CMakeLists.txt | 3 +-- tools/cmake/cmake_deps.toml | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/extension/flat_tensor/CMakeLists.txt b/extension/flat_tensor/CMakeLists.txt index cd6640a204b..67d2f40f51a 100644 --- a/extension/flat_tensor/CMakeLists.txt +++ b/extension/flat_tensor/CMakeLists.txt @@ -19,8 +19,7 @@ endif() list(TRANSFORM _extension_flat_tensor__srcs PREPEND "${EXECUTORCH_ROOT}/") add_library(extension_flat_tensor ${_extension_flat_tensor__srcs}) target_link_libraries( - extension_flat_tensor executorch_core extension_data_loader - flat_tensor_schema + extension_flat_tensor executorch_core ) target_include_directories( extension_flat_tensor diff --git a/tools/cmake/cmake_deps.toml b/tools/cmake/cmake_deps.toml index 80d462e7756..ad34a8d18e7 100644 --- a/tools/cmake/cmake_deps.toml +++ b/tools/cmake/cmake_deps.toml @@ -198,7 +198,6 @@ filters = [ deps = [ "executorch_core", "extension_flat_tensor_schema", - "extension_data_loader", ] [targets.extension_module] From f7cc7c3bf3177c186bb513663a7d628894dd125a Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 May 2025 14:18:36 -0700 Subject: [PATCH 11/18] linter --- extension/flat_tensor/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/extension/flat_tensor/CMakeLists.txt b/extension/flat_tensor/CMakeLists.txt index 67d2f40f51a..d44ed811805 100644 --- a/extension/flat_tensor/CMakeLists.txt +++ b/extension/flat_tensor/CMakeLists.txt @@ -18,9 +18,7 @@ endif() list(TRANSFORM _extension_flat_tensor__srcs PREPEND "${EXECUTORCH_ROOT}/") add_library(extension_flat_tensor ${_extension_flat_tensor__srcs}) -target_link_libraries( - extension_flat_tensor executorch_core -) +target_link_libraries(extension_flat_tensor executorch_core) target_include_directories( extension_flat_tensor PUBLIC ${EXECUTORCH_ROOT}/.. From 47f4082ec7c0a9749ef075cb8ba2f892eea6eab9 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 May 2025 14:42:54 -0700 Subject: [PATCH 12/18] [CMake] Avoid extension_module have dupe flat_tensor cpp Currently, _extension_module__srcs has srcs from flat_tensor. This is bad. ``` set(_extension_module__srcs extension/flat_tensor/flat_tensor_data_map.cpp extension/flat_tensor/serialize/flat_tensor_header.cpp extension/module/module.cpp ) ``` We need to update deps. We need to export extension_flat_tensor to install directory. --- extension/android/CMakeLists.txt | 1 + extension/flat_tensor/CMakeLists.txt | 2 +- tools/cmake/cmake_deps.toml | 3 +-- tools/cmake/executorch-config.cmake | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/extension/android/CMakeLists.txt b/extension/android/CMakeLists.txt index 3a1fe79d8f5..b2f7b8d9f47 100644 --- a/extension/android/CMakeLists.txt +++ b/extension/android/CMakeLists.txt @@ -72,6 +72,7 @@ list( link_libraries executorch extension_data_loader + extension_flat_tensor extension_module extension_runner_util extension_tensor diff --git a/extension/flat_tensor/CMakeLists.txt b/extension/flat_tensor/CMakeLists.txt index caacd96b557..d44ed811805 100644 --- a/extension/flat_tensor/CMakeLists.txt +++ b/extension/flat_tensor/CMakeLists.txt @@ -18,7 +18,7 @@ endif() list(TRANSFORM _extension_flat_tensor__srcs PREPEND "${EXECUTORCH_ROOT}/") add_library(extension_flat_tensor ${_extension_flat_tensor__srcs}) -target_link_libraries(extension_flat_tensor executorch extension_data_loader) +target_link_libraries(extension_flat_tensor executorch_core) target_include_directories( extension_flat_tensor PUBLIC ${EXECUTORCH_ROOT}/.. diff --git a/tools/cmake/cmake_deps.toml b/tools/cmake/cmake_deps.toml index 21cfde1bf23..7807235e91c 100644 --- a/tools/cmake/cmake_deps.toml +++ b/tools/cmake/cmake_deps.toml @@ -198,7 +198,6 @@ filters = [ deps = [ "extension_flat_tensor_schema", "executorch_core", - "executorch", ] [targets.extension_module] @@ -209,9 +208,9 @@ filters = [ ".cpp$", ] deps = [ - "executorch", "executorch_core", "extension_data_loader", + "extension_flat_tensor", ] [targets.extension_runner_util] diff --git a/tools/cmake/executorch-config.cmake b/tools/cmake/executorch-config.cmake index 56c7fa2d7d4..a8e756fbb77 100644 --- a/tools/cmake/executorch-config.cmake +++ b/tools/cmake/executorch-config.cmake @@ -66,6 +66,7 @@ set(lib_list etdump bundled_program extension_data_loader + extension_flat_tensor ${FLATCCRT_LIB} coreml_util coreml_inmemoryfs From c023c3738d1797d366de7cab4d6a197021b5b797 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 May 2025 14:46:53 -0700 Subject: [PATCH 13/18] propogate deps --- tools/cmake/cmake_deps.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/cmake/cmake_deps.toml b/tools/cmake/cmake_deps.toml index 7807235e91c..748eb775921 100644 --- a/tools/cmake/cmake_deps.toml +++ b/tools/cmake/cmake_deps.toml @@ -235,6 +235,8 @@ deps = [ "executorch", "executorch_core", "extension_module", + "extension_data_loader", + "extension_flat_tensor", "extension_runner_util", "extension_tensor", ] @@ -451,6 +453,7 @@ deps = [ "executorch", "executorch_core", "extension_data_loader", + "extension_flat_tensor", "extension_module", "extension_threadpool", "optimized_cpublas", From 94975dc5e4513c1aba10fd8c25a119061f2c1191 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 May 2025 16:33:54 -0700 Subject: [PATCH 14/18] Kernels should depend on executorch_core --- configurations/CMakeLists.txt | 2 +- extension/flat_tensor/CMakeLists.txt | 2 +- kernels/optimized/CMakeLists.txt | 2 +- kernels/quantized/CMakeLists.txt | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configurations/CMakeLists.txt b/configurations/CMakeLists.txt index d620b722a09..d77ea1633ed 100644 --- a/configurations/CMakeLists.txt +++ b/configurations/CMakeLists.txt @@ -59,7 +59,7 @@ if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED) optimized_kernels ${_optimized_native_cpu_ops_lib_portable_kernels_lib} DEPS - executorch + executorch_core ) install(TARGETS optimized_native_cpu_ops_lib DESTINATION lib) diff --git a/extension/flat_tensor/CMakeLists.txt b/extension/flat_tensor/CMakeLists.txt index caacd96b557..d44ed811805 100644 --- a/extension/flat_tensor/CMakeLists.txt +++ b/extension/flat_tensor/CMakeLists.txt @@ -18,7 +18,7 @@ endif() list(TRANSFORM _extension_flat_tensor__srcs PREPEND "${EXECUTORCH_ROOT}/") add_library(extension_flat_tensor ${_extension_flat_tensor__srcs}) -target_link_libraries(extension_flat_tensor executorch extension_data_loader) +target_link_libraries(extension_flat_tensor executorch_core) target_include_directories( extension_flat_tensor PUBLIC ${EXECUTORCH_ROOT}/.. diff --git a/kernels/optimized/CMakeLists.txt b/kernels/optimized/CMakeLists.txt index 693be68c35e..85c829469be 100644 --- a/kernels/optimized/CMakeLists.txt +++ b/kernels/optimized/CMakeLists.txt @@ -71,7 +71,7 @@ target_compile_options(optimized_kernels PUBLIC ${_common_compile_options}) # # optimized_ops_lib: Register optimized ops kernels into Executorch runtime gen_operators_lib( - LIB_NAME "optimized_ops_lib" KERNEL_LIBS optimized_kernels DEPS executorch + LIB_NAME "optimized_ops_lib" KERNEL_LIBS optimized_kernels DEPS executorch_core ) install( diff --git a/kernels/quantized/CMakeLists.txt b/kernels/quantized/CMakeLists.txt index 29058e9b11d..149db0c17f6 100644 --- a/kernels/quantized/CMakeLists.txt +++ b/kernels/quantized/CMakeLists.txt @@ -142,13 +142,13 @@ if(NOT CMAKE_GENERATOR STREQUAL "Xcode" endif() add_library(quantized_kernels ${_quantized_kernels__srcs}) -target_link_libraries(quantized_kernels PRIVATE executorch) +target_link_libraries(quantized_kernels PRIVATE executorch_core) target_compile_options(quantized_kernels PUBLIC ${_common_compile_options}) # Build a library for _quantized_kernels_srcs # # quantized_ops_lib: Register quantized ops kernels into Executorch runtime gen_operators_lib( - LIB_NAME "quantized_ops_lib" KERNEL_LIBS quantized_kernels DEPS executorch + LIB_NAME "quantized_ops_lib" KERNEL_LIBS quantized_kernels DEPS executorch_core ) install( From a57d31ff5af5e54ba06964b445b4d32b5f9561b6 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 May 2025 16:59:04 -0700 Subject: [PATCH 15/18] Add executorch to runner.exe --- examples/models/llama/CMakeLists.txt | 10 ++-------- examples/models/llama/runner/CMakeLists.txt | 2 +- examples/models/llava/CMakeLists.txt | 10 ++-------- examples/models/llava/runner/CMakeLists.txt | 2 +- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/examples/models/llama/CMakeLists.txt b/examples/models/llama/CMakeLists.txt index 12385f32d20..4ea735e5717 100644 --- a/examples/models/llama/CMakeLists.txt +++ b/examples/models/llama/CMakeLists.txt @@ -80,14 +80,12 @@ find_package(gflags REQUIRED) # find `executorch` libraries Same as for gflags set(executorch_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../lib/cmake/ExecuTorch) find_package(executorch CONFIG REQUIRED) -if(CMAKE_TOOLCHAIN_IOS OR ANDROID) - target_link_options_shared_lib(executorch) -endif() +target_link_options_shared_lib(executorch) # llama_runner library add_subdirectory(runner) -set(link_libraries gflags) +set(link_libraries executorch gflags) set(_srcs main.cpp) if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED) @@ -225,9 +223,5 @@ target_include_directories( target_link_libraries(llama_main PUBLIC llama_runner ${link_libraries}) target_compile_options(llama_main PUBLIC ${_common_compile_options}) -if(APPLE) - target_link_options_shared_lib(executorch) -endif() - # Print all summary executorch_print_configuration_summary() diff --git a/examples/models/llama/runner/CMakeLists.txt b/examples/models/llama/runner/CMakeLists.txt index 0807e6fa422..afbe12d7304 100644 --- a/examples/models/llama/runner/CMakeLists.txt +++ b/examples/models/llama/runner/CMakeLists.txt @@ -52,7 +52,7 @@ else() add_library(llama_runner SHARED ${_llama_runner__srcs}) endif() -set(llama_runner_deps executorch extension_data_loader extension_module +set(llama_runner_deps executorch_core extension_data_loader extension_module extension_tensor ) diff --git a/examples/models/llava/CMakeLists.txt b/examples/models/llava/CMakeLists.txt index eeb6c296dd5..232e83d8b0a 100644 --- a/examples/models/llava/CMakeLists.txt +++ b/examples/models/llava/CMakeLists.txt @@ -89,14 +89,12 @@ endif() # find `executorch` libraries Same as for gflags set(executorch_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../lib/cmake/ExecuTorch) find_package(executorch CONFIG REQUIRED) -if(CMAKE_TOOLCHAIN_IOS OR ANDROID) - target_link_options_shared_lib(executorch) -endif() +target_link_options_shared_lib(executorch) # llava_runner library add_subdirectory(runner) -set(LINK_LIBS gflags) +set(LINK_LIBS executorch gflags) if(NOT LLAVA_RUNNER_NO_TORCH_DUMMY_IMAGE) list(APPEND LINK_LIBS torch) endif() @@ -212,9 +210,5 @@ target_include_directories(llava_main PUBLIC ${_common_include_directories}) target_link_libraries(llava_main PUBLIC llava_runner ${link_libraries}) target_compile_options(llava_main PUBLIC ${_common_compile_options}) -if(APPLE) - target_link_options_shared_lib(executorch) -endif() - # Print all summary executorch_print_configuration_summary() diff --git a/examples/models/llava/runner/CMakeLists.txt b/examples/models/llava/runner/CMakeLists.txt index c694bf87c66..dff1ee9a064 100644 --- a/examples/models/llava/runner/CMakeLists.txt +++ b/examples/models/llava/runner/CMakeLists.txt @@ -40,7 +40,7 @@ add_subdirectory( add_library(llava_runner STATIC ${_llava_runner__srcs}) -set(llava_runner_deps executorch extension_data_loader extension_llm_runner +set(llava_runner_deps executorch_core extension_data_loader extension_llm_runner extension_module extension_tensor ) From 2266cc36cc68ba3c99b57e1274d863cef77c07b3 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 May 2025 18:38:54 -0700 Subject: [PATCH 16/18] Update runner to include extension_flat_tensor --- examples/models/llama/runner/CMakeLists.txt | 4 ++-- examples/models/llava/runner/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/models/llama/runner/CMakeLists.txt b/examples/models/llama/runner/CMakeLists.txt index afbe12d7304..0cd1560cc25 100644 --- a/examples/models/llama/runner/CMakeLists.txt +++ b/examples/models/llama/runner/CMakeLists.txt @@ -52,8 +52,8 @@ else() add_library(llama_runner SHARED ${_llama_runner__srcs}) endif() -set(llama_runner_deps executorch_core extension_data_loader extension_module - extension_tensor +set(llama_runner_deps executorch_core extension_data_loader + extension_flat_tensor extension_module extension_tensor ) target_link_libraries(llama_runner PUBLIC ${llama_runner_deps}) diff --git a/examples/models/llava/runner/CMakeLists.txt b/examples/models/llava/runner/CMakeLists.txt index dff1ee9a064..1f9d6fa8e1d 100644 --- a/examples/models/llava/runner/CMakeLists.txt +++ b/examples/models/llava/runner/CMakeLists.txt @@ -41,7 +41,7 @@ add_subdirectory( add_library(llava_runner STATIC ${_llava_runner__srcs}) set(llava_runner_deps executorch_core extension_data_loader extension_llm_runner - extension_module extension_tensor + extension_module extension_tensor extension_flat_tensor ) target_link_libraries(llava_runner PUBLIC ${llava_runner_deps}) From 9bdca394ffc98a2c239af07e3b95fc0ade712221 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 May 2025 20:43:27 -0700 Subject: [PATCH 17/18] add extension_flat_tensor --- examples/models/llama/runner/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/models/llama/runner/CMakeLists.txt b/examples/models/llama/runner/CMakeLists.txt index afbe12d7304..fefee61092d 100644 --- a/examples/models/llama/runner/CMakeLists.txt +++ b/examples/models/llama/runner/CMakeLists.txt @@ -53,7 +53,7 @@ else() endif() set(llama_runner_deps executorch_core extension_data_loader extension_module - extension_tensor + extension_tensor extension_flat_tensor ) target_link_libraries(llama_runner PUBLIC ${llama_runner_deps}) From ff56f0420be3f0546f1639f3b776e7bc140e490e Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 May 2025 20:50:12 -0700 Subject: [PATCH 18/18] untouch --- extension/module/CMakeLists.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/extension/module/CMakeLists.txt b/extension/module/CMakeLists.txt index cd22f1ccfc2..abf95f866f0 100644 --- a/extension/module/CMakeLists.txt +++ b/extension/module/CMakeLists.txt @@ -27,10 +27,7 @@ if(CMAKE_TOOLCHAIN_IOS else() add_library(extension_module SHARED ${_extension_module__srcs}) endif() -target_link_libraries( - extension_module PRIVATE executorch_core extension_data_loader - extension_flat_tensor -) +target_link_libraries(extension_module PRIVATE executorch_core extension_data_loader extension_flat_tensor) target_include_directories(extension_module PUBLIC ${EXECUTORCH_ROOT}/..) target_compile_options( extension_module PUBLIC -Wno-deprecated-declarations -fPIC @@ -40,8 +37,7 @@ target_compile_options( # after cleaning up CMake targets. add_library(extension_module_static STATIC ${_extension_module__srcs}) target_link_libraries( - extension_module_static PRIVATE executorch_core extension_data_loader - extension_flat_tensor + extension_module_static PRIVATE executorch_core extension_data_loader extension_flat_tensor ) target_include_directories(extension_module_static PUBLIC ${EXECUTORCH_ROOT}/..) target_compile_options(