File tree Expand file tree Collapse file tree 3 files changed +26
-17
lines changed Expand file tree Collapse file tree 3 files changed +26
-17
lines changed Original file line number Diff line number Diff line change @@ -94,15 +94,19 @@ option(BUILD_SELECTIVE_BUILD_TEST
94
94
95
95
option (EXECUTORCH_BUILD_SIZE_TEST "Whether to build size test" OFF )
96
96
97
- if (BUILD_SELECTIVE_BUILD_TEST )
98
- option (SELECT_ALL_OPS
99
- "Whether to register all ops defined in portable kernel library." OFF )
100
-
101
- # Option to register op list
102
- option (SELECT_OPS_LIST "Register the following list of ops" OFF )
103
-
104
- # Option to register ops from yaml file
105
- option (SELECT_OPS_YAML "Register all the ops from a given yaml file" OFF )
97
+ # Selective build options.
98
+ option (EXECUTORCH_SELECT_ALL_OPS
99
+ "Whether to register all ops defined in portable kernel library." ON )
100
+
101
+ # Option to register op list
102
+ option (EXECUTORCH_SELECT_OPS_LIST "Register the following list of ops" OFF )
103
+
104
+ # Option to register ops from yaml file
105
+ option (EXECUTORCH_SELECT_OPS_YAML
106
+ "Register all the ops from a given yaml file" OFF )
107
+ # Do not enable select all ops if any of the other select options is on.
108
+ if (EXECUTORCH_SELECT_OPS_LIST OR EXECUTORCH_SELECT_OPS_YAML )
109
+ set (EXECUTORCH_SELECT_ALL_OPS OFF )
106
110
endif ()
107
111
108
112
# Build xnn_executor_runner which depends on XNNPACK
Original file line number Diff line number Diff line change @@ -27,13 +27,7 @@ include(${EXECUTORCH_ROOT}/build/Codegen.cmake)
27
27
# library
28
28
#
29
29
set (_kernel_lib )
30
- if (SELECT_ALL_OPS )
31
- gen_selected_ops ("" "" "${SELECT_ALL_OPS} " )
32
- list (APPEND _kernel_lib portable_kernels )
33
- elseif (SELECT_OPS_LIST )
34
- gen_selected_ops ("" "${SELECT_OPS_LIST} " "" )
35
- list (APPEND _kernel_lib portable_kernels )
36
- elseif (SELECT_OPS_YAML )
30
+ if (EXECUTORCH_SELECT_OPS_YAML )
37
31
set (_custom_ops_yaml ${EXECUTORCH_ROOT} /examples/custom_ops/custom_ops.yaml )
38
32
gen_selected_ops ("${_custom_ops_yaml} " "" "" )
39
33
set (kernel_sources
@@ -48,6 +42,13 @@ elseif(SELECT_OPS_YAML)
48
42
49
43
list (APPEND _kernel_lib custom_kernels )
50
44
endif ()
45
+
46
+ gen_selected_ops (
47
+ "${_custom_ops_yaml} "
48
+ "${EXECUTORCH_SELECT_OPS_LIST} "
49
+ "${EXECUTORCH_SELECT_ALL_OPS} " )
50
+ list (APPEND _kernel_lib portable_kernels )
51
+
51
52
generate_bindings_for_kernels (${EXECUTORCH_ROOT} /kernels/portable/functions.yaml
52
53
"${_custom_ops_yaml} " )
53
54
gen_operators_lib ("select_build_lib" ${_kernel_lib} executorch )
Original file line number Diff line number Diff line change @@ -39,7 +39,11 @@ list(FILTER _portable_kernels__srcs EXCLUDE REGEX "test/*.cpp")
39
39
list (FILTER _portable_kernels__srcs EXCLUDE REGEX "codegen" )
40
40
# Generate C++ bindings to register kernels into both PyTorch (for AOT) and
41
41
# Executorch (for runtime). Here select all ops in functions.yaml
42
- gen_selected_ops ("${CMAKE_CURRENT_LIST_DIR} /functions.yaml" "" "" )
42
+ if (EXECUTORCH_SELECT_OPS_YAML )
43
+ set (_yaml_file "${CMAKE_CURRENT_LIST_DIR} /functions.yaml" )
44
+ endif ()
45
+ gen_selected_ops (
46
+ "${_yaml_file} " "${EXECUTORCH_SELECT_OPS_LIST} " "${EXECUTORCH_SELECT_ALL_OPS} " )
43
47
# Expect gen_selected_ops output file to be selected_operators.yaml
44
48
generate_bindings_for_kernels (${CMAKE_CURRENT_SOURCE_DIR} /functions.yaml "" )
45
49
message ("Generated files ${gen_command_sources} " )
You can’t perform that action at this time.
0 commit comments