Skip to content

Add quantized cmake option back to fix build-apple-framework #3115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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
1 change: 1 addition & 0 deletions .ci/scripts/test_llama.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ cmake_install_executorch_libraries() {
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
-DEXECUTORCH_BUILD_CUSTOM="$CUSTOM" \
-DEXECUTORCH_BUILD_OPTIMIZED=ON \
-DEXECUTORCH_BUILD_QUANTIZED=ON \
-DEXECUTORCH_BUILD_XNNPACK="$XNNPACK" \
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
-Bcmake-out .
Expand Down
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ option(EXECUTORCH_BUILD_QNN "Build the Qualcomm backend" OFF)

option(EXECUTORCH_BUILD_OPTIMIZED "Build the optimized kernels" OFF)

option(EXECUTORCH_BUILD_QUANTIZED "Build the quantized kernels" OFF)

option(EXECUTORCH_BUILD_SDK "Build the ExecuTorch SDK")

option(EXECUTORCH_BUILD_SIZE_TEST "Build the size test" OFF)
Expand Down Expand Up @@ -411,7 +413,9 @@ if(EXECUTORCH_BUILD_OPTIMIZED)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/optimized)
endif()

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/quantized)
if(EXECUTORCH_BUILD_QUANTIZED)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/quantized)
endif()

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/configurations)

Expand Down Expand Up @@ -441,14 +445,19 @@ cmake_dependent_option(
EXECUTORCH_BUILD_HOST_TARGETS OFF)
if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
# Baseline libraries that executor_runner will link against.
set(_executor_runner_libs executorch gflags quantized_ops_lib)
set(_executor_runner_libs executorch gflags)

if(EXECUTORCH_BUILD_OPTIMIZED)
list(APPEND _executor_runner_libs optimized_native_cpu_ops_lib)
else()
list(APPEND _executor_runner_libs portable_ops_lib)
endif()

# Generate lib to register quantized ops
if(EXECUTORCH_BUILD_QUANTIZED)
list(APPEND _executor_runner_libs quantized_ops_lib)
endif()

add_executable(executor_runner ${_executor_runner__srcs})
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT APPLE)
target_link_options(executor_runner PRIVATE "LINKER:--gc-sections")
Expand Down
2 changes: 2 additions & 0 deletions build/Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ function(executorch_print_configuration_summary)
STATUS " EXECUTORCH_BUILD_QNN : ${EXECUTORCH_BUILD_QNN}")
message(STATUS " EXECUTORCH_BUILD_OPTIMIZED : "
"${EXECUTORCH_BUILD_OPTIMIZED}")
message(STATUS " EXECUTORCH_BUILD_QUANTIZED : "
"${EXECUTORCH_BUILD_QUANTIZED}")
message(
STATUS " EXECUTORCH_BUILD_SDK : ${EXECUTORCH_BUILD_SDK}")
message(
Expand Down
7 changes: 5 additions & 2 deletions build/build_apple_frameworks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CUSTOM=OFF
MPS=OFF
OPTIMIZED=OFF
PORTABLE=OFF
QUANTIZED=ON
QUANTIZED=OFF
XNNPACK=OFF
HEADERS_PATH="include"
EXECUTORCH_FRAMEWORK="executorch:libexecutorch.a,libexecutorch_no_prim_ops.a,libextension_apple.a,libextension_data_loader.a,libextension_module.a:$HEADERS_PATH"
Expand Down Expand Up @@ -51,6 +51,7 @@ usage() {
echo " --mps Include this flag to build the Metal Performance Shaders backend."
echo " --optimized Include this flag to build the Optimized backend."
echo " --portable Include this flag to build the Portable backend."
echo " --quantized Include this flag to build the Quantized backend."
echo " --xnnpack Include this flag to build the XNNPACK backend."
echo
echo "Example:"
Expand All @@ -73,6 +74,7 @@ for arg in "$@"; do
--mps) MPS=ON ;;
--optimized) OPTIMIZED=ON ;;
--portable) PORTABLE=ON ;;
--quantized) QUANTIZED=ON ;;
--xnnpack) XNNPACK=ON ;;
*)
if [[ -z "$SOURCE_ROOT_DIR" ]]; then
Expand Down Expand Up @@ -135,6 +137,7 @@ cmake_build() {
-DEXECUTORCH_BUILD_CUSTOM=$CUSTOM \
-DEXECUTORCH_BUILD_MPS=$MPS \
-DEXECUTORCH_BUILD_OPTIMIZED=$OPTIMIZED \
-DEXECUTORCH_BUILD_QUANTIZED=$QUANTIZED \
-DEXECUTORCH_BUILD_XNNPACK=$XNNPACK \
${platform_flag:+-DIOS_PLATFORM=$platform_flag}
cmake --build . --config $MODE
Expand Down Expand Up @@ -178,7 +181,7 @@ append_framework_flag "$CUSTOM" "$CUSTOM_FRAMEWORK"
append_framework_flag "$MPS" "$MPS_FRAMEWORK"
append_framework_flag "$OPTIMIZED" "$OPTIMIZED_FRAMEWORK"
append_framework_flag "$PORTABLE" "$PORTABLE_FRAMEWORK"
append_framework_flag "ON" "$QUANTIZED_FRAMEWORK"
append_framework_flag "$QUANTIZED" "$QUANTIZED_FRAMEWORK"
append_framework_flag "$XNNPACK" "$XNNPACK_FRAMEWORK"

"$SOURCE_ROOT_DIR"/build/create_frameworks.sh "${FRAMEWORK_FLAGS[@]}"
Expand Down