Skip to content

Commit 497ea70

Browse files
committed
Update
[ghstack-poisoned]
2 parents b87d2fb + 2dacf6f commit 497ea70

File tree

100 files changed

+5517
-567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+5517
-567
lines changed

.ci/docker/ci_commit_pins/pytorch.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7cda4017ddda554752e89069ae205be5e8388f59
1+
90f1e7bed15ca5e48c61c5b6dc5ad4810524f82f

.ci/scripts/test_phi_3_mini.sh

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

2424
cmake_install_executorch_libraries() {
25-
cmake -DPYTHON_EXECUTABLE=python \
26-
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
27-
-DEXECUTORCH_ENABLE_LOGGING=1 \
28-
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
29-
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
30-
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
31-
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
32-
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
33-
-DEXECUTORCH_BUILD_XNNPACK=ON \
34-
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
35-
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
36-
-DEXECUTORCH_BUILD_KERNELS_LLM=ON \
37-
-B${BUILD_DIR} .
38-
39-
cmake --build ${BUILD_DIR} -j${NPROC} --target install --config ${BUILD_TYPE}
25+
rm -rf cmake-out
26+
cmake --preset llm -DCMAKE_INSTALL_PREFIX=cmake-out -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
27+
cmake --build cmake-out -j16 --target install --config ${BUILD_TYPE}
4028
}
4129

