Skip to content

Commit

Permalink
update et.cmake for native (#712)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucylq authored and malfet committed Jul 17, 2024
1 parent a352854 commit 4a318a4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -915,9 +915,8 @@ jobs:
- if: ${{ steps.install-et.outputs.cache-hit != 'true' }}
continue-on-error: true
run: |
echo "Intalling ExecuTorch"
export TORCHCHAT_ROOT=${PWD}
bash scripts/install_et.sh
echo "Installing ExecuTorch"
bash scripts/build_native.sh et
- name: Install ET pip
run: |
echo "ET build directory"
Expand Down
2 changes: 1 addition & 1 deletion runner/build_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export CMAKE_OUT_DIR="cmake-out-android"
build_runner_et() {
rm -rf cmake-out-android
echo "ET BUILD DIR IS ${ET_BUILD_DIR}"
cmake -DET_USE_ADPATIVE_THREADS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-23 -S . -B cmake-out-android -G Ninja
cmake -DET_USE_ADAPTIVE_THREADS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-23 -S . -B cmake-out-android -G Ninja
cmake --build cmake-out-android/ -j16 --config Release --target et_run
}

Expand Down
4 changes: 2 additions & 2 deletions runner/et.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ if(executorch_FOUND)

set(_srcs runner/run.cpp)
set(_common_compile_options -D__ET__MODEL -D_GLIBCXX_USE_CXX11_ABI=1)
if(ET_USE_ADPATIVE_THREADS)
list(APPEND _common_compile_options -DET_USE_ADPATIVE_THREADS)
if(ET_USE_ADAPTIVE_THREADS)
list(APPEND _common_compile_options -DET_USE_ADAPTIVE_THREADS)

set(EXECUTORCH_SRC_ROOT ${TORCHCHAT_ROOT}/${ET_BUILD_DIR}/src/executorch)
set(XNNPACK_ROOT ${EXECUTORCH_SRC_ROOT}/backends/xnnpack)
Expand Down
4 changes: 2 additions & 2 deletions runner/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ torch::Device cpu_device(torch::kCPU);
#include <executorch/runtime/core/exec_aten/exec_aten.h>
#include <executorch/runtime/core/exec_aten/util/scalar_type_util.h>

#if defined(ET_USE_ADPATIVE_THREADS)
#if defined(ET_USE_ADAPTIVE_THREADS)
#include <executorch/backends/xnnpack/threadpool/cpuinfo_utils.h>
#include <executorch/backends/xnnpack/threadpool/threadpool.h>
#endif
Expand Down Expand Up @@ -823,7 +823,7 @@ int main(int argc, char* argv[]) {
int vocab_size = -1;
int llama_ver = 2;

#if defined(ET_USE_ADPATIVE_THREADS)
#if defined(ET_USE_ADAPTIVE_THREADS)
uint32_t num_performant_cores =
torch::executorch::cpuinfo::get_num_performant_cores();
if (num_performant_cores > 0) {
Expand Down
5 changes: 3 additions & 2 deletions scripts/install_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ clone_executorch() {
install_executorch_python_libs() {
if [ ! -d "${TORCHCHAT_ROOT}/${ET_BUILD_DIR}" ]; then
echo "Directory ${TORCHCHAT_ROOT}/${ET_BUILD_DIR} does not exist."
echo "Make sur eyou run clone_executorch"
echo "Make sure you run clone_executorch"
exit 1
fi
pushd ${TORCHCHAT_ROOT}/${ET_BUILD_DIR}/src
Expand All @@ -63,7 +63,8 @@ COMMON_CMAKE_ARGS="\
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON"
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
-DEXECUTORCH_BUILD_XNNPACK=ON"

install_executorch() {
# AOT lib has to be build for model export
Expand Down

0 comments on commit 4a318a4

Please sign in to comment.