Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .ci/scripts/test_llama.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ UPLOAD_DIR="${UPLOAD_DIR:-}"
PT2E_QUANTIZE="${PT2E_QUANTIZE:-}"

# Default CMake Build Type to release mode
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug}

if [[ $# -lt 4 ]]; then # Assuming 4 mandatory args
echo "Expecting atleast 4 positional arguments"
Expand Down Expand Up @@ -150,7 +150,7 @@ fi
which "${PYTHON_EXECUTABLE}"

cmake_install_executorch_libraries() {
echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a"
echo "Installing libexecutorch.a, libextension_module.a, libportable_ops_lib.a"
rm -rf cmake-out
retry cmake \
-DCMAKE_INSTALL_PREFIX=cmake-out \
Expand All @@ -168,7 +168,7 @@ cmake_install_executorch_libraries() {
-DQNN_SDK_ROOT="$QNN_SDK_ROOT" \
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
-Bcmake-out .
cmake --build cmake-out -j9 --target install --config "$CMAKE_BUILD_TYPE"
cmake --build cmake-out -j $(nproc) --target install --config "$CMAKE_BUILD_TYPE"
}

cmake_build_llama_runner() {
Expand All @@ -187,7 +187,7 @@ cmake_build_llama_runner() {
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
-Bcmake-out/${dir} \
${dir}
cmake --build cmake-out/${dir} -j9 --config "$CMAKE_BUILD_TYPE"
cmake --build cmake-out/${dir} -j $(nproc) --config "$CMAKE_BUILD_TYPE"

}

Expand Down
6 changes: 3 additions & 3 deletions docs/source/llm/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ add_executable(nanogpt_runner main.cpp)
target_link_libraries(
nanogpt_runner
PRIVATE executorch
extension_module_static # Provides the Module class
extension_module # Provides the Module class
extension_tensor # Provides the TensorPtr class
optimized_native_cpu_ops_lib # Provides baseline cross-platform
# kernels
Expand Down Expand Up @@ -533,7 +533,7 @@ add_executable(nanogpt_runner main.cpp)
target_link_libraries(
nanogpt_runner
PRIVATE executorch
extension_module_static # Provides the Module class
extension_module # Provides the Module class
extension_tensor # Provides the TensorPtr class
optimized_native_cpu_ops_lib # Provides baseline cross-platform
# kernels
Expand Down Expand Up @@ -672,7 +672,7 @@ target_link_libraries(
nanogpt_runner
PRIVATE
executorch
extension_module_static # Provides the Module class
extension_module # Provides the Module class
optimized_native_cpu_ops_lib # Provides baseline cross-platform kernels
xnnpack_backend) # Provides the XNNPACK CPU acceleration backend
```
Expand Down
2 changes: 1 addition & 1 deletion examples/llm_manual/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ add_executable(nanogpt_runner main.cpp)
target_link_libraries(
nanogpt_runner
PRIVATE executorch
extension_module_static # Provides the Module class
extension_module # Provides the Module class
extension_tensor # Provides the TensorPtr class
optimized_native_cpu_ops_lib # Provides baseline cross-platform
# kernels
Expand Down
2 changes: 1 addition & 1 deletion examples/models/phi-3-mini/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ target_include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../../extension/llm/tokenizers/include
)
target_link_libraries(
phi_3_mini_runner PRIVATE executorch extension_module_static extension_tensor
phi_3_mini_runner PRIVATE executorch extension_module extension_tensor
optimized_native_cpu_ops_lib xnnpack_backend gflags
)
24 changes: 2 additions & 22 deletions extension/module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,16 @@ if(NOT EXECUTORCH_ROOT)
endif()

list(TRANSFORM _extension_module__srcs PREPEND "${EXECUTORCH_ROOT}/")
if(CMAKE_TOOLCHAIN_IOS
OR CMAKE_TOOLCHAIN_ANDROID
OR APPLE
)
# Building a share library on iOS requires code signing On Android we see
# duplicated registration when using shared lib
add_library(extension_module STATIC ${_extension_module__srcs})
else()
add_library(extension_module SHARED ${_extension_module__srcs})
endif()
add_library(extension_module ${_extension_module__srcs})
target_link_libraries(extension_module PRIVATE executorch extension_data_loader extension_flat_tensor)
target_include_directories(extension_module PUBLIC ${EXECUTORCH_ROOT}/..)
target_compile_options(
extension_module PUBLIC -Wno-deprecated-declarations -fPIC
)

# Module extension built as a static library. TODO(gjcomer) Remove this target
# after cleaning up CMake targets.
add_library(extension_module_static STATIC ${_extension_module__srcs})
target_link_libraries(
extension_module_static PRIVATE executorch extension_data_loader extension_flat_tensor
)
target_include_directories(extension_module_static PUBLIC ${EXECUTORCH_ROOT}/..)
target_compile_options(
extension_module_static PUBLIC -Wno-deprecated-declarations -fPIC
)

# Install libraries
install(
TARGETS extension_module extension_module_static
TARGETS extension_module
DESTINATION lib
INCLUDES
DESTINATION ${_common_include_directories}
Expand Down
2 changes: 1 addition & 1 deletion extension/module/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ et_cxx_test(
${_test_srcs}
EXTRA_LIBS
extension_data_loader
extension_module_static
extension_module
extension_tensor
portable_kernels
portable_ops_lib
Expand Down
2 changes: 2 additions & 0 deletions tools/cmake/cmake_deps.toml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ filters = [
deps = [
"extension_flat_tensor_schema",
"executorch_core",
"extension_data_loader",
"executorch",
]

Expand All @@ -199,6 +200,7 @@ deps = [
"executorch",
"executorch_core",
"extension_data_loader",
"extension_flat_tensor",
]

[targets.extension_runner_util]
Expand Down
12 changes: 4 additions & 8 deletions tools/cmake/executorch-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ endif()
set(lib_list
etdump
bundled_program
extension_flat_tensor
extension_data_loader
${FLATCCRT_LIB}
coreml_util
Expand All @@ -76,7 +77,6 @@ set(lib_list
portable_ops_lib
custom_ops
extension_module
extension_module_static
extension_runner_util
extension_tensor
extension_threadpool
Expand Down Expand Up @@ -113,13 +113,9 @@ foreach(lib ${lib_list})
If needed rebuild with the proper options in CMakeLists.txt"
)
else()
if("${lib}" STREQUAL "extension_module" AND (NOT CMAKE_TOOLCHAIN_IOS))
add_library(${lib} SHARED IMPORTED)
else()
# Building a share library on iOS requires code signing, so it's easier to
# keep all libs as static when CMAKE_TOOLCHAIN_IOS is used
add_library(${lib} STATIC IMPORTED)
endif()
# Building a share library on iOS requires code signing, so it's easier to
# keep all libs as static when CMAKE_TOOLCHAIN_IOS is used
add_library(${lib} STATIC IMPORTED)
set_target_properties(${lib} PROPERTIES IMPORTED_LOCATION "${${lib_var}}")
target_include_directories(
${lib}
Expand Down
Loading