Skip to content

Commit 2236350

Browse files
committed
Testing on MV2, seeing error
1 parent 7418324 commit 2236350

File tree

3 files changed

+110
-11
lines changed

3 files changed

+110
-11
lines changed

examples/selective_build/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ option(EXECUTORCH_SELECT_ALL_OPS
6363
)
6464

6565
# Option to enable dtype selective build
66-
option(EXECUTORCH_SELECT_DTYPE "Enable dtype selection during build." OFF
66+
option(EXECUTORCH_DTYPE_SELECTIVE_BUILD "Enable dtype selection during build." OFF
6767
)
6868
# ------------------------------- OPTIONS END --------------------------------
6969

@@ -84,8 +84,11 @@ include(${EXECUTORCH_SRCS_FILE})
8484
#
8585
set(_kernel_lib)
8686
if(EXECUTORCH_SELECT_OPS_YAML)
87+
# set(_custom_ops_yaml
88+
# ${EXECUTORCH_ROOT}/examples/portable/custom_ops/custom_ops.yaml
89+
# )
8790
set(_custom_ops_yaml
88-
${EXECUTORCH_ROOT}/examples/portable/custom_ops/custom_ops.yaml
91+
${EXECUTORCH_ROOT}/mv2_schema.yaml
8992
)
9093
set(kernel_sources
9194
${EXECUTORCH_ROOT}/examples/portable/custom_ops/custom_ops_1_out.cpp
@@ -113,7 +116,7 @@ gen_selected_ops(
113116
INCLUDE_ALL_OPS
114117
"${EXECUTORCH_SELECT_ALL_OPS}"
115118
DTYPE_SELECT
116-
"${EXECUTORCH_SELECT_DTYPE}"
119+
"${EXECUTORCH_DTYPE_SELECTIVE_BUILD}"
117120
)
118121

119122
generate_bindings_for_kernels(
@@ -124,7 +127,7 @@ generate_bindings_for_kernels(
124127
CUSTOM_OPS_YAML
125128
"${_custom_ops_yaml}"
126129
DTYPE_SELECT
127-
"${EXECUTORCH_SELECT_DTYPE}"
130+
"${EXECUTORCH_DTYPE_SELECTIVE_BUILD}"
128131
)
129132

130133
gen_operators_lib(
@@ -135,7 +138,7 @@ gen_operators_lib(
135138
DEPS
136139
executorch_core
137140
DTYPE_SELECT
138-
"${EXECUTORCH_SELECT_DTYPE}"
141+
"${EXECUTORCH_DTYPE_SELECTIVE_BUILD}"
139142
)
140143

141144
list(TRANSFORM _executor_runner__srcs PREPEND "${EXECUTORCH_ROOT}/")

examples/selective_build/test_selective_build.sh

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ test_cmake_select_all_ops() {
9494
rm -rf ${build_dir}
9595
retry cmake -DCMAKE_BUILD_TYPE=Release \
9696
-DEXECUTORCH_SELECT_ALL_OPS=ON \
97-
-DEXECUTORCH_SELECT_DTYPE=ON \
97+
-DEXECUTORCH_DTYPE_SELECTIVE_BUILD=ON \
9898
-DCMAKE_INSTALL_PREFIX=cmake-out \
9999
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
100100
-B${build_dir} \
@@ -124,7 +124,7 @@ test_cmake_select_ops_in_list() {
124124
aten::_native_batch_norm_legit_no_training.out,aten::hardtanh.out,aten::add.out,\
125125
aten::mean.out,aten::view_copy.out,aten::permute_copy.out,aten::addmm.out,\
126126
aten,aten::clone.out" \
127-
-DEXECUTORCH_SELECT_DTYPE=ON \
127+
-DEXECUTORCH_DTYPE_SELECTIVE_BUILD=ON \
128128
-DCMAKE_INSTALL_PREFIX=cmake-out \
129129
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
130130
-B${build_dir} \
@@ -148,7 +148,7 @@ test_cmake_select_ops_in_yaml() {
148148
rm -rf ${build_dir}
149149
retry cmake -DCMAKE_BUILD_TYPE=Release \
150150
-DEXECUTORCH_SELECT_OPS_YAML=ON \
151-
-DEXECUTORCH_SELECT_DTYPE=ON \
151+
-DEXECUTORCH_DTYPE_SELECTIVE_BUILD=ON \
152152
-DCMAKE_INSTALL_PREFIX=cmake-out \
153153
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
154154
-B${build_dir} \
@@ -164,6 +164,30 @@ test_cmake_select_ops_in_yaml() {
164164
rm "./custom_ops_1.pte"
165165
}
166166

167+
test_cmake_select_ops_and_dtype() {
168+
echo "Exporting MobilenetV2"
169+
${PYTHON_EXECUTABLE} -m examples.portable.scripts.export --model_name="mv2"
170+
local example_dir=examples/selective_build
171+
local build_dir=cmake-out/${example_dir}
172+
rm -rf ${build_dir}
173+
retry cmake -DCMAKE_BUILD_TYPE=Release \
174+
-DEXECUTORCH_SELECT_OPS_YAML=ON \
175+
-DEXECUTORCH_DTYPE_SELECTIVE_BUILD=ON \
176+
-DCMAKE_INSTALL_PREFIX=cmake-out \
177+
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
178+
-B${build_dir} \
179+
${example_dir}
180+
181+
echo "Building ${example_dir}"
182+
cmake --build ${build_dir} -j9 --config Release
183+
184+
echo 'Running selective build test'
185+
${build_dir}/selective_build_test --model_path="./mv2.pte" --ops_schema_yaml_target="./mv2_schema.yaml"
186+
187+
echo "Removing mv2.pte"
188+
rm "./mv2.pte"
189+
}
190+
167191
if [[ -z $BUCK ]];
168192
then
169193
BUCK=buck2
@@ -177,9 +201,10 @@ fi
177201
if [[ $1 == "cmake" ]];
178202
then
179203
cmake_install_executorch_lib
180-
test_cmake_select_all_ops
181-
test_cmake_select_ops_in_list
182-
test_cmake_select_ops_in_yaml
204+
# test_cmake_select_all_ops
205+
# test_cmake_select_ops_in_list
206+
# test_cmake_select_ops_in_yaml
207+
test_cmake_select_ops_and_dtype
183208
elif [[ $1 == "buck2" ]];
184209
then
185210
test_buck2_select_all_ops

mv2_schema.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
build_features: []
2+
custom_classes: []
3+
et_kernel_metadata:
4+
aten::_native_batch_norm_legit_no_training.out:
5+
- v1/6;0,1,2,3|6;0|6;0|6;0|6;0|6;0,1,2,3|6;0|6;0|6;0,1,2,3
6+
aten::add.out:
7+
- v1/6;0,1,2,3|6;0,1,2,3|6;0,1,2,3|6;0,1,2,3
8+
aten::addmm.out:
9+
- v1/6;0|6;0,1|6;0,1|6;0,1|6;0,1
10+
aten::clone.out:
11+
- v1/6;0,1|6;0,1|6;0,1
12+
aten::convolution.out:
13+
- v1/6;0,1,2,3|6;0,1,2,3|6;0,1,2,3|6;0,1,2,3
14+
aten::hardtanh.out:
15+
- v1/6;0,1,2,3|6;0,1,2,3|6;0,1,2,3
16+
aten::mean.out:
17+
- v1/6;0,1,2,3|6;0,1,2,3|6;0,1,2,3
18+
aten::permute_copy.out:
19+
- v1/6;0,1|6;0,1|6;0,1
20+
include_all_non_op_selectives: false
21+
include_all_operators: false
22+
kernel_metadata: {}
23+
operators:
24+
aten::_native_batch_norm_legit_no_training.out:
25+
debug_info:
26+
- mv2.pte
27+
include_all_overloads: false
28+
is_root_operator: true
29+
is_used_for_training: true
30+
aten::add.out:
31+
debug_info:
32+
- mv2.pte
33+
include_all_overloads: false
34+
is_root_operator: true
35+
is_used_for_training: true
36+
aten::addmm.out:
37+
debug_info:
38+
- mv2.pte
39+
include_all_overloads: false
40+
is_root_operator: true
41+
is_used_for_training: true
42+
aten::clone.out:
43+
debug_info:
44+
- mv2.pte
45+
include_all_overloads: false
46+
is_root_operator: true
47+
is_used_for_training: true
48+
aten::convolution.out:
49+
debug_info:
50+
- mv2.pte
51+
include_all_overloads: false
52+
is_root_operator: true
53+
is_used_for_training: true
54+
aten::hardtanh.out:
55+
debug_info:
56+
- mv2.pte
57+
include_all_overloads: false
58+
is_root_operator: true
59+
is_used_for_training: true
60+
aten::mean.out:
61+
debug_info:
62+
- mv2.pte
63+
include_all_overloads: false
64+
is_root_operator: true
65+
is_used_for_training: true
66+
aten::permute_copy.out:
67+
debug_info:
68+
- mv2.pte
69+
include_all_overloads: false
70+
is_root_operator: true
71+
is_used_for_training: true

0 commit comments

Comments
 (0)