File tree Expand file tree Collapse file tree 4 files changed +24
-8
lines changed Expand file tree Collapse file tree 4 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -280,6 +280,7 @@ endif()
280
280
# Generate lib to register quantized ops
281
281
if (REGISTER_QUANTIZED_OPS )
282
282
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/quantized )
283
+ list (APPEND _libs quantized_ops_lib )
283
284
endif ()
284
285
285
286
# ios can only build library but not binary
Original file line number Diff line number Diff line change @@ -27,13 +27,13 @@ def define_common_targets():
27
27
)
28
28
29
29
register_custom_op = native .read_config ("executorch" , "register_custom_op" , "0" )
30
-
30
+ register_quantized_ops = native . read_config ( "executorch" , "register_quantized_ops" , "0" )
31
31
if register_custom_op == "1" :
32
- custom_ops_lib = [ "//executorch/examples/custom_ops:lib_1" ]
32
+ custom_ops_lib . append ( "//executorch/examples/custom_ops:lib_1" )
33
33
elif register_custom_op == "2" :
34
- custom_ops_lib = [ "//executorch/examples/custom_ops:lib_2" ]
35
- else :
36
- custom_ops_lib = []
34
+ custom_ops_lib . append ( "//executorch/examples/custom_ops:lib_2" )
35
+ if register_quantized_ops == "1" :
36
+ custom_ops_lib . append ( "//executorch/kernels/quantized:generated_lib" )
37
37
38
38
# Test driver for models, uses all portable kernels and a demo backend. This
39
39
# is intended to have minimal dependencies. If you want a runner that links
Original file line number Diff line number Diff line change 7
7
8
8
# Test the end-to-end quantization flow.
9
9
10
- set -e
10
+ set -eu
11
11
12
12
get_shared_lib_ext () {
13
13
UNAME=$( uname)
@@ -30,6 +30,14 @@ test_buck2_quantization() {
30
30
31
31
echo " Run example.py"
32
32
${PYTHON_EXECUTABLE} -m " examples.quantization.example" --so_library=" $SO_LIB " --model_name=" $1 "
33
+
34
+ echo ' Running executor_runner'
35
+ buck2 run //examples/executor_runner:executor_runner \
36
+ --config=executorch.register_quantized_ops=1 -- --model_path=" ./$1 .pte"
37
+ # should give correct result
38
+
39
+ echo " Removing $1 .pte"
40
+ rm " ./$1 .pte"
33
41
}
34
42
35
43
test_cmake_quantization () {
@@ -52,6 +60,13 @@ test_cmake_quantization() {
52
60
53
61
echo " Run example.py, shared library $SO_LIB "
54
62
${PYTHON_EXECUTABLE} -m " examples.quantization.example" --so_library=" $SO_LIB " --model_name=" $1 "
63
+
64
+ echo ' Running executor_runner'
65
+ cmake-out/executor_runner --model_path=" ./$1 .pte"
66
+ # should give correct result
67
+
68
+ echo " Removing $1 .pte"
69
+ rm " ./$1 .pte"
55
70
}
56
71
57
72
if [[ -z $PYTHON_EXECUTABLE ]];
Original file line number Diff line number Diff line change @@ -52,5 +52,5 @@ gen_custom_ops_aot_lib("quantized_ops_aot_lib" "${_quantized_sources}")
52
52
53
53
# Build a library for _quantized_kernels_srcs
54
54
#
55
- # quantized_kernels: Pure-C++ kernel library for quantized ops
56
- gen_operators_lib ("quantized_kernels " "${_quantized_kernels__srcs} " )
55
+ # quantized_ops_lib: Register quantized ops kernels into Executorch runtime
56
+ gen_operators_lib ("quantized_ops_lib " "${_quantized_kernels__srcs} " )
You can’t perform that action at this time.
0 commit comments