Skip to content

Commit ba9f19e

Browse files
committed
Update
[ghstack-poisoned]
2 parents bf1a6cd + 719bb4f commit ba9f19e

File tree

15 files changed

+128
-45
lines changed

15 files changed

+128
-45
lines changed

.ci/scripts/build-qnn-sdk.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ set_up_aot() {
3333
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
3434
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
3535
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
36+
-DEXECUTORCH_BUILD_EXTENSION_EXTENSION_LLM=ON \
37+
-DEXECUTORCH_BUILD_EXTENSION_EXTENSION_LLM_RUNNER=ON \
3638
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
3739
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
3840
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \

CMakeLists.txt

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ install(
517517
DESTINATION include
518518
)
519519
install(FILES tools/cmake/executorch-config.cmake
520-
DESTINATION lib/cmake/ExecuTorch
520+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ExecuTorch
521521
)
522522

523523
if(EXECUTORCH_BUILD_ARM_BAREMETAL)
@@ -578,6 +578,16 @@ if(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER)
578578
)
579579
endif()
580580

581+
if(EXECUTORCH_BUILD_EXTENSION_EVALUE_UTIL)
582+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/evalue_util)
583+
install(
584+
DIRECTORY extension/evalue_util/
585+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/executorch/extension/evalue_util
586+
FILES_MATCHING
587+
PATTERN "*.h"
588+
)
589+
endif()
590+
581591
if(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR)
582592
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/flat_tensor)
583593
endif()
@@ -621,6 +631,12 @@ endif()
621631

622632
if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL)
623633
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/runner_util)
634+
install(
635+
DIRECTORY extension/runner_util/
636+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/executorch/extension/runner_util
637+
FILES_MATCHING
638+
PATTERN "*.h"
639+
)
624640
endif()
625641

626642
if(EXECUTORCH_BUILD_EXTENSION_TENSOR)
@@ -696,8 +712,7 @@ if(EXECUTORCH_BUILD_PYBIND)
696712

