Skip to content

Commit c5fab3f

Browse files
authored
Merge branch 'main' into export-D79911643
2 parents 1275416 + ea4a7fa commit c5fab3f

Some content is hidden

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

52 files changed

+1489
-425
lines changed

.Package.swift/kernels_torchao/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_torchao_debug/dummy.swift

Whitespace-only changes.

.ci/scripts/test_llama_torchao_lowbit.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,22 @@ cmake -DPYTHON_EXECUTABLE=python \
2929
-DEXECUTORCH_ENABLE_LOGGING=1 \
3030
-DCMAKE_BUILD_TYPE=Release \
3131
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
32-
-DEXECUTORCH_BUILD_EXTENSION_LLM=ON \
33-
-DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON \
34-
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
3532
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
33+
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
3634
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
3735
-DEXECUTORCH_BUILD_XNNPACK=OFF \
3836
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
3937
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
38+
-DEXECUTORCH_BUILD_KERNELS_TORCHAO=ON \
39+
-DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON \
40+
-DEXECUTORCH_BUILD_EXTENSION_LLM=ON \
4041
-DEXECUTORCH_BUILD_KERNELS_LLM=ON \
4142
-Bcmake-out .
42-
cmake --build cmake-out -j16 --target install --config Release
43+
cmake --build cmake-out -j16 --config Release --target install
4344

4445
# Install llama runner with torchao
4546
cmake -DPYTHON_EXECUTABLE=python \
46-
-DBUILD_TESTING=OFF \
4747
-DCMAKE_BUILD_TYPE=Release \
48-
-DEXECUTORCH_BUILD_KERNELS_LLM=ON \
49-
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
50-
-DEXECUTORCH_BUILD_XNNPACK=OFF \
51-
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
52-
-DEXECUTORCH_BUILD_TORCHAO=ON \
5348
-Bcmake-out/examples/models/llama \
5449
examples/models/llama
5550
cmake --build cmake-out/examples/models/llama -j16 --config Release

.github/workflows/trunk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ jobs:
485485
eval "$(conda shell.bash hook)"
486486
487487
# Install requirements
488-
${CONDA_RUN} EXECUTORCH_BUILD_TORCHAO=1 python install_executorch.py
488+
${CONDA_RUN} EXECUTORCH_BUILD_KERNELS_TORCHAO=1 python install_executorch.py
489489
${CONDA_RUN} sh examples/models/llama/install_requirements.sh
490490
491491
# Run test

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
[submodule "backends/arm/third-party/ethos-u-core-driver"]
22
path = backends/arm/third-party/ethos-u-core-driver
33
url = https://git.gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u-core-driver.git
4-
[submodule "backends/arm/third-party/serialization_lib"]
5-
path = backends/arm/third-party/serialization_lib
6-
url = https://git.gitlab.arm.com/tosa/tosa-serialization.git
74
[submodule "backends/vulkan/third-party/Vulkan-Headers"]
85
path = backends/vulkan/third-party/Vulkan-Headers
96
url = https://github.com/KhronosGroup/Vulkan-Headers

CMakeLists.txt

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -278,29 +278,6 @@ if(EXECUTORCH_BUILD_PTHREADPOOL)
278278
)
279279
endif()
280280

281-
if(EXECUTORCH_BUILD_KERNELS_TORCHAO)
282-
set(TORCHAO_BUILD_ATEN_OPS OFF)
283-
set(TORCHAO_BUILD_EXECUTORCH_OPS ON)
284-
set(TORCHAO_BUILD_CPU_AARCH64 ON)
285-
set(TORCHAO_ENABLE_ARM_NEON_DOT ON)
286-
287-
list(
288-
APPEND
289-
TORCHAO_INCLUDE_DIRS
290-
${EXECUTORCH_ROOT}/backends/xnnpack/third-party/pthreadpool/include
291-
${EXECUTORCH_ROOT}/backends/xnnpack/third-party/cpuinfo/include
292-
${EXECUTORCH_ROOT}/third-party/ao
293-
)
294-
295-
set(EXECUTORCH_INCLUDE_DIRS ${TORCHAO_INCLUDE_DIRS})
296-
297-
add_subdirectory(
298-
${CMAKE_CURRENT_SOURCE_DIR}/third-party/ao/torchao/experimental
299-
)
300-
executorch_target_link_options_shared_lib(torchao_ops_executorch)
301-
list(APPEND _executorch_kernels torchao_ops_executorch)
302-
endif()
303-
304281
if(EXECUTORCH_BUILD_TESTS)
305282
set(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON)
306283
include(CTest)
@@ -705,6 +682,65 @@ if(EXECUTORCH_BUILD_PTHREADPOOL AND EXECUTORCH_BUILD_CPUINFO)
705682
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/threadpool)
706683
endif()
707684

