Skip to content

Commit 61db1b6

Browse files
committed
up
1 parent cd81b1c commit 61db1b6

File tree

2 files changed

+43
-36
lines changed

2 files changed

+43
-36
lines changed

CMakeLists.txt

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -482,42 +482,6 @@ if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
482482
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/optimized)
483483
endif()
484484

485-
if(EXECUTORCH_BUILD_KERNELS_TORCHAO)
486-
if (NOT TARGET cpuinfo)
487-
message(FATAL_ERROR "EXECUTORCH_BUILD_KERNELS_TORCHAO requires EXECUTORCH_BUILD_CPUINFO be set ON")
488-
endif()
489-
if (NOT TARGET pthreadpool)
490-
message(FATAL_ERROR "EXECUTORCH_BUILD_KERNELS_TORCHAO requires EXECUTORCH_BUILD_PTHREADPOOL be set ON")
491-
endif()
492-
493-
# Configure TorchAO kernels
494-
set(TORCHAO_BUILD_ATEN_OPS OFF)
495-
set(TORCHAO_BUILD_EXECUTORCH_OPS ON)
496-
set(TORCHAO_BUILD_CPU_AARCH64 ON)
497-
set(TORCHAO_ENABLE_ARM_NEON_DOT ON)
498-
499-
# TorchAO kernels look for EXECUTORCH_INCLUDE_DIRS
500-
if(DEFINED EXECUTORCH_INCLUDE_DIRS)
501-
message(FATAL_ERROR "EXECUTORCH_INCLUDE_DIRS is already defined")
502-
endif()
503-
set(EXECUTORCH_INCLUDE_DIRS
504-
${EXECUTORCH_ROOT}/backends/xnnpack/third-party/pthreadpool/include
505-
${EXECUTORCH_ROOT}/backends/xnnpack/third-party/cpuinfo/include
506-
)
507-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/ao/torchao/experimental EXCLUDE_FROM_ALL)
508-
unset(EXECUTORCH_INCLUDE_DIRS)
509-
510-
executorch_target_link_options_shared_lib(torchao_ops_executorch)
511-
list(APPEND _executorch_kernels torchao_ops_executorch)
512-
install(
513-
TARGETS torchao_ops_executorch torchao_kernels_aarch64
514-
EXPORT ExecuTorchTargets
515-
DESTINATION lib
516-
INCLUDES
517-
DESTINATION ${_common_include_directories}
518-
)
519-
endif()
520-
521485
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/configurations)
522486

523487
# Install `executorch` library as well as `executorch-config.cmake` under
@@ -718,6 +682,44 @@ if(EXECUTORCH_BUILD_PTHREADPOOL AND EXECUTORCH_BUILD_CPUINFO)
718682
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/threadpool)
719683
endif()
720684

685+
if(EXECUTORCH_BUILD_KERNELS_TORCHAO)
686+
if (NOT TARGET cpuinfo)
687+
message(FATAL_ERROR "EXECUTORCH_BUILD_KERNELS_TORCHAO requires EXECUTORCH_BUILD_CPUINFO be set ON")
688+
endif()
689+
if (NOT TARGET pthreadpool)
690+
message(FATAL_ERROR "EXECUTORCH_BUILD_KERNELS_TORCHAO requires EXECUTORCH_BUILD_PTHREADPOOL be set ON")
691+
endif()
692+
693+
# Configure TorchAO kernels
694+
set(TORCHAO_BUILD_ATEN_OPS OFF)
695+
set(TORCHAO_BUILD_EXECUTORCH_OPS ON)
696+
set(TORCHAO_BUILD_CPU_AARCH64 ON)
697+
set(TORCHAO_ENABLE_ARM_NEON_DOT ON)
698+
set(TORCHAO_BUILD_KLEIDIAI OFF) # TODO: enable
699+
700+
# TorchAO kernels look for EXECUTORCH_INCLUDE_DIRS
701+
if(DEFINED EXECUTORCH_INCLUDE_DIRS)
702+
message(FATAL_ERROR "EXECUTORCH_INCLUDE_DIRS is already defined")
703+
endif()
704+
set(EXECUTORCH_INCLUDE_DIRS
705+
${EXECUTORCH_ROOT}/backends/xnnpack/third-party/pthreadpool/include
706+
${EXECUTORCH_ROOT}/backends/xnnpack/third-party/cpuinfo/include
707+
)
708+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/ao/torchao/experimental)
709+
unset(EXECUTORCH_INCLUDE_DIRS)
710+
711+
executorch_target_link_options_shared_lib(torchao_ops_executorch)
712+
list(APPEND _executorch_kernels torchao_ops_executorch)
713+
714+
install(
715+
TARGETS torchao_ops_executorch torchao_kernels_aarch64
716+
EXPORT ExecuTorchTargets
717+
DESTINATION lib
718+
INCLUDES
719+
DESTINATION ${_common_include_directories}
720+
)
721+
endif()
722+
721723
if(EXECUTORCH_BUILD_PYBIND)
722724

723725
# 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
@@ -83,6 +83,11 @@ let products = deliverables([
8383
"threadpool",
8484
],
8585
],
86+
"kernels_torchao": [
87+
"targets": [
88+
"threadpool",
89+
],
90+
],
8691
"kernels_quantized": [:],
8792
])
8893

0 commit comments

Comments
 (0)