Skip to content

Commit 3153867

Browse files
committed
Now able to generate selected_op_variants.h from yaml spec
1 parent 4799129 commit 3153867

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

codegen/tools/gen_selected_op_variants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070

7171

7272
def write_selected_op_variants(yaml_file_path: str, output_dir: str) -> None:
73+
print("REMOVE_ME: yaml_file_path is: " + str(yaml_file_path))
7374
with open(yaml_file_path, "r") as selected_operators_file:
7475
# Collect et_kernel_metadata from selected_operators.yaml and extract dtypes
7576
# Example format: v1/6;0,1|6;0,1|6;0,1|6;0,1 # Float, 0, 1

examples/selective_build/test_selective_build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ fi
202202
if [[ $1 == "cmake" ]];
203203
then
204204
cmake_install_executorch_lib $CMAKE_BUILD_TYPE
205-
test_cmake_select_all_ops
206-
test_cmake_select_ops_in_list
205+
# test_cmake_select_all_ops
206+
# test_cmake_select_ops_in_list
207207
test_cmake_select_ops_in_yaml
208208
test_cmake_select_ops_in_model
209209
elif [[ $1 == "buck2" ]];

tools/cmake/Codegen.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ function(generate_bindings_for_kernels)
103103
set(_out_dir ${CMAKE_CURRENT_BINARY_DIR}/${GEN_LIB_NAME})
104104
# By default selective build output is selected_operators.yaml
105105
set(_oplist_yaml ${_out_dir}/selected_operators.yaml)
106+
set(_opvariants_h ${_out_dir}/selected_op_variants.h)
106107

107108
# Command to codegen C++ wrappers to register custom ops to both PyTorch and
108109
# Executorch runtime.
@@ -148,7 +149,7 @@ function(generate_bindings_for_kernels)
148149
COMMENT "Generating code for kernel registration"
149150
OUTPUT ${_gen_command_sources}
150151
COMMAND ${_gen_command}
151-
DEPENDS ${_oplist_yaml} ${GEN_CUSTOM_OPS_YAML} ${GEN_FUNCTIONS_YAML}
152+
DEPENDS ${_oplist_yaml} ${_opvariants_h} ${GEN_CUSTOM_OPS_YAML} ${GEN_FUNCTIONS_YAML}
152153
${_codegen_templates} ${_torchgen_srcs}
153154
WORKING_DIRECTORY ${EXECUTORCH_ROOT}
154155
)

0 commit comments

Comments
 (0)