-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmltk_tflite_micro_cmsis_kernels.cmake
More file actions
63 lines (52 loc) · 1.95 KB
/
mltk_tflite_micro_cmsis_kernels.cmake
File metadata and controls
63 lines (52 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
###########################################################################
# CMSIS-Accelerated Kernels
#
mltk_get(MLTK_PLATFORM_IS_EMBEDDED)
if(MLTK_PLATFORM_IS_EMBEDDED)
find_package(mltk_cmsis REQUIRED)
add_library(mltk_tflite_micro_cmsis_kernels)
add_library(mltk_tflite_micro_helium_kernels ALIAS mltk_tflite_micro_cmsis_kernels)
add_library(mltk::tflite_micro_cmsis_kernels ALIAS mltk_tflite_micro_cmsis_kernels)
set(tflm_cmsis_kernel_sources
tensorflow/lite/micro/kernels/cmsis_nn/add.cc
tensorflow/lite/micro/kernels/cmsis_nn/conv.cc
tensorflow/lite/micro/kernels/cmsis_nn/depthwise_conv.cc
tensorflow/lite/micro/kernels/cmsis_nn/fully_connected.cc
tensorflow/lite/micro/kernels/cmsis_nn/mul.cc
tensorflow/lite/micro/kernels/cmsis_nn/pooling.cc
tensorflow/lite/micro/kernels/cmsis_nn/softmax.cc
tensorflow/lite/micro/kernels/cmsis_nn/svdf.cc
#tensorflow/lite/micro/kernels/cmsis_nn/unidirectional_sequence_lstm.cc
)
# If an accelerator was previously included
# then exclude the CMSIS kernels that are accelerated
mltk_get(TFLITE_MICRO_EXCLUDED_REF_KERNELS)
if(TFLITE_MICRO_EXCLUDED_REF_KERNELS)
mltk_info("Excluded CMSIS kernels: ${TFLITE_MICRO_EXCLUDED_REF_KERNELS}" TAG mltk_tflite_micro_cmsis_kernels)
foreach(pat ${TFLITE_MICRO_EXCLUDED_REF_KERNELS})
list(FILTER tflm_cmsis_kernel_sources EXCLUDE REGEX ".*/${pat}\.cc")
endforeach()
endif()
mltk_append(TFLITE_MICRO_EXCLUDED_REF_KERNELS
add
conv
depthwise_conv
fully_connected
mul
pooling
softmax
svdf
# unidirectional_sequence_lstm # The CMSIS-NN LSTM kernel seems to be slower than the TFLM reference kernel :(
)
list(TRANSFORM tflm_cmsis_kernel_sources PREPEND ${Tensorflow_SOURCE_BASE_DIR}/)
target_sources(mltk_tflite_micro_cmsis_kernels
PRIVATE
${tflm_cmsis_kernel_sources}
kernels/cmsis_kernels_helper.cc
)
target_link_libraries(mltk_tflite_micro_cmsis_kernels
PRIVATE
mltk::cmsis_nn
mltk::tflite_micro
)
endif() # MLTK_PLATFORM_IS_EMBEDDED