697713
# util lib
698714
add_library(
699-
util ${CMAKE_CURRENT_SOURCE_DIR}/extension/evalue_util/print_evalue.cpp
700-
${CMAKE_CURRENT_SOURCE_DIR}/extension/aten_util/aten_bridge.cpp
715+
util ${CMAKE_CURRENT_SOURCE_DIR}/extension/aten_util/aten_bridge.cpp
701716
)
702717
target_include_directories(
703718
util PUBLIC ${_common_include_directories} ${TORCH_INCLUDE_DIRS}
@@ -742,7 +757,9 @@ endif()
742757

743758
if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
744759
# Baseline libraries that executor_runner will link against.
745-
set(_executor_runner_libs executorch gflags)
760+
set(_executor_runner_libs executorch extension_evalue_util
761+
extension_runner_util gflags
762+
)
746763

747764
if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
748765
list(APPEND _executor_runner_libs optimized_native_cpu_ops_lib)
@@ -808,7 +825,7 @@ include(Test.cmake)
808825
install(
809826
EXPORT ExecuTorchTargets
810827
FILE ExecuTorchTargets.cmake
811-
DESTINATION lib/cmake/ExecuTorch
828+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ExecuTorch
812829
)
813830

814831
# Print all the configs that were called with announce_configured_options.

backends/qualcomm/scripts/build.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ if [ "$BUILD_AARCH64" = true ]; then
8080
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
8181
-DEXECUTORCH_BUILD_QNN=ON \
8282
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
83+
-DEXECUTORCH_BUILD_EXTENSION_LLM=ON \
84+
-DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON \
8385
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
8486
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
8587
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
@@ -96,7 +98,7 @@ if [ "$BUILD_AARCH64" = true ]; then
9698
cmake --build $BUILD_ROOT -j$BUILD_JOB_NUMBER --target install
9799

98100
EXAMPLE_ROOT=examples/qualcomm
99-
CMAKE_PREFIX_PATH="${BUILD_ROOT}/lib/cmake/ExecuTorch;${BUILD_ROOT}/third-party/gflags;"
101+
CMAKE_PREFIX_PATH="${BUILD_ROOT}"
100102

101103
cmake $PRJ_ROOT/$EXAMPLE_ROOT \
102104
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake \
@@ -128,6 +130,8 @@ if [ "$BUILD_X86_64" = true ]; then
128130
-DQNN_SDK_ROOT=${QNN_SDK_ROOT} \
129131
-DEXECUTORCH_BUILD_QNN=ON \
130132
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
133+
-DEXECUTORCH_BUILD_EXTENSION_LLM=ON \
134+
-DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON \
131135
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
132136
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
133137
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
@@ -146,7 +150,7 @@ if [ "$BUILD_X86_64" = true ]; then
146150
cp -fv "$PRJ_ROOT/schema/scalar_type.fbs" "$PRJ_ROOT/exir/_serialize/scalar_type.fbs"
147151

148152
EXAMPLE_ROOT=examples/qualcomm
149-
CMAKE_PREFIX_PATH="${BUILD_ROOT}/lib/cmake/ExecuTorch;${BUILD_ROOT}/third-party/gflags;"
153+
CMAKE_PREFIX_PATH="${BUILD_ROOT}"
150154

151155
echo "Update tokenizers submodule..."
152156
pushd $PRJ_ROOT/extension/llm/tokenizers

devtools/etdump/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ target_include_directories(
5656
etdump
5757
PUBLIC
5858
${DEVTOOLS_INCLUDE_DIR}
59-
${PROJECT_SOURCE_DIR}/third-party/flatcc/include
59+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/flatcc/include>
6060
)
6161

6262
install(
63-
TARGETS etdump
63+
TARGETS etdump flatccrt
64+
EXPORT ExecuTorchTargets
6465
DESTINATION ${CMAKE_BINARY_DIR}/lib
6566
INCLUDES
6667
DESTINATION ${_common_include_directories}

examples/apple/mps/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
105105
mps_executor_runner
106106
bundled_program
107107
executorch
108+
extension_evalue_util
109+
extension_runner_util
108110
gflags
109111
etdump
110112
flatccrt

examples/apple/mps/test_mps.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ cmake_install_executorch_devtools_lib() {
1919
-DCMAKE_INSTALL_PREFIX=cmake-out \
2020
-DCMAKE_BUILD_TYPE=Release \
2121
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
22+
-DEXECUTORCH_BUILD_EXTENSION_EVALUE_UTIL=ON \
23+
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
2224
-DEXECUTORCH_BUILD_MPS=ON \
2325
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
2426
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \

examples/qualcomm/CMakeLists.txt

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ find_package(gflags REQUIRED)
3434

3535
set(_common_compile_options -Wno-deprecated-declarations -fPIC)
3636

37-
# Let files say "include <executorch/path/to/header.h>".
38-
set(_common_include_directories
39-
${EXECUTORCH_ROOT}/..
40-
${EXECUTORCH_ROOT}/extension/llm/tokenizers/third-party/json/single_include
41-
)
42-
4337
#
4438
# The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE}.
4539
#
@@ -65,20 +59,20 @@ gen_operators_lib(
6559
target_compile_options(
6660
full_portable_ops_lib INTERFACE -DET_EVENT_TRACER_ENABLED
6761
)
68-
target_include_directories(
69-
full_portable_ops_lib
70-
PUBLIC
71-
${_common_include_directories}
72-
${CMAKE_CURRENT_SOURCE_DIR}/../../extension/llm/tokenizers/include
73-
${CMAKE_CURRENT_SOURCE_DIR}/../../extension/llm/tokenizers/third-party/json/single_include
74-
${CMAKE_CURRENT_SOURCE_DIR}/../../extension/llm/tokenizers/third-party/llama.cpp-unicode/include
75-
${CMAKE_CURRENT_SOURCE_DIR}/../../extension/llm/tokenizers/third-party/llama.cpp-unicode/src
76-
)
62+
# target_include_directories(
63+
# full_portable_ops_lib
64+
# PUBLIC
65+
# ${_common_include_directories}
66+
# ${CMAKE_CURRENT_SOURCE_DIR}/../../extension/llm/tokenizers/include
67+
# ${CMAKE_CURRENT_SOURCE_DIR}/../../extension/llm/tokenizers/third-party/json/single_include
68+
# ${CMAKE_CURRENT_SOURCE_DIR}/../../extension/llm/tokenizers/third-party/llama.cpp-unicode/include
69+
# ${CMAKE_CURRENT_SOURCE_DIR}/../../extension/llm/tokenizers/third-party/llama.cpp-unicode/src
70+
# )
7771

78-
# add tokenizers
79-
add_subdirectory(
80-
${EXECUTORCH_ROOT}/extension/llm/tokenizers
81-
${CMAKE_CURRENT_BINARY_DIR}/../../extension/llm/tokenizers
72+
# Let files say "include <executorch/path/to/header.h>".
73+
set(_common_include_directories
74+
${EXECUTORCH_ROOT}/..
75+
${EXECUTORCH_ROOT}/extension/llm/tokenizers/third-party/json/single_include
8276
)
8377

8478
# build qnn_executor_runner

examples/qualcomm/executor_runner/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@ target_include_directories(
1919
qnn_executor_runner PUBLIC ${_common_include_directories}
2020
)
2121
target_link_libraries(
22-
qnn_executor_runner qnn_executorch_backend full_portable_ops_lib etdump
23-
flatccrt gflags
22+
qnn_executor_runner
23+
qnn_executorch_backend
24+
executorch_core
25+
extension_evalue_util
26+
extension_runner_util
27+
full_portable_ops_lib
28+
etdump
29+
flatccrt
30+
gflags
2431
)
2532
set_target_properties(
2633
qnn_executor_runner PROPERTIES LINK_FLAGS "-Wl,-rpath='$ORIGIN'"

examples/qualcomm/oss_scripts/llama/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ target_include_directories(custom_ops PUBLIC "${_common_include_directories}")
1515
target_include_directories(
1616
custom_ops PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../../include"
1717
)
18-
target_link_libraries(custom_ops PUBLIC full_portable_ops_lib)
18+
target_link_libraries(custom_ops PUBLIC executorch_core full_portable_ops_lib)
1919
executorch_target_link_options_shared_lib(custom_ops)
2020

2121
# preprocess qnn runner src files for llama
@@ -52,7 +52,6 @@ target_include_directories(
5252
qnn_llama_runner
5353
PUBLIC
5454
${_common_include_directories}
55-
${CMAKE_CURRENT_SOURCE_DIR}/../../../../extension/llm/tokenizers/include
5655
)
5756

5857
executorch_target_link_options_shared_lib(quantized_ops_lib)
@@ -63,13 +62,14 @@ target_link_libraries(
6362
executorch_core
6463
extension_data_loader
6564
extension_flat_tensor
65+
extension_llm_runner
6666
extension_module
6767
extension_tensor
6868
gflags
6969
custom_ops
7070
quantized_ops_lib
7171
quantized_kernels
72-
tokenizers
72+
tokenizers::tokenizers
7373
)
7474
target_compile_options(qnn_llama_runner PUBLIC ${_common_compile_options})
7575
set_target_properties(

examples/qualcomm/oss_scripts/t5/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ set(_qnn_t5_runner__srcs
2121
add_executable(qnn_t5_runner ${_qnn_t5_runner__srcs})
2222
target_include_directories(
2323
qnn_t5_runner PUBLIC ${_common_include_directories}
24-
${EXECUTORCH_ROOT}/extension/llm/tokenizers/include
2524
)
2625

2726

@@ -31,10 +30,11 @@ target_link_libraries(
3130
executorch_core
3231
extension_data_loader
3332
extension_flat_tensor
33+
extension_llm_runner
3434
extension_module
3535
extension_tensor
3636
gflags
37-
tokenizers
37+
tokenizers::tokenizers
3838
)
3939

4040
target_compile_options(

0 commit comments

Comments
 (0)