Skip to content

Commit 98c80a0

Browse files
author
Github Executorch
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 e36efc3 + 3860e95 commit 98c80a0

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

.ci/scripts/build_llama_android.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ install_executorch_and_backend_lib() {
3838
build_llama_runner() {
3939
echo "Building llama runner for Android..."
4040
ANDROID_ABI=arm64-v8a
41+
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
42+
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"
4143
cmake -DBUCK2="${BUCK2}" \
4244
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK"/build/cmake/android.toolchain.cmake \
4345
-DANDROID_ABI="${ANDROID_ABI}" \
@@ -47,6 +49,7 @@ build_llama_runner() {
4749
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
4850
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
4951
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
52+
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
5053
-Bcmake-android-out/examples/models/llama examples/models/llama
5154

5255
cmake --build cmake-android-out/examples/models/llama -j4 --config Release

.ci/scripts/test_model.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@ prepare_artifacts_upload() {
5050

5151
build_cmake_executor_runner() {
5252
echo "Building executor_runner"
53+
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
54+
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"
5355
rm -rf ${CMAKE_OUTPUT_DIR}
5456
cmake -DCMAKE_BUILD_TYPE=Debug \
5557
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
5658
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
59+
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
5760
-B${CMAKE_OUTPUT_DIR} .
5861

5962
cmake --build ${CMAKE_OUTPUT_DIR} -j4 --config Debug

.ci/scripts/test_phi_3_mini.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ NPROC=8
2222
if hash nproc &> /dev/null; then NPROC=$(nproc); fi
2323

2424
cmake_install_executorch_libraries() {
25+
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
26+
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"
2527
cmake -DPYTHON_EXECUTABLE=python \
2628
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
29+
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
2730
-DEXECUTORCH_ENABLE_LOGGING=1 \
2831
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
2932
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
@@ -39,8 +42,11 @@ cmake_install_executorch_libraries() {
3942
}
4043

4144
cmake_build_phi_3_mini() {
45+
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
46+
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"
4247
cmake -DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
4348
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
49+
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
4450
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
4551
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
4652
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \

test/run_oss_cpp_tests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ build_executorch() {
2727
if [ -x "$(command -v glslc)" ]; then
2828
BUILD_VULKAN="ON"
2929
fi
30+
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
31+
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"
3032
cmake . \
3133
-DCMAKE_INSTALL_PREFIX=cmake-out \
34+
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
3235
-DEXECUTORCH_USE_CPP_CODE_COVERAGE=ON \
3336
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
3437
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \

0 commit comments

Comments
 (0)