|
12 | 12 | include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
|
13 | 13 |
|
14 | 14 | function(gen_selected_ops)
|
15 |
| - set(arg_names LIB_NAME OPS_SCHEMA_YAML ROOT_OPS INCLUDE_ALL_OPS OPS_FROM_MODEL) |
| 15 | + set(arg_names LIB_NAME OPS_SCHEMA_YAML ROOT_OPS INCLUDE_ALL_OPS OPS_FROM_MODEL DTYPE_SELECTIVE_BUILD) |
16 | 16 | cmake_parse_arguments(GEN "" "" "${arg_names}" ${ARGN})
|
17 | 17 |
|
18 |
| - message(STATUS "Generating operator lib:") |
| 18 | + message(STATUS "Generating selected operator lib:") |
19 | 19 | message(STATUS " LIB_NAME: ${GEN_LIB_NAME}")
|
20 | 20 | message(STATUS " OPS_SCHEMA_YAML: ${GEN_OPS_SCHEMA_YAML}")
|
21 | 21 | message(STATUS " ROOT_OPS: ${GEN_ROOT_OPS}")
|
22 | 22 | message(STATUS " INCLUDE_ALL_OPS: ${GEN_INCLUDE_ALL_OPS}")
|
23 | 23 | message(STATUS " OPS_FROM_MODEL: ${GEN_OPS_FROM_MODEL}")
|
| 24 | + message(STATUS " DTYPE_SELECTIVE_BUILD: ${GEN_DTYPE_SELECTIVE_BUILD}") |
| 25 | + if(GEN_DTYPE_SELECTIVE_BUILD) |
| 26 | + message(STATUS " DTYPE_SELECTIVE_BUILD is still WIP and may not be fully functional") |
| 27 | + endif() |
24 | 28 |
|
25 | 29 | set(_oplist_yaml
|
26 | 30 | ${CMAKE_CURRENT_BINARY_DIR}/${GEN_LIB_NAME}/selected_operators.yaml
|
@@ -58,6 +62,23 @@ function(gen_selected_ops)
|
58 | 62 | WORKING_DIRECTORY ${EXECUTORCH_ROOT}
|
59 | 63 | )
|
60 | 64 |
|
| 65 | + if(GEN_DTYPE_SELECTIVE_BUILD) |
| 66 | + set(_opvariant_h |
| 67 | + ${CMAKE_CURRENT_BINARY_DIR}/${GEN_LIB_NAME}/selected_op_variants.h |
| 68 | + ) |
| 69 | + set(_gen_opvariant_command "${PYTHON_EXECUTABLE}" -m codegen.tools.gen_selected_op_variants |
| 70 | + --yaml-file=${_oplist_yaml} |
| 71 | + --output-dir=${CMAKE_CURRENT_BINARY_DIR}/${GEN_LIB_NAME}/ |
| 72 | + ) |
| 73 | + message("Command - ${_gen_opvariant_command}") |
| 74 | + add_custom_command( |
| 75 | + COMMENT "Generating selected_op_variants.h for ${GEN_LIB_NAME}" |
| 76 | + OUTPUT ${_opvariant_h} |
| 77 | + COMMAND ${_gen_opvariant_command} |
| 78 | + DEPENDS ${_oplist_yaml} ${_codegen_tools_srcs} |
| 79 | + WORKING_DIRECTORY ${EXECUTORCH_ROOT} |
| 80 | + ) |
| 81 | + endif() |
61 | 82 | endfunction()
|
62 | 83 |
|
63 | 84 | # Codegen for registering kernels. Kernels are defined in functions_yaml and
|
|
0 commit comments