Skip to content

Commit 086820e

Browse files
committed
Update on "Remove ExecuTorch copy of Vectorized"
All uses are outside ExecuTorch core, so we can just use ATen Vectorized. Differential Revision: [D66396016](https://our.internmc.facebook.com/intern/diff/D66396016/) [ghstack-poisoned]
2 parents fa5f813 + 201c051 commit 086820e

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

.ci/scripts/build_llama_android.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
1515
fi
1616
which "${PYTHON_EXECUTABLE}"
1717
CMAKE_PREFIX_PATH="$(python3 -c 'import torch as _; print(_.__path__[0])')"
18-
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
1918

2019
install_executorch_and_backend_lib() {
2120
echo "Installing executorch and xnnpack backend"
@@ -29,7 +28,6 @@ install_executorch_and_backend_lib() {
2928
-DANDROID_ABI="${ANDROID_ABI}" \
3029
-DCMAKE_INSTALL_PREFIX=cmake-android-out \
3130
-DCMAKE_BUILD_TYPE=Release \
32-
-DCMAKE_FIND_ROOT_PATH="${SITE_PACKAGES}" \
3331
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
3432
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
3533
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \

build/build_android_llm_demo.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ build_android_native_library() {
4040
else
4141
EXECUTORCH_BUILD_NEURON=OFF
4242
fi
43-
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
4443

4544
cmake . -DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
46-
-DCMAKE_FIND_ROOT_PATH="${SITE_PACKAGES}" \
4745
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
4846
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
4947
-DANDROID_ABI="${ANDROID_ABI}" \
@@ -78,7 +76,6 @@ build_android_native_library() {
7876
-DANDROID_ABI="${ANDROID_ABI}" \
7977
-DANDROID_PLATFORM=android-26 \
8078
-DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
81-
-DCMAKE_FIND_ROOT_PATH="${SITE_PACKAGES}" \
8279
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
8380
-DEXECUTORCH_ENABLE_LOGGING=ON \
8481
-DEXECUTORCH_LOG_LEVEL=Info \

extension/llm/custom_ops/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ target_compile_options(
6868
install(TARGETS custom_ops DESTINATION lib)
6969

7070
if(EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT)
71-
# Add a AOT library
72-
find_package(Torch CONFIG REQUIRED)
71+
# Use NO_CMAKE_FIND_ROOT_PATH to make sure this works even if
72+
# cross-compiling. See note in kernels/optimized/CMakeLists.txt.
73+
find_package(Torch CONFIG REQUIRED NO_CMAKE_FIND_ROOT_PATH)
7374
add_library(
7475
custom_ops_aot_lib SHARED
7576
${_custom_ops__srcs}

kernels/optimized/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ message("Generated files ${gen_command_sources}")
6363

6464
list(TRANSFORM _optimized_kernels__srcs PREPEND "${EXECUTORCH_ROOT}/")
6565
add_library(optimized_kernels ${_optimized_kernels__srcs})
66-
find_package(Torch CONFIG REQUIRED)
66+
# We require Torch headers, which setup.py puts in CMAKE_PREFIX_PATH
67+
# for us. Toolchains that we might be using for cross-compiling could
68+
# set CMAKE_FIND_ROOT_PATH, which prevents find_package from finding
69+
# headers not rooted under CMAKE_FIND_ROOT_PATH. This is reasonable
70+
# for binary dependencies because they probably aren't built for the
71+
# target platform, but for our header-only use case, we should just
72+
# ignore CMAKE_FIND_ROOT_PATH.
73+
find_package(Torch CONFIG REQUIRED NO_CMAKE_FIND_ROOT_PATH)
6774
target_include_directories(optimized_kernels PRIVATE ${TORCH_INCLUDE_DIRS})
6875
target_link_libraries(
6976
optimized_kernels PRIVATE executorch_core cpublas extension_threadpool

0 commit comments

Comments
 (0)