Skip to content

Commit 732b825

Browse files
committed
Update on "Reuse GELU implementation from PyTorch core"
kernels/optimized doesn't need to support embedded systems, so it can just take a header-only dep on PyTorch. Note that, because we will pick up Sleef internally and ignore it externally thanks to ATen vec, this PR gets to enable optimized GELU in OSS. Testing: CI to make sure this doesn't break mobile build modes; happy to take advice on anything not currently covered that might break. Differential Revision: [D66335522](https://our.internmc.facebook.com/intern/diff/D66335522/) [ghstack-poisoned]
2 parents 4ff3b85 + 76988c7 commit 732b825

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

.ci/scripts/build_llama_android.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ 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())')"
1819

1920
install_executorch_and_backend_lib() {
2021
echo "Installing executorch and xnnpack backend"
@@ -28,6 +29,7 @@ install_executorch_and_backend_lib() {
2829
-DANDROID_ABI="${ANDROID_ABI}" \
2930
-DCMAKE_INSTALL_PREFIX=cmake-android-out \
3031
-DCMAKE_BUILD_TYPE=Release \
32+
-DCMAKE_FIND_ROOT_PATH="${SITE_PACKAGES}" \
3133
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
3234
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
3335
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \

build/build_android_llm_demo.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@ 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())')"
4344

44-
echo "BEGIN DEBUG COMMANDS"
45-
ls "${CMAKE_PREFIX_PATH}"
46-
find "${CMAKE_PREFIX_PATH}" -name "*.cmake" || true
47-
echo "END DEBUG COMMANDS"
4845
cmake . -DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
46+
-DCMAKE_FIND_ROOT_PATH="${SITE_PACKAGES}" \
4947
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
5048
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
5149
-DANDROID_ABI="${ANDROID_ABI}" \
@@ -80,6 +78,7 @@ build_android_native_library() {
8078
-DANDROID_ABI="${ANDROID_ABI}" \
8179
-DANDROID_PLATFORM=android-26 \
8280
-DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
81+
-DCMAKE_FIND_ROOT_PATH="${SITE_PACKAGES}" \
8382
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
8483
-DEXECUTORCH_ENABLE_LOGGING=ON \
8584
-DEXECUTORCH_LOG_LEVEL=Info \

kernels/optimized/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ generate_bindings_for_kernels(
6161
)
6262
message("Generated files ${gen_command_sources}")
6363

64-
message("DEBUG: cmake_prefix_path is ${CMAKE_PREFIX_PATH}")
6564
list(TRANSFORM _optimized_kernels__srcs PREPEND "${EXECUTORCH_ROOT}/")
6665
add_library(optimized_kernels ${_optimized_kernels__srcs})
6766
find_package(Torch CONFIG REQUIRED)

0 commit comments

Comments
 (0)