diff --git a/.ci/scripts/build_llama_android.sh b/.ci/scripts/build_llama_android.sh index 16b7290af81..e10352daddf 100644 --- a/.ci/scripts/build_llama_android.sh +++ b/.ci/scripts/build_llama_android.sh @@ -15,8 +15,12 @@ if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then fi which "${PYTHON_EXECUTABLE}" -install_executorch_and_backend_lib() { - echo "Installing executorch and xnnpack backend" +build_llama_android() { + echo "Building llama runner for Android..." + pushd extension/llm/tokenizers + echo "Updating tokenizers submodule" + git submodule update --init + popd clean_executorch_install_folders mkdir cmake-android-out ANDROID_NDK=${ANDROID_NDK:-/opt/ndk} @@ -26,30 +30,10 @@ install_executorch_and_backend_lib() { -DBUCK2="${BUCK2}" \ -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \ -DANDROID_ABI="${ANDROID_ABI}" \ - -DCMAKE_INSTALL_PREFIX=cmake-android-out \ -DCMAKE_BUILD_TYPE=Release \ -DXNNPACK_ENABLE_ARM_BF16=OFF \ -Bcmake-android-out . - cmake --build cmake-android-out -j4 --target install --config Release + cmake --build cmake-android-out -j4 --target llama_main --config Release } - -build_llama_runner() { - echo "Building llama runner for Android..." - pushd extension/llm/tokenizers - echo "Updating tokenizers submodule" - git submodule update --init - popd - ANDROID_ABI=arm64-v8a - cmake -DBUCK2="${BUCK2}" \ - -DBUILD_TESTING=OFF \ - -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK"/build/cmake/android.toolchain.cmake \ - -DANDROID_ABI="${ANDROID_ABI}" \ - -DCMAKE_INSTALL_PREFIX=cmake-android-out \ - -DCMAKE_BUILD_TYPE=Release \ - -Bcmake-android-out/examples/models/llama examples/models/llama - - cmake --build cmake-android-out/examples/models/llama -j4 --config Release -} -install_executorch_and_backend_lib -build_llama_runner +build_llama_android diff --git a/.ci/scripts/test_llama.sh b/.ci/scripts/test_llama.sh index 414ab85be58..a1bfe0c2d38 100644 --- a/.ci/scripts/test_llama.sh +++ b/.ci/scripts/test_llama.sh @@ -149,35 +149,21 @@ fi which "${PYTHON_EXECUTABLE}" -cmake_install_executorch_libraries() { - echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a" +cmake_build_llama() { + echo "Building llama runner" + pushd extension/llm/tokenizers + echo "Updating tokenizers submodule" + git submodule update --init + popd rm -rf cmake-out retry cmake --preset llm \ -DEXECUTORCH_BUILD_TESTS=ON \ -DBUILD_TESTING=OFF \ - -DCMAKE_INSTALL_PREFIX=cmake-out \ -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \ -DEXECUTORCH_BUILD_QNN="$QNN" \ -DEXECUTORCH_ENABLE_LOGGING=ON \ -DQNN_SDK_ROOT="$QNN_SDK_ROOT" - cmake --build cmake-out -j9 --target install --config "$CMAKE_BUILD_TYPE" -} - -cmake_build_llama_runner() { - echo "Building llama runner" - pushd extension/llm/tokenizers - echo "Updating tokenizers submodule" - git submodule update --init - popd - dir="examples/models/llama" - if [[ "$CMAKE_BUILD_TYPE" == "Debug" ]]; then - PRESET="llama-debug" - else - PRESET="llama-release" - fi - pushd "${dir}" - cmake --workflow --preset "${PRESET}" - popd + cmake --build cmake-out -j9 --target llama_main --config "$CMAKE_BUILD_TYPE" } cleanup_files() { @@ -269,8 +255,7 @@ if [[ "${BUILD_TOOL}" == "buck2" ]]; then # shellcheck source=/dev/null $BUCK run examples/models/llama:main -- ${RUNTIME_ARGS} > result.txt elif [[ "${BUILD_TOOL}" == "cmake" ]]; then - cmake_install_executorch_libraries - cmake_build_llama_runner + cmake_build_llama # Run llama runner NOW=$(date +"%H:%M:%S") echo "Starting to run llama runner at ${NOW}" diff --git a/.ci/scripts/test_llama_torchao_lowbit.sh b/.ci/scripts/test_llama_torchao_lowbit.sh index a7ded52ccc6..f83871dd636 100644 --- a/.ci/scripts/test_llama_torchao_lowbit.sh +++ b/.ci/scripts/test_llama_torchao_lowbit.sh @@ -23,9 +23,8 @@ echo "Update tokenizers submodule" git submodule update --init popd -# Install ET with CMake +# Build llama runner with torchao cmake -DPYTHON_EXECUTABLE=python \ - -DCMAKE_INSTALL_PREFIX=cmake-out \ -DEXECUTORCH_ENABLE_LOGGING=1 \ -DCMAKE_BUILD_TYPE=Release \ -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ @@ -41,14 +40,7 @@ cmake -DPYTHON_EXECUTABLE=python \ -DEXECUTORCH_BUILD_EXTENSION_LLM=ON \ -DEXECUTORCH_BUILD_KERNELS_LLM=ON \ -Bcmake-out . -cmake --build cmake-out -j16 --config Release --target install - -# Install llama runner with torchao -cmake -DPYTHON_EXECUTABLE=python \ - -DCMAKE_BUILD_TYPE=Release \ - -Bcmake-out/examples/models/llama \ - examples/models/llama -cmake --build cmake-out/examples/models/llama -j16 --config Release +cmake --build cmake-out -j16 --config Release --target llama_main # Download stories llama110m artifacts download_stories_model_artifacts diff --git a/.ci/scripts/test_lora.sh b/.ci/scripts/test_lora.sh index 89a7e99460e..737a72072fb 100644 --- a/.ci/scripts/test_lora.sh +++ b/.ci/scripts/test_lora.sh @@ -9,20 +9,15 @@ set -exu # shellcheck source=/dev/null source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" -cmake_install_executorch_libraries() { - echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a" - rm -rf cmake-out - cmake --preset llm-release -DEXECUTORCH_ENABLE_LOGGING=ON - cmake --build --preset llm-release-install -} - -cmake_build_llama_runner() { +cmake_build_llama() { echo "Building llama runner" pushd extension/llm/tokenizers echo "Updating tokenizers submodule" git submodule update --init popd - make llama-cpu + rm -rf cmake-out + cmake --preset llm-release -DEXECUTORCH_ENABLE_LOGGING=ON + cmake --build cmake-out -j9 --target llama_main --config Release } cleanup_files() { @@ -57,8 +52,7 @@ HF_QWEN_PATH=$(python -c "from huggingface_hub import snapshot_download; print(s echo "Model downloaded to: $HF_QWEN_PATH" ### BUILD LLAMA RUNNER. -cmake_install_executorch_libraries -cmake_build_llama_runner +cmake_build_llama # Runner constants. RUNTIME_ARGS="--tokenizer_path=${HF_QWEN_PATH}/ --temperature=0 --seq_len=100 --warmup=1" diff --git a/.ci/scripts/test_lora_multimethod.sh b/.ci/scripts/test_lora_multimethod.sh index 8f4ae1a4f68..d643433c413 100755 --- a/.ci/scripts/test_lora_multimethod.sh +++ b/.ci/scripts/test_lora_multimethod.sh @@ -9,20 +9,15 @@ set -exu # shellcheck source=/dev/null source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" -cmake_install_executorch_libraries() { - echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a" - rm -rf cmake-out - cmake --preset llm-release -DEXECUTORCH_ENABLE_LOGGING=ON - cmake --build --preset llm-release-install -} - -cmake_build_llama_runner() { +cmake_build_llama() { echo "Building llama runner" pushd extension/llm/tokenizers echo "Updating tokenizers submodule" git submodule update --init popd - make llama-cpu + rm -rf cmake-out + cmake --preset llm-release -DEXECUTORCH_ENABLE_LOGGING=ON + cmake --build cmake-out -j9 --target llama_main --config Release } cleanup_files() { @@ -55,8 +50,7 @@ $PYTHON_EXECUTABLE -m extension.llm.export.export_llm \ --config examples/models/qwen3/config/qwen3_multimethod.yaml ### BUILD LLAMA RUNNER ### -cmake_install_executorch_libraries -cmake_build_llama_runner +cmake_build_llama # Runner constants. RUNTIME_ARGS="--tokenizer_path=${HF_QWEN_PATH}/ --temperature=0 --seq_len=100 --warmup=1" diff --git a/.ci/scripts/test_torchao_huggingface_checkpoints.sh b/.ci/scripts/test_torchao_huggingface_checkpoints.sh index f80eb9e9f44..a76d30e7ae3 100644 --- a/.ci/scripts/test_torchao_huggingface_checkpoints.sh +++ b/.ci/scripts/test_torchao_huggingface_checkpoints.sh @@ -147,7 +147,6 @@ fi if [[ "$TEST_WITH_RUNNER" -eq 1 ]]; then echo "[runner] Building and testing llama_main ..." cmake -DPYTHON_EXECUTABLE=python \ - -DCMAKE_INSTALL_PREFIX=cmake-out \ -DEXECUTORCH_ENABLE_LOGGING=1 \ -DCMAKE_BUILD_TYPE=Release \ -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ @@ -163,15 +162,7 @@ if [[ "$TEST_WITH_RUNNER" -eq 1 ]]; then -DEXECUTORCH_BUILD_KERNELS_LLM=ON \ -DEXECUTORCH_BUILD_KERNELS_TORCHAO=${EXECUTORCH_BUILD_KERNELS_TORCHAO} \ -Bcmake-out . - cmake --build cmake-out -j16 --config Release --target install - - - # Install llama runner - cmake -DPYTHON_EXECUTABLE=python \ - -DCMAKE_BUILD_TYPE=Release \ - -Bcmake-out/examples/models/llama \ - examples/models/llama - cmake --build cmake-out/examples/models/llama -j16 --config Release + cmake --build cmake-out -j16 --config Release --target llama_main # Run the model ./cmake-out/examples/models/llama/llama_main --model_path=$MODEL_OUT --tokenizer_path="${HF_MODEL_DIR}/tokenizer.json" --prompt="Once upon a time," diff --git a/.github/workflows/mlx.yml b/.github/workflows/mlx.yml index e62e93b3a20..a9edbeb7992 100644 --- a/.github/workflows/mlx.yml +++ b/.github/workflows/mlx.yml @@ -365,9 +365,7 @@ jobs: echo "::endgroup::" echo "::group::Build Llama runner with MLX" - pushd examples/models/llama - ${CONDA_RUN} cmake --workflow --preset llama-release - popd + ${CONDA_RUN} cmake --build cmake-out --target llama_main echo "::endgroup::" echo "::group::Download stories110M artifacts" diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f44b650aa1..9726336cc19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1140,6 +1140,7 @@ endif() if(EXECUTORCH_BUILD_KERNELS_LLM) # TODO: move all custom kernels to ${CMAKE_CURRENT_SOURCE_DIR}/kernels/custom add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/custom_ops) + executorch_target_link_options_shared_lib(custom_ops) list(APPEND _executorch_kernels custom_ops_aot_lib) endif() @@ -1271,7 +1272,7 @@ if(EXECUTORCH_BUILD_EXECUTOR_RUNNER) endif() if(EXECUTORCH_BUILD_KERNELS_LLM) - list(APPEND _executor_runner_libs $) + list(APPEND _executor_runner_libs custom_ops) endif() if(EXECUTORCH_ENABLE_EVENT_TRACER) @@ -1322,6 +1323,12 @@ if(EXECUTORCH_BUILD_ANDROID_JNI) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/android) endif() +# Examples — EXCLUDE_FROM_ALL so they only build when explicitly requested +# (e.g., cmake --build cmake-out --target llama_main). +add_subdirectory( + ${CMAKE_CURRENT_SOURCE_DIR}/examples/models/llama EXCLUDE_FROM_ALL +) + include(Test.cmake) install( diff --git a/CMakePresets.json b/CMakePresets.json index f12fabbc232..9c8af1e5246 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -442,6 +442,35 @@ "install" ], "jobs": 0 + }, + { + "name": "llama-release-build", + "displayName": "Build llama_main (Release)", + "configurePreset": "llm-release", + "configuration": "Release", + "targets": [ + "llama_main" + ], + "jobs": 0 + }, + { + "name": "llama-cuda-build", + "displayName": "Build llama_main with CUDA (Release)", + "configurePreset": "llm-release-cuda", + "configuration": "Release", + "targets": [ + "llama_main" + ], + "jobs": 0 + }, + { + "name": "llama-cuda-debug-build", + "displayName": "Build llama_main with CUDA (Debug)", + "configurePreset": "llm-debug-cuda", + "targets": [ + "llama_main" + ], + "jobs": 0 } ], "workflowPresets": [ @@ -584,6 +613,48 @@ "name": "mlx-debug-install" } ] + }, + { + "name": "llama-release", + "displayName": "Configure and build llama_main (Release, CPU)", + "steps": [ + { + "type": "configure", + "name": "llm-release" + }, + { + "type": "build", + "name": "llama-release-build" + } + ] + }, + { + "name": "llama-cuda", + "displayName": "Configure and build llama_main (Release, CUDA)", + "steps": [ + { + "type": "configure", + "name": "llm-release-cuda" + }, + { + "type": "build", + "name": "llama-cuda-build" + } + ] + }, + { + "name": "llama-cuda-debug", + "displayName": "Configure and build llama_main (Debug, CUDA)", + "steps": [ + { + "type": "configure", + "name": "llm-debug-cuda" + }, + { + "type": "build", + "name": "llama-cuda-debug-build" + } + ] } ] } diff --git a/Makefile b/Makefile index 00ae1c4c0de..01bcf5cbc01 100644 --- a/Makefile +++ b/Makefile @@ -342,28 +342,22 @@ silero-vad-cpu: @echo " Binary: cmake-out/examples/models/silero_vad/silero_vad_stream_runner" llama-cpu: - @echo "==> Building and installing ExecuTorch..." - cmake --workflow --preset llm-release @echo "==> Building Llama runner (CPU)..." - cd examples/models/llama && cmake --workflow --preset llama-release + cmake --workflow --preset llama-release @echo "" @echo "✓ Build complete!" @echo " Binary: cmake-out/examples/models/llama/llama_main" llama-cuda: - @echo "==> Building and installing ExecuTorch with CUDA..." - cmake --workflow --preset llm-release-cuda @echo "==> Building Llama runner with CUDA..." - cd examples/models/llama && cmake --workflow --preset llama-cuda + cmake --workflow --preset llama-cuda @echo "" @echo "✓ Build complete!" @echo " Binary: cmake-out/examples/models/llama/llama_main" llama-cuda-debug: - @echo "==> Building and installing ExecuTorch with CUDA (debug mode)..." - cmake --workflow --preset llm-debug-cuda @echo "==> Building Llama runner with CUDA (debug mode)..." - cd examples/models/llama && cmake --workflow --preset llama-cuda-debug + cmake --workflow --preset llama-cuda-debug @echo "" @echo "✓ Build complete!" @echo " Binary: cmake-out/examples/models/llama/llama_main" diff --git a/examples/models/llama/CMakeLists.txt b/examples/models/llama/CMakeLists.txt index 6d5b5cc2566..062073f51d2 100644 --- a/examples/models/llama/CMakeLists.txt +++ b/examples/models/llama/CMakeLists.txt @@ -15,81 +15,41 @@ # ~~~ # It should also be cmake-lint clean. # -cmake_minimum_required(VERSION 3.24) # 3.24 is required for WHOLE_ARCHIVE -project(llama_runner) - -# Duplicating options as root CMakeLists.txt -option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED "Build the optimized kernels" OFF) - -include(CMakeDependentOption) -# -# pthreadpool: build pthreadpool library. Disable on unsupported platforms -# -cmake_dependent_option( - EXECUTORCH_BUILD_PTHREADPOOL "Build pthreadpool library." ON - "NOT EXECUTORCH_BUILD_ARM_BAREMETAL" OFF -) -# -# cpuinfo: build cpuinfo library. Disable on unsupported platforms -# -cmake_dependent_option( - EXECUTORCH_BUILD_CPUINFO "Build cpuinfo library." ON - "NOT EXECUTORCH_BUILD_ARM_BAREMETAL" OFF -) - -option(EXECUTORCH_BUILD_KERNELS_TORCHAO_MPS "Build the torchao MPS kernels" OFF) - -if(NOT PYTHON_EXECUTABLE) - set(PYTHON_EXECUTABLE python3) -endif() - -set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../..) -set(TORCH_ROOT ${EXECUTORCH_ROOT}/third-party/pytorch) - -include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake) - -if(NOT PYTHON_EXECUTABLE) - resolve_python_executable() -endif() - -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 17) - # Can't set to 11 due to executor_runner.cpp make_unique -endif() - -if(CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$") - set(CMAKE_TOOLCHAIN_IOS ON) -else() - set(CMAKE_TOOLCHAIN_IOS OFF) +cmake_minimum_required(VERSION 3.24) + +# When included as part of the root ExecuTorch build (EXCLUDE_FROM_ALL), +# required targets like extension_llm_runner are already defined. If they're +# missing, the user configured without the right options. Provide a clear +# build-time error rather than a confusing "target not found". +if(NOT TARGET extension_llm_runner) + file( + WRITE ${CMAKE_CURRENT_BINARY_DIR}/_llama_missing_deps.cmake + "message(FATAL_ERROR \"llama_main requires EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON (enabled by the 'llm' preset)\")\n" + ) + add_custom_target( + llama_main COMMAND ${CMAKE_COMMAND} -P + ${CMAKE_CURRENT_BINARY_DIR}/_llama_missing_deps.cmake + ) + return() endif() -set(_common_compile_options -Wno-deprecated-declarations -fPIC) - -# Let files say "include ". -set(_common_include_directories ${EXECUTORCH_ROOT}/..) - -# For some reason android build is not able to find where gflags is and hence -# cannot find corresponding .cmake file -set(gflags_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party/gflags) -find_package(gflags REQUIRED) +option(EXECUTORCH_BUILD_KERNELS_TORCHAO_MPS "Build the torchao MPS kernels" OFF) # # llama_main: test binary to run llama, with tokenizer and sampler integrated # -# find `executorch` libraries. CMAKE_PREFIX_PATH would work for host -# compilation, but CMAKE_FIND_ROOT_PATH appears to be necessary for -# cross-compiling (e.g., to Android) to work as well. -list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) -find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -executorch_target_link_options_shared_lib(executorch) - # llama_runner library add_subdirectory(runner) set(link_libraries executorch gflags) set(_srcs main.cpp) +# Whole-archive linking for libraries with load-time constructors is handled +# automatically: executorch_target_link_options_shared_lib() (called during +# target creation in the root build) bakes -force_load / --whole-archive into +# each target's INTERFACE_LINK_OPTIONS, so simply listing them here is enough. + if(TARGET optimized_native_cpu_ops_lib) list( APPEND @@ -100,28 +60,20 @@ if(TARGET optimized_native_cpu_ops_lib) cpublas eigen_blas ) - executorch_target_link_options_shared_lib(optimized_native_cpu_ops_lib) else() list(APPEND link_libraries portable_ops_lib portable_kernels) - executorch_target_link_options_shared_lib(portable_ops_lib) endif() # quantized_ops_lib: Register quantized op kernels into the runtime if(TARGET quantized_ops_lib) list(APPEND link_libraries quantized_kernels quantized_ops_lib) - get_target_property(_quantized_imported quantized_ops_lib IMPORTED) - if(NOT _quantized_imported) - executorch_target_link_options_shared_lib(quantized_ops_lib) - endif() endif() if(TARGET custom_ops) - executorch_target_link_options_shared_lib(custom_ops) list(APPEND link_libraries custom_ops) endif() if(TARGET torchao_ops_executorch) - executorch_target_link_options_shared_lib(torchao_ops_executorch) list(APPEND link_libraries torchao_ops_executorch) endif() @@ -135,58 +87,42 @@ if(EXECUTORCH_BUILD_KERNELS_TORCHAO_MPS) ${CMAKE_CURRENT_SOURCE_DIR}/../../../third-party/ao/torchao/experimental/ops/mps ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party/ao/torchao/experimental/ops/mps ) - executorch_target_link_options_shared_lib(torchao_ops_mps_executorch) list(APPEND link_libraries torchao_ops_mps_executorch) endif() endif() endif() -set(XNNPACK_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../backends/xnnpack) # Extra compile option and include dir for pthreadpool if(EXECUTORCH_BUILD_PTHREADPOOL) list(APPEND link_libraries extension_threadpool pthreadpool) - list(APPEND _common_include_directories - ${XNNPACK_ROOT}/third-party/pthreadpool/include - ) endif() # Extra sources for cpuinfo if(EXECUTORCH_BUILD_CPUINFO) - list(APPEND link_libraries extension_threadpool cpuinfo) - list(APPEND _common_include_directories - ${XNNPACK_ROOT}/third-party/cpuinfo/include - ) + list(APPEND link_libraries cpuinfo) endif() # XNNPACK if(TARGET xnnpack_backend) - set(xnnpack_backend_libs xnnpack_backend XNNPACK xnnpack-microkernels-prod) + list(APPEND link_libraries xnnpack_backend XNNPACK xnnpack-microkernels-prod) if(TARGET kleidiai) - list(APPEND xnnpack_backend_libs kleidiai) + list(APPEND link_libraries kleidiai) endif() - list(APPEND link_libraries ${xnnpack_backend_libs}) - executorch_target_link_options_shared_lib(xnnpack_backend) endif() # CUDA backend if(EXECUTORCH_BUILD_CUDA) - find_package(CUDAToolkit REQUIRED) list(APPEND link_libraries aoti_cuda_backend) - if(NOT MSVC) - executorch_target_link_options_shared_lib(aoti_cuda_backend) - endif() endif() # Vulkan backend if(TARGET vulkan_backend) list(APPEND link_libraries vulkan_backend) - executorch_target_link_options_shared_lib(vulkan_backend) endif() # Qnn backend if(TARGET qnn_executorch_backend) list(APPEND link_libraries qnn_executorch_backend) - executorch_target_link_options_shared_lib(qnn_executorch_backend) endif() # MPS backend @@ -200,24 +136,19 @@ if(TARGET mpsdelegate) "-weak_framework MetalPerformanceShadersGraph" "-weak_framework Metal" ) - executorch_target_link_options_shared_lib(mpsdelegate) endif() # MLX backend if(TARGET mlxdelegate) list(APPEND link_libraries mlxdelegate mlx) - executorch_target_link_options_shared_lib(mlxdelegate) endif() # Openvino backend if(TARGET openvino_backend) - find_package(OpenVINO REQUIRED) list(APPEND link_libraries openvino_backend) - executorch_target_link_options_shared_lib(openvino_backend) endif() if(TARGET coremldelegate) - find_library(SQLITE_LIBRARY sqlite3) list( APPEND link_libraries @@ -227,7 +158,6 @@ if(TARGET coremldelegate) "-framework CoreML" "-framework Accelerate" ) - executorch_target_link_options_shared_lib(coremldelegate) endif() # This one is needed for cpuinfo where it uses android specific log lib diff --git a/examples/models/llama/CMakePresets.json b/examples/models/llama/CMakePresets.json deleted file mode 100644 index f52b289523f..00000000000 --- a/examples/models/llama/CMakePresets.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "version": 6, - "configurePresets": [ - { - "name": "llama-release", - "displayName": "Llama runner in Release mode", - "binaryDir": "${sourceDir}/../../../cmake-out/examples/models/llama", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_FIND_ROOT_PATH": "${sourceDir}/../../../cmake-out" - } - }, - { - "name": "llama-debug", - "displayName": "Llama runner in Debug mode", - "binaryDir": "${sourceDir}/../../../cmake-out/examples/models/llama", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_FIND_ROOT_PATH": "${sourceDir}/../../../cmake-out" - } - }, - { - "name": "llama-cuda-debug", - "displayName": "Llama runner in Debug mode with CUDA backend", - "binaryDir": "${sourceDir}/../../../cmake-out/examples/models/llama", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_FIND_ROOT_PATH": "${sourceDir}/../../../cmake-out", - "EXECUTORCH_BUILD_CUDA": "ON" - }, - "condition": { - "type": "inList", - "string": "${hostSystemName}", - "list": ["Linux", "Windows"] - } - }, - { - "name": "llama-cuda", - "displayName": "Llama runner with CUDA backend", - "binaryDir": "${sourceDir}/../../../cmake-out/examples/models/llama", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_FIND_ROOT_PATH": "${sourceDir}/../../../cmake-out", - "EXECUTORCH_BUILD_CUDA": "ON" - }, - "condition": { - "type": "inList", - "string": "${hostSystemName}", - "list": ["Linux", "Windows"] - } - } - ], - "buildPresets": [ - { - "name": "llama-release", - "displayName": "Build Llama runner in Release mode", - "configurePreset": "llama-release", - "targets": ["llama_main"] - }, - { - "name": "llama-debug", - "displayName": "Build Llama runner in Debug mode", - "configurePreset": "llama-debug", - "targets": ["llama_main"] - }, - { - "name": "llama-cuda-debug", - "displayName": "Build Llama runner in Debug mode with CUDA backend", - "configurePreset": "llama-cuda-debug", - "targets": ["llama_main"] - }, - { - "name": "llama-cuda", - "displayName": "Build Llama runner with CUDA backend", - "configurePreset": "llama-cuda", - "targets": ["llama_main"] - } - ], - "workflowPresets": [ - { - "name": "llama-release", - "displayName": "Configure and build Llama runner in Release mode", - "steps": [ - { - "type": "configure", - "name": "llama-release" - }, - { - "type": "build", - "name": "llama-release" - } - ] - }, - { - "name": "llama-debug", - "displayName": "Configure and build Llama runner in Debug mode", - "steps": [ - { - "type": "configure", - "name": "llama-debug" - }, - { - "type": "build", - "name": "llama-debug" - } - ] - }, - { - "name": "llama-cuda-debug", - "displayName": "Configure and build Llama runner in Debug mode with CUDA backend", - "steps": [ - { - "type": "configure", - "name": "llama-cuda-debug" - }, - { - "type": "build", - "name": "llama-cuda-debug" - } - ] - }, - { - "name": "llama-cuda", - "displayName": "Configure and build Llama runner with CUDA backend", - "steps": [ - { - "type": "configure", - "name": "llama-cuda" - }, - { - "type": "build", - "name": "llama-cuda" - } - ] - } - ] -} diff --git a/examples/models/llava/CMakeLists.txt b/examples/models/llava/CMakeLists.txt index 1e7cdea22d5..9ad58cc6588 100644 --- a/examples/models/llava/CMakeLists.txt +++ b/examples/models/llava/CMakeLists.txt @@ -104,7 +104,7 @@ executorch_target_link_options_shared_lib(quantized_ops_lib) list(APPEND link_libraries quantized_kernels quantized_ops_lib) if(EXECUTORCH_BUILD_KERNELS_LLM) - list(APPEND link_libraries $) + list(APPEND link_libraries custom_ops) endif() set(XNNPACK_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../backends/xnnpack) diff --git a/extension/android/CMakeLists.txt b/extension/android/CMakeLists.txt index c94b95286d0..95ae3efe8bf 100644 --- a/extension/android/CMakeLists.txt +++ b/extension/android/CMakeLists.txt @@ -137,7 +137,7 @@ if(TARGET vulkan_backend) endif() if(EXECUTORCH_BUILD_KERNELS_LLM) - list(APPEND link_libraries $) + list(APPEND link_libraries custom_ops) endif() if(TARGET pthreadpool)