File tree Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 20
20
# It should also be cmake-lint clean.
21
21
#
22
22
23
+ # Platform-specific definitions.
24
+ if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64" )
25
+ set (arm64 ON )
26
+ else ()
27
+ set (arm64 OFF )
28
+ endif ()
29
+
30
+ if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)" )
31
+ set (x86 ON )
32
+ else ()
33
+ set (x86 OFF )
34
+ endif ()
35
+
23
36
# Public function to print summary for all configurations. For new variables,
24
37
# it's recommended to add them here.
25
38
function (executorch_print_configuration_summary )
@@ -32,6 +45,8 @@ function(executorch_print_configuration_summary)
32
45
message (STATUS " BUCK2 : ${BUCK2} " )
33
46
message (STATUS " PYTHON_EXECUTABLE : ${PYTHON_EXECUTABLE} " )
34
47
message (STATUS " FLATC_EXECUTABLE : ${FLATC_EXECUTABLE} " )
48
+ message (STATUS " X86 : ${x86} " )
49
+ message (STATUS " ARM64 : ${arm64} " )
35
50
message (
36
51
STATUS " EXECUTORCH_ENABLE_LOGGING : ${EXECUTORCH_ENABLE_LOGGING} " )
37
52
message (
@@ -120,4 +135,4 @@ function(extract_sources sources_file)
120
135
message (FATAL_ERROR "executorch: source list generation failed" )
121
136
endif ()
122
137
endif ()
123
- endfunction ()
138
+ endfunction ()
Original file line number Diff line number Diff line change @@ -56,6 +56,8 @@ excludes = [
56
56
# Exclude the codegen templates, which are picked up because the buck target
57
57
# is the generated_lib and not the unwrapped set of kernels.
58
58
" ^codegen/templates" ,
59
+ # Exclude blas, since it's built as a separate target.
60
+ " ^kernels/optimized/blas" ,
59
61
]
60
62
deps = [
61
63
" executorch" ,
@@ -85,6 +87,19 @@ filters = [
85
87
" .fbs$" ,
86
88
]
87
89
90
+ [targets .optimized_cpublas ]
91
+ buck_targets = [
92
+ " //kernels/optimized:libblas" ,
93
+ ]
94
+ filters = [
95
+ " .cpp$" ,
96
+ ]
97
+ excludes = [
98
+ ]
99
+ deps = [
100
+ " executorch" ,
101
+ ]
102
+
88
103
# ---------------------------------- core end ----------------------------------
89
104
# ---------------------------------- extension start ----------------------------------
90
105
Original file line number Diff line number Diff line change @@ -30,9 +30,24 @@ endif()
30
30
31
31
set (_common_compile_options -Wno-deprecated-declarations )
32
32
33
+ # Set platform-specific definitions.
34
+ if (arm64 )
35
+ list (APPEND _common_compile_options -DET_BUILD_WITH_BLAS )
36
+ elseif (x86 )
37
+ # TODO(T183193812) Enable once sleef is built in OSS.
38
+ # list(APPEND _common_compile_options -DCPU_CAPABILITY_AVX2)
39
+ endif ()
40
+
33
41
include (${EXECUTORCH_ROOT} /build/Utils.cmake )
34
42
include (${EXECUTORCH_ROOT} /build/Codegen.cmake )
35
43
44
+ # Build cpublas.
45
+ list (TRANSFORM _optimized_cpublas__srcs PREPEND "${EXECUTORCH_ROOT} /" )
46
+ add_library (cpublas ${_optimized_cpublas__srcs} )
47
+ target_link_libraries (cpublas PRIVATE executorch )
48
+ target_compile_options (cpublas PUBLIC ${_common_compile_options} )
49
+
50
+
36
51
# Generate C++ bindings to register kernels into both PyTorch (for AOT) and
37
52
# Executorch (for runtime). Here select all ops in optimized.yaml
38
53
set (_yaml "${CMAKE_CURRENT_LIST_DIR} /optimized-oss.yaml" )
@@ -44,7 +59,7 @@ message("Generated files ${gen_command_sources}")
44
59
45
60
list (TRANSFORM _optimized_kernels__srcs PREPEND "${EXECUTORCH_ROOT} /" )
46
61
add_library (optimized_kernels ${_optimized_kernels__srcs} )
47
- target_link_libraries (optimized_kernels PRIVATE executorch )
62
+ target_link_libraries (optimized_kernels PRIVATE executorch cpublas )
48
63
target_compile_options (optimized_kernels PUBLIC ${_common_compile_options} )
49
64
# Build a library for _optimized_kernels_srcs
50
65
#
You can’t perform that action at this time.
0 commit comments