Skip to content

Commit eb47c4e

Browse files
larryliu0820facebook-github-bot
authored andcommitted
Add quantized cmake option back to fix build-apple-framework (#3115)
Summary: As titled. Got too excited in #3062 and removed `EXECUTORCH_BUILD_QUANTIZED`. Looking at the CI job failure of `build-apple-framework` probably worth adding it back. Pull Request resolved: #3115 Test Plan: See that CI job pass Reviewed By: shoumikhin Differential Revision: D56281923 Pulled By: larryliu0820 fbshipit-source-id: e6ad411f763ff8e11d4fb1e0bc7037eb2cf69357
1 parent 6510625 commit eb47c4e

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

.ci/scripts/test_llama.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ cmake_install_executorch_libraries() {
7575
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
7676
-DEXECUTORCH_BUILD_CUSTOM="$CUSTOM" \
7777
-DEXECUTORCH_BUILD_OPTIMIZED=ON \
78+
-DEXECUTORCH_BUILD_QUANTIZED=ON \
7879
-DEXECUTORCH_BUILD_XNNPACK="$XNNPACK" \
7980
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
8081
-Bcmake-out .

CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ option(EXECUTORCH_BUILD_QNN "Build the Qualcomm backend" OFF)
164164

165165
option(EXECUTORCH_BUILD_OPTIMIZED "Build the optimized kernels" OFF)
166166

167+
option(EXECUTORCH_BUILD_QUANTIZED "Build the quantized kernels" OFF)
168+
167169
option(EXECUTORCH_BUILD_SDK "Build the ExecuTorch SDK")
168170

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

414-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/quantized)
416+
if(EXECUTORCH_BUILD_QUANTIZED)
417+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/quantized)
418+
endif()
415419

416420
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/configurations)
417421

@@ -441,14 +445,19 @@ cmake_dependent_option(
441445
EXECUTORCH_BUILD_HOST_TARGETS OFF)
442446
if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
443447
# Baseline libraries that executor_runner will link against.
444-
set(_executor_runner_libs executorch gflags quantized_ops_lib)
448+
set(_executor_runner_libs executorch gflags)
445449

446450
if(EXECUTORCH_BUILD_OPTIMIZED)
447451
list(APPEND _executor_runner_libs optimized_native_cpu_ops_lib)
448452
else()
449453
list(APPEND _executor_runner_libs portable_ops_lib)
450454
endif()
451455

456+
# Generate lib to register quantized ops
457+
if(EXECUTORCH_BUILD_QUANTIZED)
458+
list(APPEND _executor_runner_libs quantized_ops_lib)
459+
endif()
460+
452461
add_executable(executor_runner ${_executor_runner__srcs})
453462
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT APPLE)
454463
target_link_options(executor_runner PRIVATE "LINKER:--gc-sections")

build/Utils.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ function(executorch_print_configuration_summary)
7474
STATUS " EXECUTORCH_BUILD_QNN : ${EXECUTORCH_BUILD_QNN}")
7575
message(STATUS " EXECUTORCH_BUILD_OPTIMIZED : "
7676
"${EXECUTORCH_BUILD_OPTIMIZED}")
77+
message(STATUS " EXECUTORCH_BUILD_QUANTIZED : "
78+
"${EXECUTORCH_BUILD_QUANTIZED}")
7779
message(
7880
STATUS " EXECUTORCH_BUILD_SDK : ${EXECUTORCH_BUILD_SDK}")
7981
message(

build/build_apple_frameworks.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CUSTOM=OFF
2222
MPS=OFF
2323
OPTIMIZED=OFF
2424
PORTABLE=OFF
25-
QUANTIZED=ON
25+
QUANTIZED=OFF
2626
XNNPACK=OFF
2727
HEADERS_PATH="include"
2828
EXECUTORCH_FRAMEWORK="executorch:libexecutorch.a,libexecutorch_no_prim_ops.a,libextension_apple.a,libextension_data_loader.a,libextension_module.a:$HEADERS_PATH"
@@ -51,6 +51,7 @@ usage() {
5151
echo " --mps Include this flag to build the Metal Performance Shaders backend."
5252
echo " --optimized Include this flag to build the Optimized backend."
5353
echo " --portable Include this flag to build the Portable backend."
54+
echo " --quantized Include this flag to build the Quantized backend."
5455
echo " --xnnpack Include this flag to build the XNNPACK backend."
5556
echo
5657
echo "Example:"
@@ -73,6 +74,7 @@ for arg in "$@"; do
7374
--mps) MPS=ON ;;
7475
--optimized) OPTIMIZED=ON ;;
7576
--portable) PORTABLE=ON ;;
77+
--quantized) QUANTIZED=ON ;;
7678
--xnnpack) XNNPACK=ON ;;
7779
*)
7880
if [[ -z "$SOURCE_ROOT_DIR" ]]; then
@@ -135,6 +137,7 @@ cmake_build() {
135137
-DEXECUTORCH_BUILD_CUSTOM=$CUSTOM \
136138
-DEXECUTORCH_BUILD_MPS=$MPS \
137139
-DEXECUTORCH_BUILD_OPTIMIZED=$OPTIMIZED \
140+
-DEXECUTORCH_BUILD_QUANTIZED=$QUANTIZED \
138141
-DEXECUTORCH_BUILD_XNNPACK=$XNNPACK \
139142
${platform_flag:+-DIOS_PLATFORM=$platform_flag}
140143
cmake --build . --config $MODE
@@ -178,7 +181,7 @@ append_framework_flag "$CUSTOM" "$CUSTOM_FRAMEWORK"
178181
append_framework_flag "$MPS" "$MPS_FRAMEWORK"
179182
append_framework_flag "$OPTIMIZED" "$OPTIMIZED_FRAMEWORK"
180183
append_framework_flag "$PORTABLE" "$PORTABLE_FRAMEWORK"
181-
append_framework_flag "ON" "$QUANTIZED_FRAMEWORK"
184+
append_framework_flag "$QUANTIZED" "$QUANTIZED_FRAMEWORK"
182185
append_framework_flag "$XNNPACK" "$XNNPACK_FRAMEWORK"
183186

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

0 commit comments

Comments
 (0)