Skip to content

Commit 6046d21

Browse files
committed
[do not land] selective build size test
1 parent d719e8e commit 6046d21

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

examples/selective_build/test_selective_build.sh

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,32 +110,29 @@ test_cmake_select_all_ops() {
110110
}
111111

112112
test_cmake_select_ops_in_list() {
113-
echo "Exporting MobilenetV2"
114-
${PYTHON_EXECUTABLE} -m examples.portable.scripts.export --model_name="mv2"
113+
# echo "Exporting MobilenetV2"
114+
# ${PYTHON_EXECUTABLE} -m examples.portable.scripts.export --model_name="mv2"
115115

116116
local example_dir=examples/selective_build
117117
local build_dir=cmake-out/${example_dir}
118118
# set MAX_KERNEL_NUM=22: 19 primops, add, mul
119119
rm -rf ${build_dir}
120120
retry cmake -DCMAKE_BUILD_TYPE=Release \
121-
-DMAX_KERNEL_NUM=22 \
122-
-DEXECUTORCH_SELECT_OPS_LIST="aten::convolution.out,\
123-
aten::_native_batch_norm_legit_no_training.out,aten::hardtanh.out,aten::add.out,\
124-
aten::mean.out,aten::view_copy.out,aten::permute_copy.out,aten::addmm.out,\
125-
aten,aten::clone.out" \
121+
-DEXECUTORCH_SELECT_OPS_LIST="aten::add.out" \
126122
-DCMAKE_INSTALL_PREFIX=cmake-out \
123+
-DEXECUTORCH_OPTIMIZE_SIZE=ON \
127124
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
128125
-B${build_dir} \
129126
${example_dir}
130127

131128
echo "Building ${example_dir}"
132129
cmake --build ${build_dir} -j9 --config Release
133130

134-
echo 'Running selective build test'
135-
${build_dir}/selective_build_test --model_path="./mv2.pte"
131+
# echo 'Running selective build test'
132+
# ${build_dir}/selective_build_test --model_path="./mv2.pte"
136133

137-
echo "Removing mv2.pte"
138-
rm "./mv2.pte"
134+
# echo "Removing mv2.pte"
135+
# rm "./mv2.pte"
139136
}
140137

141138
test_cmake_select_ops_in_yaml() {
@@ -168,15 +165,15 @@ fi
168165

169166
if [[ -z $PYTHON_EXECUTABLE ]];
170167
then
171-
PYTHON_EXECUTABLE=python3
168+
PYTHON_EXECUTABLE=python
172169
fi
173170

174171
if [[ $1 == "cmake" ]];
175172
then
176173
cmake_install_executorch_lib
177-
test_cmake_select_all_ops
174+
# test_cmake_select_all_ops
178175
test_cmake_select_ops_in_list
179-
test_cmake_select_ops_in_yaml
176+
# test_cmake_select_ops_in_yaml
180177
elif [[ $1 == "buck2" ]];
181178
then
182179
test_buck2_select_all_ops

kernels/portable/cpu/selective_build.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,25 @@ inline constexpr bool should_include_kernel_dtype(
2020
const char* /*operator_name*/,
2121
executorch::aten::ScalarType /*scalar_type*/
2222
) {
23-
return true;
23+
return false;
2424
}
25+
26+
// Only add kernel.
27+
// inline constexpr bool should_include_kernel_dtype(
28+
// const char* operator_name,
29+
// executorch::aten::ScalarType scalar_type) {
30+
// return ((std::string_view(operator_name).compare("add.out") == 0));
31+
// }
32+
33+
// Only add-float kernel.
34+
// inline constexpr bool should_include_kernel_dtype(
35+
// const char* operator_name,
36+
// executorch::aten::ScalarType scalar_type) {
37+
// return (
38+
// (std::string_view(operator_name).compare("add.out") == 0) &&
39+
// (scalar_type == executorch::aten::ScalarType::Float));
40+
// }
41+
2542
#endif
2643

2744
namespace torch {

0 commit comments

Comments
 (0)