Skip to content

Commit b92ea35

Browse files
committed
Update
[ghstack-poisoned]
2 parents cd37460 + 62b6ef2 commit b92ea35

File tree

4 files changed

+53
-22
lines changed

4 files changed

+53
-22
lines changed

build/cmake_deps.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ deps = [
8989
"executorch",
9090
"executorch_core",
9191
"extension_threadpool",
92+
"optimized_cpublas",
9293
"portable_kernels",
9394
]
9495

@@ -146,6 +147,7 @@ deps = [
146147
"executorch_core",
147148
"executorch",
148149
"extension_threadpool",
150+
"optimized_cpublas",
149151
"portable_kernels",
150152
]
151153
# ---------------------------------- core end ----------------------------------
@@ -413,6 +415,7 @@ excludes = [
413415
deps = [
414416
"executorch",
415417
"executorch_core",
418+
"optimized_cpublas",
416419
"optimized_kernels",
417420
"extension_threadpool",
418421
"reduce_util",
@@ -452,6 +455,7 @@ deps = [
452455
"extension_data_loader",
453456
"extension_module",
454457
"extension_threadpool",
458+
"optimized_cpublas",
455459
"portable_kernels",
456460
"quantized_kernels",
457461
"xnnpack_backend",

build/executorch-config.cmake

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Copyright (c) Meta Platforms, Inc. and affiliates.
32
# All rights reserved.
43
#
@@ -16,20 +15,23 @@
1615
#
1716
# This will define the following variables:
1817
#
19-
# EXECUTORCH_FOUND -- True if the system has the ExecuTorch library
20-
# EXECUTORCH_INCLUDE_DIRS -- The include directories for ExecuTorch
21-
# EXECUTORCH_LIBRARIES -- Libraries to link against
18+
# EXECUTORCH_FOUND -- True if the system has the ExecuTorch library
19+
# EXECUTORCH_INCLUDE_DIRS -- The include directories for ExecuTorch
20+
# EXECUTORCH_LIBRARIES -- Libraries to link against
2221
#
23-
# The actual values for these variables will be different from what executorch-config.cmake
24-
# in executorch pip package gives, but we wanted to keep the contract of exposing these
25-
# CMake variables.
22+
# The actual values for these variables will be different from what
23+
# executorch-config.cmake in executorch pip package gives, but we wanted to keep
24+
# the contract of exposing these CMake variables.
2625

2726
cmake_minimum_required(VERSION 3.19)
2827

2928
set(_root "${CMAKE_CURRENT_LIST_DIR}/../../..")
3029
set(required_lib_list executorch executorch_core portable_kernels)
3130
set(EXECUTORCH_LIBRARIES)
32-
set(EXECUTORCH_INCLUDE_DIRS ${_root}/include ${_root}/include/executorch/runtime/core/portable_type/c10 ${_root}/lib)
31+
set(EXECUTORCH_INCLUDE_DIRS
32+
${_root}/include ${_root}/include/executorch/runtime/core/portable_type/c10
33+
${_root}/lib
34+
)
3335
foreach(lib ${required_lib_list})
3436
set(lib_var "LIB_${lib}")
3537
add_library(${lib} STATIC IMPORTED)
@@ -40,7 +42,12 @@ foreach(lib ${required_lib_list})
4042
)
4143
set_target_properties(${lib} PROPERTIES IMPORTED_LOCATION "${${lib_var}}")
4244
target_compile_definitions(${lib} INTERFACE C10_USING_CUSTOM_GENERATED_MACROS)
43-
target_include_directories(${lib} INTERFACE ${_root}/include ${_root}/include/executorch/runtime/core/portable_type/c10 ${_root}/lib)
45+
target_include_directories(
46+
${lib}
47+
INTERFACE ${_root}/include
48+
${_root}/include/executorch/runtime/core/portable_type/c10
49+
${_root}/lib
50+
)
4451
list(APPEND EXECUTORCH_LIBRARIES ${lib})
4552
endforeach()
4653

@@ -82,6 +89,7 @@ set(lib_list
8289
pthreadpool
8390
vulkan_backend
8491
optimized_kernels
92+
optimized_portable_kernels
8593
cpublas
8694
eigen_blas
8795
optimized_ops_lib
@@ -111,7 +119,12 @@ foreach(lib ${lib_list})
111119
add_library(${lib} STATIC IMPORTED)
112120
endif()
113121
set_target_properties(${lib} PROPERTIES IMPORTED_LOCATION "${${lib_var}}")
114-
target_include_directories(${lib} INTERFACE ${_root}/include ${_root}/include/executorch/runtime/core/portable_type/c10 ${_root}/lib)
122+
target_include_directories(
123+
${lib}
124+
INTERFACE ${_root}/include
125+
${_root}/include/executorch/runtime/core/portable_type/c10
126+
${_root}/lib
127+
)
115128
list(APPEND EXECUTORCH_LIBRARIES ${lib})
116129
endif()
117130
endforeach()
@@ -120,7 +133,28 @@ endforeach()
120133
# target_compile_options/target_compile_definitions for everything.
121134
if(TARGET cpublas)
122135
set_target_properties(
123-
cpublas PROPERTIES INTERFACE_LINK_LIBRARIES extension_threadpool
136+
cpublas PROPERTIES INTERFACE_LINK_LIBRARIES
137+
"extension_threadpool;eigen_blas"
138+
)
139+
endif()
140+
if(TARGET optimized_kernels)
141+
set_target_properties(
142+
optimized_kernels PROPERTIES INTERFACE_LINK_LIBRARIES
143+
"executorch_core;cpublas;extension_threadpool"
124144
)
125145
endif()
126-
target_compile_definitions(extension_threadpool INTERFACE ET_USE_THREADPOOL)
146+
if(TARGET optimized_native_cpu_ops_lib)
147+
if(TARGET optimized_portable_kernels)
148+
set(_maybe_optimized_portable_kernels_lib optimized_portable_kernels)
149+
else()
150+
set(_maybe_optimized_portable_kernels_lib portable_kernels)
151+
endif()
152+
set_target_properties(
153+
optimized_native_cpu_ops_lib
154+
PROPERTIES INTERFACE_LINK_LIBRARIES
155+
"optimized_kernels;${_maybe_optimized_portable_kernels_lib}"
156+
)
157+
endif()
158+
if(TARGET extension_threadpool)
159+
target_compile_definitions(extension_threadpool INTERFACE ET_USE_THREADPOOL)
160+
endif()

configurations/CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,7 @@ if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
4747
message("Generated files ${gen_command_sources}")
4848

4949
# optimized_native_cpu_ops_lib: Register optimized op kernels into the runtime
50-
if(NOT DEFINED EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS)
51-
message(FATAL_ERROR "EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS was not defined!")
52-
endif()
53-
if(${EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS})
54-
if(NOT TARGET optimized_portable_kernels)
55-
message(FATAL_ERROR "optimized_portable_kernels missing")
56-
endif()
50+
if(TARGET optimized_portable_kernels)
5751
set(_optimized_native_cpu_ops_lib_portable_kernels_lib optimized_portable_kernels)
5852
else()
5953
set(_optimized_native_cpu_ops_lib_portable_kernels_lib portable_kernels)

kernels/portable/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ gen_operators_lib(
6666
# Portable kernels support optional parallelization (and, in the
6767
# future, perhaps other performance features). If support is present,
6868
# produce an optimized version.
69-
set(EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS EXECUTORCH_BUILD_PTHREADPOOL PARENT_SCOPE)
70-
set(EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS EXECUTORCH_BUILD_PTHREADPOOL)
69+
set(BUILD_OPTIMIZED_PORTABLE_KERNELS EXECUTORCH_BUILD_PTHREADPOOL)
7170

72-
if(${EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS})
71+
if(BUILD_OPTIMIZED_PORTABLE_KERNELS)
7372
add_library(optimized_portable_kernels ${_portable_kernels__srcs})
7473
target_link_libraries(optimized_portable_kernels PRIVATE executorch)
7574
target_link_libraries(optimized_portable_kernels PUBLIC extension_threadpool)

0 commit comments

Comments
 (0)