@@ -78,8 +78,9 @@ if(NOT EXECUTORCH_ENABLE_LOGGING)
78
78
endif ()
79
79
80
80
# Configure log level. Must be one of debug, info, error, fatal.
81
- set (EXECUTORCH_LOG_LEVEL "Info" CACHE STRING
82
- "Build with the given ET_MIN_LOG_LEVEL value" )
81
+ set (EXECUTORCH_LOG_LEVEL
82
+ "Info"
83
+ CACHE STRING "Build with the given ET_MIN_LOG_LEVEL value" )
83
84
string (TOLOWER "${EXECUTORCH_LOG_LEVEL} " LOG_LEVEL_LOWER )
84
85
if (LOG_LEVEL_LOWER STREQUAL "debug" )
85
86
add_definitions (-DET_MIN_LOG_LEVEL=Debug )
@@ -90,9 +91,10 @@ elseif(LOG_LEVEL_LOWER STREQUAL "error")
90
91
elseif (LOG_LEVEL_LOWER STREQUAL "fatal" )
91
92
add_definitions (-DET_MIN_LOG_LEVEL=Fatal )
92
93
else ()
93
- message (SEND_ERROR
94
- "Unknown log level \" ${EXECUTORCH_LOG_LEVEL} \" . Expected one of Debug, " +
95
- "Info, Error, or Fatal." )
94
+ message (
95
+ SEND_ERROR
96
+ "Unknown log level \" ${EXECUTORCH_LOG_LEVEL} \" . Expected one of Debug, "
97
+ + "Info, Error, or Fatal." )
96
98
endif ()
97
99
98
100
option (EXECUTORCH_ENABLE_PROGRAM_VERIFICATION
@@ -105,16 +107,15 @@ if(NOT EXECUTORCH_ENABLE_PROGRAM_VERIFICATION)
105
107
add_definitions (-DET_ENABLE_PROGRAM_VERIFICATION=0 )
106
108
endif ()
107
109
108
- option (EXECUTORCH_ENABLE_EVENT_TRACER
109
- "Build with ET_EVENT_TRACER_ENABLED=ON"
110
+ option (EXECUTORCH_ENABLE_EVENT_TRACER "Build with ET_EVENT_TRACER_ENABLED=ON"
110
111
OFF )
111
112
if (EXECUTORCH_ENABLE_EVENT_TRACER )
112
113
add_definitions (-DET_EVENT_TRACER_ENABLED )
113
114
endif ()
114
115
115
- # -ffunction-sections -fdata-sections: breaks function and
116
- # data into sections so they can be properly gc'd. -s: strip symbol.
117
- # -fno-exceptions -fno-rtti: disables exceptions and runtime type.
116
+ # -ffunction-sections -fdata-sections: breaks function and data into sections so
117
+ # they can be properly gc'd. -s: strip symbol. -fno-exceptions -fno-rtti:
118
+ # disables exceptions and runtime type.
118
119
set (CMAKE_CXX_FLAGS_RELEASE
119
120
"-ffunction-sections -fdata-sections -fno-exceptions -fno-rtti" )
120
121
if (NOT APPLE )
@@ -132,47 +133,40 @@ endif()
132
133
133
134
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g" )
134
135
135
- # Option to register quantized ops with quantized kernels. See
136
- # kernels/quantized/CMakeLists.txt
137
- option (REGISTER_QUANTIZED_OPS
138
- "Register quantized ops defined in kernels/quantized/ " OFF )
136
+ option ( EXECUTORCH_BUILD_ANDROID_JNI "Build Android JNI" OFF )
137
+
138
+ option (EXECUTORCH_BUILD_ARM_BAREMETAL
139
+ "Build the Arm Baremetal flow for Cortex-M and Ethos-U " OFF )
139
140
140
- option (EXECUTORCH_BUILD_SIZE_TEST "Whether to build size test " OFF )
141
+ option (EXECUTORCH_BUILD_COREML "Build the Core ML backend " OFF )
141
142
142
- # Build xnn_executor_runner which depends on XNNPACK
143
- option (EXECUTORCH_BUILD_XNNPACK
144
- "Build xnn_executor_runner which depends on XNNPACK" OFF )
143
+ option (EXECUTORCH_BUILD_EXTENSION_AOT_UTIL "Build the AOT Util extension" OFF )
145
144
146
- # Build the vulkan delegate along with the vulkan executor_runner
147
- option (EXECUTORCH_BUILD_VULKAN
148
- "Build the Vulkan delegate and the Vulkan executor_runner" OFF )
145
+ option (EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "Build the Data Loader extension"
146
+ OFF )
149
147
150
- option (EXECUTORCH_BUILD_SDK
151
- "Build the ExecuTorch SDK library and the SDK example runner." )
148
+ option (EXECUTORCH_BUILD_EXTENSION_MODULE "Build the Module extension" OFF )
152
149
153
- # Build mps_executor_runner which depends on MPSGraph framework
154
- option (EXECUTORCH_BUILD_MPS "Build mps_executor_runner which depends on MPS"
150
+ option (EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL "Build the Runner Util extension"
155
151
OFF )
156
152
157
- # Build dataloader extension library
158
- option (EXECUTORCH_BUILD_EXTENSION_DATA_LOADER
159
- "Build the extension/data_loader directory" OFF )
153
+ option (EXECUTORCH_BUILD_GTESTS "Build googletest based test binaries" OFF )
154
+
155
+ option (EXECUTORCH_BUILD_MPS "Build the MPS backend" OFF )
156
+
157
+ option (EXECUTORCH_BUILD_PYBIND "Build the Python Bindings" OFF )
158
+
159
+ option (EXECUTORCH_BUILD_QNN "Build the Qualcomm backend" OFF )
160
160
161
- # Build module extension library
162
- option (EXECUTORCH_BUILD_EXTENSION_MODULE
163
- "Build the extension/module directory" OFF )
161
+ option (REGISTER_QUANTIZED_OPS "Build the quantized kernels" OFF )
164
162
165
- # Build the runner_util extension library
166
- option (EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL
167
- "Build the extension/runner_util directory" OFF )
163
+ option (EXECUTORCH_BUILD_SDK "Build the ExecuTorch SDK" )
168
164
169
- # Build test binaries that rely on googletest
170
- option (EXECUTORCH_BUILD_GTESTS
171
- "Build googletest based test binaries" OFF )
165
+ option (EXECUTORCH_BUILD_SIZE_TEST "Build the size test" OFF )
172
166
173
- # Build the AOT util extension library
174
- option ( EXECUTORCH_BUILD_EXTENSION_AOT_UTIL
175
- "Build the extension/aot_util directory " OFF )
167
+ option ( EXECUTORCH_BUILD_XNNPACK " Build the XNNPACK backend" OFF )
168
+
169
+ option ( EXECUTORCH_BUILD_VULKAN "Build the Vulkan backend " OFF )
176
170
177
171
if (NOT BUCK2 )
178
172
set (BUCK2 buck2 )
@@ -258,11 +252,21 @@ if(EXECUTORCH_BUILD_FLATC)
258
252
)
259
253
endif ()
260
254
set (FLATC_EXECUTABLE flatc )
261
- set (FLATBUFFERS_BUILD_FLATC ON CACHE BOOL "" )
262
- set (FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "" )
263
- set (FLATBUFFERS_BUILD_FLATLIB OFF CACHE BOOL "" )
264
- set (FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "" )
265
- set (FLATBUFFERS_INSTALL OFF CACHE BOOL "" )
255
+ set (FLATBUFFERS_BUILD_FLATC
256
+ ON
257
+ CACHE BOOL "" )
258
+ set (FLATBUFFERS_BUILD_FLATHASH
259
+ OFF
260
+ CACHE BOOL "" )
261
+ set (FLATBUFFERS_BUILD_FLATLIB
262
+ OFF
263
+ CACHE BOOL "" )
264
+ set (FLATBUFFERS_BUILD_TESTS
265
+ OFF
266
+ CACHE BOOL "" )
267
+ set (FLATBUFFERS_INSTALL
268
+ OFF
269
+ CACHE BOOL "" )
266
270
add_subdirectory (third-party/flatbuffers )
267
271
endif ()
268
272
if (NOT FLATC_EXECUTABLE )
@@ -309,6 +313,13 @@ endif()
309
313
# operators necessary for the models that will run.
310
314
#
311
315
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/portable )
316
+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/optimized )
317
+
318
+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /configurations )
319
+
320
+ if (REGISTER_QUANTIZED_OPS )
321
+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/quantized )
322
+ endif ()
312
323
313
324
#
314
325
# gflags: Commandline flag host library.
@@ -336,11 +347,10 @@ cmake_dependent_option(
336
347
EXECUTORCH_BUILD_HOST_TARGETS OFF )
337
348
if (EXECUTORCH_BUILD_EXECUTOR_RUNNER )
338
349
# Baseline libraries that executor_runner will link against.
339
- set (_executor_runner_libs executorch portable_ops_lib gflags )
350
+ set (_executor_runner_libs executorch optimized_native_cpu_ops_lib gflags )
340
351
341
352
# Generate lib to register quantized ops
342
353
if (REGISTER_QUANTIZED_OPS )
343
- add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/quantized )
344
354
list (APPEND _executor_runner_libs quantized_ops_lib )
345
355
endif ()
346
356
@@ -384,7 +394,6 @@ if(EXECUTORCH_BUILD_EXTENSION_AOT_UTIL)
384
394
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/aot_util )
385
395
endif ()
386
396
387
- option (EXECUTORCH_BUILD_XNNPACK "Build the backends/xnnpack directory" OFF )
388
397
if (EXECUTORCH_BUILD_XNNPACK )
389
398
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/xnnpack )
390
399
endif ()
@@ -393,36 +402,28 @@ if(EXECUTORCH_BUILD_VULKAN)
393
402
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/vulkan )
394
403
endif ()
395
404
396
- option (EXECUTORCH_BUILD_ANDROID_JNI "Build Android JNI" OFF )
397
405
if (EXECUTORCH_BUILD_ANDROID_JNI )
398
406
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /examples/models/llama2/runner )
399
407
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/android )
400
408
endif ()
401
409
402
- option (EXECUTORCH_BUILD_QNN "Build the backends/qualcomm directory" OFF )
403
410
if (EXECUTORCH_BUILD_QNN )
404
411
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/qualcomm )
405
412
endif ()
406
413
407
- option (EXECUTORCH_BUILD_ARM_BAREMETAL
408
- "Build the Arm Baremetal flow for Cortex-M and Ethos-U" OFF )
409
414
if (EXECUTORCH_BUILD_ARM_BAREMETAL )
410
415
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/arm )
411
416
endif ()
412
417
413
- option (EXECUTORCH_BUILD_MPS "Build the MPS Backend" OFF )
414
418
if (EXECUTORCH_BUILD_MPS )
415
419
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/apple/mps )
416
420
endif ()
417
421
418
- option (EXECUTORCH_BUILD_COREML "Build the Core ML Backend" OFF )
419
422
if (EXECUTORCH_BUILD_COREML )
420
423
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/apple/coreml )
421
424
endif ()
422
425
423
- option (EXECUTORCH_BUILD_PYBIND "Build the Python Bindings" OFF )
424
426
if (EXECUTORCH_BUILD_PYBIND )
425
-
426
427
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /third-party/pybind11 )
427
428
428
429
if (NOT EXECUTORCH_BUILD_EXTENSION_DATA_LOADER )
@@ -459,8 +460,7 @@ if(EXECUTORCH_BUILD_PYBIND)
459
460
util
460
461
${CMAKE_CURRENT_SOURCE_DIR} /extension/evalue_util/print_evalue.cpp
461
462
${CMAKE_CURRENT_SOURCE_DIR} /extension/aten_util/aten_bridge.cpp
462
- ${CMAKE_CURRENT_SOURCE_DIR} /util/read_file.cpp
463
- )
463
+ ${CMAKE_CURRENT_SOURCE_DIR} /util/read_file.cpp )
464
464
target_include_directories (util PUBLIC ${_common_include_directories}
465
465
${TORCH_INCLUDE_DIRS} )
466
466
target_compile_options (util PUBLIC ${_pybind_compile_options} )
@@ -472,20 +472,19 @@ if(EXECUTORCH_BUILD_PYBIND)
472
472
PUBLIC EXECUTORCH_PYTHON_MODULE_NAME=portable_lib )
473
473
target_include_directories (portable_lib PRIVATE ${TORCH_INCLUDE_DIRS} )
474
474
target_compile_options (portable_lib PUBLIC ${_pybind_compile_options} )
475
- target_link_libraries (portable_lib
476
- PUBLIC
477
- ${TORCH_PYTHON_LIBRARY}
478
- bundled_program
479
- etdump
480
- executorch
481
- extension_data_loader
482
- portable_ops_lib
483
- util
484
- torch
485
- ${PYBIND_LINK_COREML}
486
- ${PYBIND_LINK_MPS}
487
- ${PYBIND_LINK_XNNPACK}
488
- )
475
+ target_link_libraries (
476
+ portable_lib
477
+ PUBLIC ${TORCH_PYTHON_LIBRARY}
478
+ bundled_program
479
+ etdump
480
+ executorch
481
+ extension_data_loader
482
+ portable_ops_lib
483
+ util
484
+ torch
485
+ ${PYBIND_LINK_COREML}
486
+ ${PYBIND_LINK_MPS}
487
+ ${PYBIND_LINK_XNNPACK} )
489
488
490
489
install (TARGETS portable_lib
491
490
LIBRARY DESTINATION executorch/extension/pybindings )
0 commit comments