4230
cmake_build_phi_3_mini() {
43-
cmake -DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
44-
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
31+
cmake -DCMAKE_PREFIX_PATH=${BUILD_DIR} \
4532
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
46-
-DEXECUTORCH_BUILD_KERNELS_LLM=ON \
47-
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
48-
-DEXECUTORCH_BUILD_XNNPACK=ON \
49-
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
5033
-B${BUILD_DIR}/${MODEL_DIR} \
5134
${MODEL_DIR}
5235

@@ -81,7 +64,7 @@ run_and_verify() {
8164
${BUILD_DIR}/${MODEL_DIR}/phi_3_mini_runner \
8265
--model_path=phi-3-mini.pte \
8366
--tokenizer_path=tokenizer.bin \
84-
--seq_len=128 \
67+
--seq_len=60 \
8568
--temperature=0 \
8669
--prompt="<|system|>
8770
You are a helpful assistant.<|end|>

.ci/scripts/unittest-buck2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -eux
1010
# TODO: can't query cadence & vulkan backends
1111
# TODO: can't query //kernels/prim_ops because of non-buckified stuff in OSS.
1212
buck2 query "//backends/apple/... + //backends/example/... + \
13-
//backends/mediatek/... + //backends/test/... + //backends/transforms/... + \
13+
//backends/mediatek/... + //backends/transforms/... + \
1414
//backends/xnnpack/... + //configurations/... + //kernels/aten/... + \
1515
//kernels/optimized/... + //kernels/portable/... + //kernels/quantized/... + \
1616
//kernels/test/... + //runtime/... + //schema/... + //test/... + //util/..."

.github/workflows/build-wheels-linux.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
- examples/**/*
1010
- pyproject.toml
1111
- setup.py
12+
tags:
13+
- ciflow/binaries/*
1214
push:
1315
branches:
1416
- nightly

.github/workflows/build-wheels-macos.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
- examples/**/*
1010
- pyproject.toml
1111
- setup.py
12+
tags:
13+
- ciflow/binaries/*
1214
push:
1315
branches:
1416
- nightly

.github/workflows/pull.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ jobs:
603603
bash examples/models/phi-3-mini/install_requirements.sh
604604
605605
# run e2e (export, tokenizer and runner)
606-
PYTHON_EXECUTABLE=python bash .ci/scripts/test_phi_3_mini.sh
606+
PYTHON_EXECUTABLE=python bash .ci/scripts/test_phi_3_mini.sh Release
607607
608608
test-eval_llama-wikitext-linux:
609609
name: test-eval_llama-wikitext-linux

.github/workflows/trunk.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ jobs:
197197
docker-image: executorch-ubuntu-22.04-arm-sdk
198198
submodules: 'recursive'
199199
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
200-
timeout: 90
200+
timeout: 120
201201
script: |
202202
# The generic Linux job chooses to use base env, not the one setup by the image
203203
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
@@ -800,3 +800,6 @@ jobs:
800800
801801
# Run pytest
802802
PYTHON_EXECUTABLE=python bash backends/nxp/run_unittests.sh
803+
804+
# Run aot example:
805+
PYTHON_EXECUTABLE=python bash examples/nxp/run_aot_example.sh

CMakeLists.txt

Lines changed: 54 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -182,39 +182,49 @@ endif()
182182

183183
if(EXECUTORCH_BUILD_CPUINFO)
184184
# --- cpuinfo
185-
set(ORIGINAL_CMAKE_POSITION_INDEPENDENT_CODE_FLAG
186-
${CMAKE_POSITION_INDEPENDENT_CODE}
187-
)
188-
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
189-
set(CPUINFO_SOURCE_DIR "backends/xnnpack/third-party/cpuinfo")
190-
set(CPUINFO_BUILD_TOOLS
191-
OFF
192-
CACHE BOOL ""
193-
)
194-
set(CPUINFO_BUILD_UNIT_TESTS
195-
OFF
196-
CACHE BOOL ""
185+
set(CPUINFO_SOURCE_DIR
186+
"${CMAKE_CURRENT_LIST_DIR}/backends/xnnpack/third-party/cpuinfo"
197187
)
198-
set(CPUINFO_BUILD_MOCK_TESTS
199-
OFF
200-
CACHE BOOL ""
188+
set(CPUINFO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/cpuinfo")
189+
set(CPUINFO_INSTALL_DIR "${CPUINFO_BINARY_DIR}/install")
190+
set(CPUINFO_LIBRARY
191+
"${CPUINFO_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/libcpuinfo.a"
201192
)
202-
set(CPUINFO_BUILD_BENCHMARKS
203-
OFF
204-
CACHE BOOL ""
205-
)
206-
set(CPUINFO_LIBRARY_TYPE
207-
"static"
208-
CACHE STRING ""
209-
)
210-
set(CPUINFO_LOG_LEVEL
211-
"error"
212-
CACHE STRING ""
193+
194+
get_extra_cmake_args_for_external_project(CPUINFO_EXTRA_CMAKE_ARGS)
195+
ExternalProject_Add(
196+
cpuinfoExternalProject
197+
SOURCE_DIR "${CPUINFO_SOURCE_DIR}"
198+
BINARY_DIR "${CPUINFO_BINARY_DIR}"
199+
INSTALL_DIR "${CPUINFO_INSTALL_DIR}"
200+
BUILD_BYPRODUCTS "${CPUINFO_LIBRARY}"
201+
CMAKE_ARGS "${CPUINFO_EXTRA_CMAKE_ARGS}"
202+
-D
203+
CMAKE_POSITION_INDEPENDENT_CODE=ON
204+
-D
205+
CPUINFO_BUILD_TOOLS=OFF
206+
-D
207+
CPUINFO_BUILD_UNIT_TESTS=OFF
208+
-D
209+
CPUINFO_BUILD_MOCK_TESTS=OFF
210+
-D
211+
CPUINFO_BUILD_BENCHMARKS=OFF
212+
-D
213+
CPUINFO_LIBRARY_TYPE=static
214+
-D
215+
CPUINFO_LOG_LEVEL=error
216+
-D
217+
CMAKE_INSTALL_PREFIX=<INSTALL_DIR>
218+
-D
219+
CLOG_SOURCE_DIR="${CPUINFO_SOURCE_DIR}/deps/clog"
213220
)
214-
set(CLOG_SOURCE_DIR "${CPUINFO_SOURCE_DIR}/deps/clog")
215-
add_subdirectory("${CPUINFO_SOURCE_DIR}")
216-
set(CMAKE_POSITION_INDEPENDENT_CODE
217-
${ORIGINAL_CMAKE_POSITION_INDEPENDENT_CODE_FLAG}
221+
add_library(cpuinfo STATIC IMPORTED)
222+
set_property(TARGET cpuinfo PROPERTY IMPORTED_LOCATION "${CPUINFO_LIBRARY}")
223+
add_dependencies(cpuinfo cpuinfoExternalProject)
224+
# Trailing slash matters here! "Move everything from the temporary pthreadpool
225+
# install directory to the proper install directory."
226+
install(DIRECTORY "${CPUINFO_INSTALL_DIR}/"
227+
DESTINATION "${CMAKE_INSTALL_PREFIX}"
218228
)
219229
endif()
220230

@@ -223,23 +233,24 @@ if(EXECUTORCH_BUILD_PTHREADPOOL)
223233
set(PTHREADPOOL_SOURCE_DIR
224234
"${CMAKE_CURRENT_LIST_DIR}/backends/xnnpack/third-party/pthreadpool"
225235
)
226-
if(APPLE)
227-
set(PTHREADPOOL_SYNC_PRIMITIVE
228-
"condvar"
229-
CACHE STRING ""
230-
)
231-
endif()
232236
include(ExternalProject)
237+
include(GNUInstallDirs)
233238
set(PTHREADPOOL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/pthreadpool")
239+
set(PTHREADPOOL_INSTALL_DIR "${PTHREADPOOL_BINARY_DIR}/install")
234240
set(PTHREADPOOL_LIBRARY
235-
"${PTHREADPOOL_BINARY_DIR}/install/lib/libpthreadpool.a"
241+
"${PTHREADPOOL_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/libpthreadpool.a"
236242
)
237243
get_extra_cmake_args_for_external_project(PTHREADPOOL_EXTRA_CMAKE_ARGS)
244+
if(APPLE)
245+
list(APPEND PTHREADPOOL_EXTRA_CMAKE_ARGS -D
246+
PTHREADPOOL_SYNC_PRIMITIVE=condvar
247+
)
248+
endif()
238249
ExternalProject_Add(
239250
pthreadpoolExternalProject
240251
SOURCE_DIR "${PTHREADPOOL_SOURCE_DIR}"
241252
BINARY_DIR "${PTHREADPOOL_BINARY_DIR}"
242-
INSTALL_DIR "${PTHREADPOOL_BINARY_DIR}/install"
253+
INSTALL_DIR "${PTHREADPOOL_INSTALL_DIR}"
243254
BUILD_BYPRODUCTS "${PTHREADPOOL_LIBRARY}"
244255
CMAKE_ARGS ${PTHREADPOOL_EXTRA_CMAKE_ARGS}
245256
-D
@@ -251,8 +262,6 @@ if(EXECUTORCH_BUILD_PTHREADPOOL)
251262
-D
252263
PTHREADPOOL_ALLOW_DEPRECATED_API=ON
253264
-D
254-
PTHREADPOOL_SYNC_PRIMITVE=${PTHREADPOOL_SYNC_PRIMITIVE}
255-
-D
256265
CMAKE_POSITION_INDEPENDENT_CODE=ON
257266
-D
258267
CMAKE_INSTALL_PREFIX=<INSTALL_DIR>
@@ -262,7 +271,11 @@ if(EXECUTORCH_BUILD_PTHREADPOOL)
262271
TARGET pthreadpool PROPERTY IMPORTED_LOCATION "${PTHREADPOOL_LIBRARY}"
263272
)
264273
add_dependencies(pthreadpool pthreadpoolExternalProject)
265-
install(FILES ${PTHREADPOOL_LIBRARY} DESTINATION ${CMAKE_INSTALL_LIBDIR})
274+
# Trailing slash matters here! "Move everything from the temporary pthreadpool
275+
# install directory to the proper install directory."
276+
install(DIRECTORY "${PTHREADPOOL_INSTALL_DIR}/"
277+
DESTINATION "${CMAKE_INSTALL_PREFIX}"
278+
)
266279
endif()
267280

268281
# TODO(dbort): Fix these warnings and remove this flag.

backends/arm/quantizer/arm_quantizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
@functools.lru_cache
6262
def get_symmetric_quantization_config(
63-
is_per_channel: bool = False,
63+
is_per_channel: bool = True,
6464
is_qat: bool = False,
6565
is_dynamic: bool = False,
6666
act_qmin: int = -128,

backends/arm/test/common.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
arm_executor_runner_exists,
1919
corstone300_installed,
2020
corstone320_installed,
21+
model_converter_installed,
2122
)
2223
from executorch.backends.arm.tosa_specification import TosaSpecification
2324
from executorch.exir.backend.compile_spec_schema import CompileSpec
@@ -245,6 +246,13 @@ def get_u85_compile_spec_unbuilt(
245246
)
246247
"""Xfails a test if Corsone320 FVP is not installed, or if the executor runner is not built"""
247248

249+
SkipIfNoModelConverter = pytest.mark.skipif(
250+
condition=not (model_converter_installed()),
251+
raises=FileNotFoundError,
252+
reason="Did not find model-converter on path",
253+
)
254+
"""Xfails a test if model-converter is not installed"""
255+
248256
xfail_type = str | tuple[str, type[Exception]]
249257

250258

0 commit comments

Comments
 (0)