Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,8 @@ if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
find_package_torch_headers()
endif()

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/portable/cpu/util)

if(BUILD_EXECUTORCH_PORTABLE_OPS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/portable)
endif()
Expand Down
2 changes: 1 addition & 1 deletion extension/llm/custom_ops/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ if(EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT)
else()
# If no portable_lib, custom_ops_aot_lib still gives the ability to use the
# ops in PyTorch
target_link_libraries(custom_ops_aot_lib PUBLIC executorch_core)
target_link_libraries(custom_ops_aot_lib PUBLIC executorch_core kernels_util_all_deps)
endif()

target_link_libraries(
Expand Down
4 changes: 2 additions & 2 deletions extension/training/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ target_include_directories(

target_include_directories(extension_training PUBLIC ${EXECUTORCH_ROOT}/..)
target_compile_options(extension_training PUBLIC ${_common_compile_options})
target_link_libraries(extension_training executorch_core
extension_data_loader extension_module_static extension_tensor extension_flat_tensor)
target_link_libraries(extension_training executorch_core kernels_util_all_deps
extension_data_loader extension_module_static extension_tensor extension_flat_tensor )


list(TRANSFORM _train_xor__srcs PREPEND "${EXECUTORCH_ROOT}/")
Expand Down
2 changes: 1 addition & 1 deletion kernels/optimized/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ add_library(optimized_kernels ${_optimized_kernels__srcs})
target_include_directories(optimized_kernels PRIVATE ${TORCH_INCLUDE_DIRS} "${EXECUTORCH_ROOT}/third-party/pocketfft")
target_compile_definitions(optimized_kernels PRIVATE ET_USE_PYTORCH_HEADERS)
target_link_libraries(
optimized_kernels PUBLIC executorch_core cpublas extension_threadpool
optimized_kernels PUBLIC executorch_core cpublas extension_threadpool kernels_util_all_deps
)
target_compile_options(optimized_kernels PUBLIC ${_common_compile_options})
# Build a library for _optimized_kernels_srcs
Expand Down
2 changes: 1 addition & 1 deletion kernels/portable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ message("Generated files ${gen_command_sources}")
# Focused on portability and understandability rather than speed.
#
add_library(portable_kernels ${_portable_kernels__srcs})
target_link_libraries(portable_kernels PRIVATE executorch_core)
target_link_libraries(portable_kernels PRIVATE executorch_core kernels_util_all_deps)
target_compile_options(portable_kernels PUBLIC ${_common_compile_options})

# Build a library for _portable_kernels__srcs
Expand Down
30 changes: 30 additions & 0 deletions kernels/portable/cpu/util/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# Kernel library for portable kernels. Please this file formatted by running:
# ~~~
# cmake-format -i CMakeLists.txt
# ~~~

cmake_minimum_required(VERSION 3.19)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

if(NOT EXECUTORCH_ROOT)
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../..)
endif()

list(TRANSFORM _kernels_util_all_deps__srcs PREPEND "${EXECUTORCH_ROOT}/")

set(_common_compile_options -Wno-deprecated-declarations)

add_library(kernels_util_all_deps ${_kernels_util_all_deps__srcs})
target_link_libraries(kernels_util_all_deps PRIVATE executorch_core)
target_include_directories(kernels_util_all_deps PUBLIC ${_common_include_directories})
target_compile_definitions(kernels_util_all_deps PUBLIC C10_USING_CUSTOM_GENERATED_MACROS)
target_compile_options(kernels_util_all_deps PUBLIC ${_common_compile_options})
2 changes: 1 addition & 1 deletion kernels/quantized/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ if(NOT CMAKE_GENERATOR STREQUAL "Xcode"
endif()

add_library(quantized_kernels ${_quantized_kernels__srcs})
target_link_libraries(quantized_kernels PRIVATE executorch_core)
target_link_libraries(quantized_kernels PRIVATE executorch_core kernels_util_all_deps)
target_compile_options(quantized_kernels PUBLIC ${_common_compile_options})
# Build a library for _quantized_kernels_srcs
#
Expand Down
26 changes: 26 additions & 0 deletions tools/cmake/cmake_deps.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ excludes = [
deps = [
"executorch",
"executorch_core",
"extension_threadpool",
"kernels_util_all_deps",
]

[targets.kernels_util_all_deps]
buck_targets = [
"//kernels/portable/cpu/util:all_deps",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if its used by other kernels can we move it out of portable/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried. So many things can be broken, so I wouldn't bother right now.

]
filters = [
".cpp$",
]
deps = [
"executorch_core",
"extension_threadpool",
]

# HACK: prevent reduce_util from also showing up in custom_ops. The
Expand Down Expand Up @@ -89,6 +103,7 @@ deps = [
"executorch",
"executorch_core",
"extension_threadpool",
"kernels_util_all_deps",
"optimized_cpublas",
"portable_kernels",
]
Expand All @@ -108,6 +123,8 @@ excludes = [
deps = [
"executorch",
"executorch_core",
"extension_threadpool",
"kernels_util_all_deps",
"portable_kernels",
]

Expand Down Expand Up @@ -147,6 +164,7 @@ deps = [
"executorch_core",
"executorch",
"extension_threadpool",
"kernels_util_all_deps",
"optimized_cpublas",
"portable_kernels",
]
Expand Down Expand Up @@ -288,6 +306,8 @@ excludes = [
deps = [
"executorch",
"executorch_core",
"extension_threadpool",
"kernels_util_all_deps",
"portable_kernels",
]
# ---------------------------------- extension end ----------------------------------
Expand All @@ -306,6 +326,8 @@ excludes = [
deps = [
"executorch",
"executorch_core",
"extension_threadpool",
"kernels_util_all_deps",
"portable_kernels",
"quantized_kernels",
"etdump_flatcc",
Expand Down Expand Up @@ -340,6 +362,8 @@ excludes = [
deps = [
"executorch",
"executorch_core",
"extension_threadpool",
"kernels_util_all_deps",
"portable_kernels",
]

Expand Down Expand Up @@ -380,6 +404,7 @@ deps = [
"executorch",
"executorch_core",
"extension_threadpool",
"kernels_util_all_deps",
"xnnpack_backend",
"portable_kernels",
"etdump_flatcc",
Expand Down Expand Up @@ -455,6 +480,7 @@ deps = [
"extension_module",
"extension_tensor",
"extension_threadpool",
"kernels_util_all_deps",
"optimized_cpublas",
"portable_kernels",
"quantized_kernels",
Expand Down
Loading