Skip to content

Commit 5cf5e8a

Browse files
committed
Add_mul example does not use dtype during cmake build, need to add
support for this
1 parent b3ef890 commit 5cf5e8a

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

examples/selective_build/test_selective_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ test_cmake_select_ops_add_in_yaml() {
145145
local build_dir=cmake-out/${example_dir}
146146
rm -rf ${build_dir}
147147
retry cmake -DCMAKE_BUILD_TYPE=Debug \
148-
-DEXECUTORCH_SELECT_OPS_YAML=ON \
148+
-DEXECUTORCH_SELECT_OPS_LIST="aten::add.out,aten::mm.out" \
149149
-DCMAKE_INSTALL_PREFIX=cmake-out \
150150
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
151151
-B${build_dir} \

kernels/portable/cpu/selective_build.h

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,27 @@
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
22+
) {
23+
return ((executorch::aten::string_view(operator_name).compare("add.out") == 0)
24+
&& (true))
25+
|| ((executorch::aten::string_view(operator_name).compare("mm.out") == 0)
26+
&& (true));
27+
}
28+
/*
29+
inline constexpr bool should_include_kernel_dtype(
30+
const char* ,//operator_name,
31+
executorch::aten::ScalarType //scalar_type*
2232
) {
2333
return true;
2434
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));*/
35+
// return ((executorch::aten::string_view(operator_name).compare("my_ops::mul3.out") == 0)
36+
// && (true))
37+
// || ((executorch::aten::string_view(operator_name).compare("my_ops::mul4.out") == 0)
38+
// && (true));
2939
}
40+
*/
3041
#endif
3142

3243
namespace torch {

selected_op_variants_add_mul.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#pragma once
2+
/**
3+
* Generated by executorch/codegen/tools/gen_selected_op_variants.py
4+
*/
5+
6+
inline constexpr bool should_include_kernel_dtype(
7+
const char *operator_name,
8+
executorch::aten::ScalarType scalar_type
9+
) {
10+
return ((executorch::aten::string_view(operator_name).compare("add.out") == 0)
11+
&& (true))
12+
|| ((executorch::aten::string_view(operator_name).compare("mm.out") == 0)
13+
&& (true));
14+
}

0 commit comments

Comments
 (0)