685+
if(EXECUTORCH_BUILD_KERNELS_TORCHAO)
686+
if(NOT TARGET cpuinfo)
687+
message(
688+
FATAL_ERROR
689+
"EXECUTORCH_BUILD_KERNELS_TORCHAO requires EXECUTORCH_BUILD_CPUINFO be set ON"
690+
)
691+
endif()
692+
if(NOT TARGET pthreadpool)
693+
message(
694+
FATAL_ERROR
695+
"EXECUTORCH_BUILD_KERNELS_TORCHAO requires EXECUTORCH_BUILD_PTHREADPOOL be set ON"
696+
)
697+
endif()
698+
699+
# Configure TorchAO kernels
700+
set(TORCHAO_BUILD_ATEN_OPS OFF)
701+
set(TORCHAO_BUILD_EXECUTORCH_OPS ON)
702+
set(TORCHAO_BUILD_CPU_AARCH64 ON)
703+
set(TORCHAO_ENABLE_ARM_NEON_DOT ON)
704+
set(TORCHAO_BUILD_KLEIDIAI ON)
705+
706+
# TorchAO kernels look for EXECUTORCH_INCLUDE_DIRS
707+
if(DEFINED EXECUTORCH_INCLUDE_DIRS)
708+
message(FATAL_ERROR "EXECUTORCH_INCLUDE_DIRS is already defined")
709+
endif()
710+
set(EXECUTORCH_INCLUDE_DIRS
711+
${EXECUTORCH_ROOT}/backends/xnnpack/third-party/pthreadpool/include
712+
${EXECUTORCH_ROOT}/backends/xnnpack/third-party/cpuinfo/include
713+
)
714+
add_subdirectory(
715+
${CMAKE_CURRENT_SOURCE_DIR}/third-party/ao/torchao/experimental
716+
)
717+
unset(EXECUTORCH_INCLUDE_DIRS)
718+
719+
executorch_target_link_options_shared_lib(torchao_ops_executorch)
720+
list(APPEND _executorch_kernels torchao_ops_executorch)
721+
722+
install(
723+
TARGETS torchao_ops_executorch torchao_kernels_aarch64
724+
EXPORT ExecuTorchTargets
725+
DESTINATION lib
726+
INCLUDES
727+
DESTINATION ${_common_include_directories}
728+
)
729+
# If using KleidiAI and XNNPACK has not installed it already, install it
730+
if(TORCHAO_BUILD_KLEIDIAI AND NOT (EXECUTORCH_BUILD_XNNPACK
731+
AND EXECUTORCH_XNNPACK_ENABLE_KLEIDI)
732+
)
733+
install(
734+
TARGETS kleidiai
735+
EXPORT ExecuTorchTargets
736+
DESTINATION lib
737+
INCLUDES
738+
DESTINATION ${_common_include_directories}
739+
)
740+
endif()
741+
742+
endif()
743+
708744
if(EXECUTORCH_BUILD_PYBIND)
709745

710746
# Add codegen tools subdirectory for selective_build pybind module

Package.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ let products = deliverables([
8484
],
8585
],
8686
"kernels_quantized": [:],
87+
"kernels_torchao": [
88+
"targets": [
89+
"threadpool",
90+
],
91+
],
8792
])
8893

8994
let targets = deliverables([

backends/apple/coreml/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ runtime.python_test(
120120
"test/*.py",
121121
]),
122122
deps = [
123+
"fbsource//third-party/pypi/coremltools:coremltools",
123124
"fbsource//third-party/pypi/pytest:pytest",
124125
":partitioner",
125126
":quantizer",

0 commit comments

Comments
 (0)