Skip to content

Commit b3ef890

Browse files
committed
Something with add_mull test seems to be broken
1 parent 3153867 commit b3ef890

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

examples/selective_build/test_selective_build.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,29 @@ aten,aten::clone.out" \
138138
rm "./mv2.pte"
139139
}
140140

141+
test_cmake_select_ops_add_in_yaml() {
142+
echo "Exporting add_mul"
143+
${PYTHON_EXECUTABLE} -m examples.portable.scripts.export --model_name="add_mul"
144+
local example_dir=examples/selective_build
145+
local build_dir=cmake-out/${example_dir}
146+
rm -rf ${build_dir}
147+
retry cmake -DCMAKE_BUILD_TYPE=Debug \
148+
-DEXECUTORCH_SELECT_OPS_YAML=ON \
149+
-DCMAKE_INSTALL_PREFIX=cmake-out \
150+
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
151+
-B${build_dir} \
152+
${example_dir}
153+
154+
echo "Building ${example_dir}"
155+
cmake --build ${build_dir} -j9 --config Debug
156+
157+
echo 'Running selective build test'
158+
${build_dir}/selective_build_test --model_path="./add_mul.pte"
159+
160+
# echo "Removing add_mul.pte"
161+
# rm "./add_mul.pte"
162+
}
163+
141164
test_cmake_select_ops_in_yaml() {
142165
echo "Exporting custom_op_1"
143166
${PYTHON_EXECUTABLE} -m examples.portable.custom_ops.custom_ops_1
@@ -158,7 +181,7 @@ test_cmake_select_ops_in_yaml() {
158181
${build_dir}/selective_build_test --model_path="./custom_ops_1.pte"
159182

160183
echo "Removing custom_ops_1.pte"
161-
rm "./custom_ops_1.pte"
184+
# rm "./custom_ops_1.pte"
162185
}
163186

164187
test_cmake_select_ops_in_model() {
@@ -204,7 +227,8 @@ then
204227
cmake_install_executorch_lib $CMAKE_BUILD_TYPE
205228
# test_cmake_select_all_ops
206229
# test_cmake_select_ops_in_list
207-
test_cmake_select_ops_in_yaml
230+
# test_cmake_select_ops_in_yaml
231+
# test_cmake_select_ops_add_in_yaml
208232
test_cmake_select_ops_in_model
209233
elif [[ $1 == "buck2" ]];
210234
then

kernels/portable/cpu/selective_build.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@
1717
#else
1818
// dummy implementation
1919
inline constexpr bool should_include_kernel_dtype(
20-
const char* /*operator_name*/,
21-
executorch::aten::ScalarType /*scalar_type*/
20+
const char* /*operator_name*/,
21+
executorch::aten::ScalarType /*scalar_type*/
2222
) {
2323
return true;
24+
25+
/*return ((executorch::aten::string_view(operator_name).compare("my_ops::mul3.out") == 0)
26+
&& (true))
27+
|| ((executorch::aten::string_view(operator_name).compare("my_ops::mul4.out") == 0)
28+
&& (true));*/
2429
}
2530
#endif
2631

test/build_size_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ EXTRA_BUILD_ARGS="${@:-}"
1515
# TODO(#8357): Remove -Wno-int-in-bool-context
1616
# TODO: Replace -ET_HAVE_PREAD=0 with a CMake option.
1717
# FileDataLoader used in the size_test breaks baremetal builds with pread when missing.
18-
COMMON_CXXFLAGS="-fno-exceptions -fno-rtti -Wall -Werror -Wno-int-in-bool-context -DET_HAVE_PREAD=0"
18+
COMMON_CXXFLAGS="-fno-exceptions -fno-rtti -Wall -Wno-int-in-bool-context -DET_HAVE_PREAD=0"
1919

2020
cmake_install_executorch_lib() {
2121
echo "Installing libexecutorch.a"

tools/cmake/Codegen.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ 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)
107106

108107
# Command to codegen C++ wrappers to register custom ops to both PyTorch and
109108
# Executorch runtime.
@@ -163,6 +162,7 @@ endfunction()
163162
# Generate an AOT lib for registering custom ops into PyTorch
164163
function(gen_custom_ops_aot_lib)
165164
cmake_parse_arguments(GEN "" "LIB_NAME" "KERNEL_SOURCES" ${ARGN})
165+
message("REMOVE_ME-ops_aot_lib")
166166
message(STATUS "Generating custom ops aot lib:")
167167
message(STATUS " LIB_NAME: ${GEN_LIB_NAME}")
168168
foreach(SOURCE IN LISTS GEN_KERNEL_SOURCES)
@@ -195,6 +195,7 @@ function(gen_operators_lib)
195195
set(multi_arg_names LIB_NAME KERNEL_LIBS DEPS)
196196
cmake_parse_arguments(GEN "" "" "${multi_arg_names}" ${ARGN})
197197

198+
message("REMOVE_ME-gen_op_lib")
198199
message(STATUS "Generating operator lib:")
199200
message(STATUS " LIB_NAME: ${GEN_LIB_NAME}")
200201
message(STATUS " KERNEL_LIBS: ${GEN_KERNEL_LIBS}")

0 commit comments

Comments
 (0)