Skip to content

Commit

Permalink
Arm CI fix (#2771)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2771

- buck issue with inotify limit. Default is 8K. 24K seems to work. Setting it to 1M. Didn't investigate further.
- top CMake always building cpuinfo and threadpool. Added an option to turn it off with ARM_BAREMETAL
- arm example building w/o ARM_BAREMETAL. Added that.

Reviewed By: shoumikhin, Gasoonjia, mikekgfb

Differential Revision: D55538019

fbshipit-source-id: 1a22504d157e47a1052e9b49ca28d56eb5eb22c5
  • Loading branch information
digantdesai authored and facebook-github-bot committed Apr 1, 2024
1 parent f353405 commit 6e2705e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 39 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ jobs:
git config --global user.name "Github Executorch"
bash examples/arm/setup.sh --i-agree-to-the-contained-eula
# Increase number of files user can monitor to bypass buck failures.
# Hopefully this is high enough for this setup.
sudo sysctl fs.inotify.max_user_watches=1048576 # 1024 * 1024
# Test ethos-u delegate examples with run.sh
source examples/arm/ethos-u-scratch/setup_path.sh
PYTHON_EXECUTABLE=python bash examples/arm/run.sh examples/arm/ethos-u-scratch/ buck2
Expand Down
94 changes: 55 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,45 +56,6 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()

# --- cpuinfo
set(CPUINFO_SOURCE_DIR "backends/xnnpack/third-party/cpuinfo")
set(CPUINFO_BUILD_TOOLS
OFF
CACHE BOOL "")
set(CPUINFO_BUILD_UNIT_TESTS
OFF
CACHE BOOL "")
set(CPUINFO_BUILD_MOCK_TESTS
OFF
CACHE BOOL "")
set(CPUINFO_BUILD_BENCHMARKS
OFF
CACHE BOOL "")
set(CPUINFO_LIBRARY_TYPE
"static"
CACHE STRING "")
set(CPUINFO_LOG_LEVEL
"error"
CACHE STRING "")
set(CLOG_SOURCE_DIR "${CPUINFO_SOURCE_DIR}/deps/clog")
add_subdirectory("${CPUINFO_SOURCE_DIR}")

# --- pthreadpool
set(PTHREADPOOL_SOURCE_DIR "backends/xnnpack/third-party/pthreadpool")
set(PTHREADPOOL_BUILD_TESTS
OFF
CACHE BOOL "")
set(PTHREADPOOL_BUILD_BENCHMARKS
OFF
CACHE BOOL "")
set(PTHREADPOOL_LIBRARY_TYPE
"static"
CACHE STRING "")
set(PTHREADPOOL_ALLOW_DEPRECATED_API
ON
CACHE BOOL "")
add_subdirectory("${PTHREADPOOL_SOURCE_DIR}")

# ------------------------------ OPTIONS -------------------------------------
# WARNING: Please don't add example specific options in this CMakeLists.txt.
# Instead please use `find_package(executorch REQUIRED)` in the example
Expand Down Expand Up @@ -211,6 +172,61 @@ option(EXECUTORCH_BUILD_XNNPACK "Build the XNNPACK backend" OFF)

option(EXECUTORCH_BUILD_VULKAN "Build the Vulkan backend" OFF)

#
# pthreadpool: build pthreadpool library. Disable on unsupported platforms
#
cmake_dependent_option(EXECUTORCH_BUILD_PTHREADPOOL "Build pthreadpool library."
ON "NOT EXECUTORCH_BUILD_ARM_BAREMETAL" OFF)

#
# cpuinfo: build cpuinfo library. Disable on unsupported platforms
#
cmake_dependent_option(EXECUTORCH_BUILD_CPUINFO "Build cpuinfo library." ON
"NOT EXECUTORCH_BUILD_ARM_BAREMETAL" OFF)

if(EXECUTORCH_BUILD_CPUINFO)
# --- cpuinfo
set(CPUINFO_SOURCE_DIR "backends/xnnpack/third-party/cpuinfo")
set(CPUINFO_BUILD_TOOLS
OFF
CACHE BOOL "")
set(CPUINFO_BUILD_UNIT_TESTS
OFF
CACHE BOOL "")
set(CPUINFO_BUILD_MOCK_TESTS
OFF
CACHE BOOL "")
set(CPUINFO_BUILD_BENCHMARKS
OFF
CACHE BOOL "")
set(CPUINFO_LIBRARY_TYPE
"static"
CACHE STRING "")
set(CPUINFO_LOG_LEVEL
"error"
CACHE STRING "")
set(CLOG_SOURCE_DIR "${CPUINFO_SOURCE_DIR}/deps/clog")
add_subdirectory("${CPUINFO_SOURCE_DIR}")
endif()

if(EXECUTORCH_BUILD_PTHREADPOOL)
# --- pthreadpool
set(PTHREADPOOL_SOURCE_DIR "backends/xnnpack/third-party/pthreadpool")
set(PTHREADPOOL_BUILD_TESTS
OFF
CACHE BOOL "")
set(PTHREADPOOL_BUILD_BENCHMARKS
OFF
CACHE BOOL "")
set(PTHREADPOOL_LIBRARY_TYPE
"static"
CACHE STRING "")
set(PTHREADPOOL_ALLOW_DEPRECATED_API
ON
CACHE BOOL "")
add_subdirectory("${PTHREADPOOL_SOURCE_DIR}")
endif()

if(NOT PYTHON_EXECUTABLE)
resolve_python_executable()
endif()
Expand Down
7 changes: 7 additions & 0 deletions build/Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ function(executorch_print_configuration_summary)
message(
STATUS
" EXECUTORCH_BUILD_VULKAN : ${EXECUTORCH_BUILD_VULKAN}")
message(
STATUS
" EXECUTORCH_BUILD_PTHREADPOOL : ${EXECUTORCH_BUILD_PTHREADPOOL}")
message(
STATUS
" EXECUTORCH_BUILD_CPUINFO : ${EXECUTORCH_BUILD_CPUINFO}")

endfunction()

# This is the funtion to use -Wl, --whole-archive to link static library NB:
Expand Down
1 change: 1 addition & 0 deletions examples/arm/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ function build_executorch() {
-DCMAKE_INSTALL_PREFIX=${et_build_dir} \
-DCMAKE_BUILD_TYPE=Release \
-DEXECUTORCH_SELECT_OPS_LIST="aten::_softmax.out" \
-DEXECUTORCH_BUILD_ARM_BAREMETAL=ON \
-DCMAKE_TOOLCHAIN_FILE="${toolchain_cmake}" \
-B"${et_build_dir}"/examples/arm \
"${et_root_dir}"/examples/arm
Expand Down

0 comments on commit 6e2705e

Please sign in to comment.