Merge pull request #47190 from foss-for-synopsys-dwc-arc-processors:arc_build_fix

PiperOrigin-RevId: 357985606
Change-Id: I2b84e69834225fc4744f2c931195514f11007527
This commit is contained in:
TensorFlower Gardener 2021-02-17 11:00:09 -08:00
commit 30d46c800e
9 changed files with 24 additions and 22 deletions

View File

@ -45,7 +45,7 @@ The example project for ARC EM SDP platform can be generated with the following
command:
```
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=arc_emsdp TAGS=no_arc_mli generate_hello_world_make_project
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=arc_emsdp OPTIMIZED_KERNEL_DIR=arc_mli ARC_TAGS=no_arc_mli generate_hello_world_make_project
```
### Build and Run Example
@ -245,7 +245,7 @@ make -f tensorflow/lite/micro/tools/make/Makefile TARGET=himax_we1_evb third_par
Generate hello world project
```
make -f tensorflow/lite/micro/tools/make/Makefile generate_hello_world_make_project TARGET=himax_we1_evb TAGS=no_arc_mli
make -f tensorflow/lite/micro/tools/make/Makefile generate_hello_world_make_project TARGET=himax_we1_evb ARC_TAGS=no_arc_mli
```
### Build and Burn Example

View File

@ -66,11 +66,12 @@ SDP platform can be generated with the following command:
```
make -f tensorflow/lite/micro/tools/make/Makefile \
TARGET=arc_emsdp TAGS=reduce_codesize \
TARGET=arc_emsdp ARC_TAGS=reduce_codesize \
OPTIMIZED_KERNEL_DIR=arc_mli \
generate_micro_speech_mock_make_project
```
Note that `TAGS=reduce_codesize` applies example specific changes of code to
Note that `ARC_TAGS=reduce_codesize` applies example specific changes of code to
reduce total size of application. It can be omitted.
### Build and Run Example

View File

@ -4,7 +4,7 @@ ifeq ($(TARGET), arc_emsdp)
# In particular:
# - Extend Heap and stack size for application needs
# - Use Linker command file with better usage of fast memory
# - Optional (TAGS=reduce_codesize): In case project was
# - Optional (ARC_TAGS=reduce_codesize): In case project was
# generated with MLI usage, reduce scratch buffers.
MICRO_SPEECH_HDRS += \
@ -36,7 +36,7 @@ ifeq ($(TARGET), arc_emsdp)
@echo Makefile: No Reference fallback for MLI supported functions >> $@
ifneq ($(filter $(ALL_TAGS), reduce_codesize),)
ifneq ($(filter $(ARC_TAGS), reduce_codesize),)
# In case 'reduce_codesize' tag is present, we replace common MLI functions with
# specializations appropriate for this particular graph. But such changes of code
# with high probability may not be acceptable for other graphs and will need

View File

@ -52,11 +52,12 @@ command:
```
make -f tensorflow/lite/micro/tools/make/Makefile \
TARGET=arc_emsdp TAGS=reduce_codesize \
TARGET=arc_emsdp ARC_TAGS=reduce_codesize \
OPTIMIZED_KERNEL_DIR=arc_mli \
generate_person_detection_int8_make_project
```
Note that `TAGS=reduce_codesize` applies example specific changes of code to
Note that `ARC_TAGS=reduce_codesize` applies example specific changes of code to
reduce total size of application. It can be omitted.
### Build and Run Example

View File

@ -25,7 +25,7 @@ ifeq ($(TARGET), arc_emsdp)
@sed -E -i 's#MLI_ONLY *\?= *false#MLI_ONLY \?= true#' $(word 2, $^)
@echo Makefile: No Reference fallback for MLI supported functions >> $@
ifneq ($(filter $(ALL_TAGS), reduce_codesize),)
ifneq ($(filter $(ARC_TAGS), reduce_codesize),)
#In case 'reduce_codesize' tag is present, we replace common MLI functions with
#specializations appropriate for this particular graph.But such changes of code
#with high probability may not be acceptable for other graphs and will need

View File

@ -21,16 +21,16 @@ ARC specific target implies usage of embARC MLI.
For example:
```
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=arc_emsdp generate_person_detection_int8_make_project
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=arc_emsdp OPTIMIZED_KERNEL_DIR=arc_mli generate_person_detection_int8_make_project
```
In case MLI implementation cant be used, kernels in this folder fallback to
TFLM reference implementations. For applications which may not benefit from MLI
library, projects can be generated without these implementations by adding
`TAGS=no_arc_mli` in the command line, which can reduce overall code size:
`ARC_TAGS=no_arc_mli` in the command line, which can reduce overall code size:
```
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=arc_emsdp TAGS=no_arc_mli generate_person_detection_int8_make_project
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=arc_emsdp OPTIMIZED_KERNEL_DIR=arc_mli ARC_TAGS=no_arc_mli generate_person_detection_int8_make_project
```
For ARC EM SDP board, a pre-compiled MLI library is downloaded and used in the
@ -39,7 +39,7 @@ and compiled during project generation phase. To build library from sources for
ARC EM SDP platform, add `BUILD_ARC_MLI=true` option to make command:
```
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=arc_emsdp BUILD_ARC_MLI=true generate_person_detection_int8_make_project
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=arc_emsdp OPTIMIZED_KERNEL_DIR=arc_mli BUILD_ARC_MLI=true generate_person_detection_int8_make_project
```
If an application exclusively uses accelerated MLI kernel implementations, one

View File

@ -18,8 +18,8 @@ ifeq ($(TARGET_ARCH), arc)
# MLI Library is used by default for ARC platform whenever it is possible.
# To use TFLM reference implementation MLI should be intentionally turned off
# by passing 'no_arc_mli' tag (make -f <tflm_main_makefile> TAGS=no_arc_mli ...)
ifeq ($(filter no_arc_mli,$(ALL_TAGS)),)
# by passing 'no_arc_mli' tag (make -f <tflm_main_makefile> ARC_TAGS=no_arc_mli ...)
ifeq ($(filter no_arc_mli,$(ARC_TAGS)),)
ALL_TAGS += arc_mli

View File

@ -149,7 +149,7 @@ use a shell to execute the following command from the root directory of the
TensorFlow repo:
```
make -f tensorflow/lite/micro/tools/make/Makefile generate_person_detection_test_int8_make_project TARGET=arc_emsdp
make -f tensorflow/lite/micro/tools/make/Makefile generate_person_detection_test_int8_make_project TARGET=arc_emsdp OPTIMIZED_KERNEL_DIR=arc_mli
```
The application project will be generated into
@ -166,8 +166,8 @@ is used by default to speed up execution of some kernels for asymmetrically
quantized layers. Kernels which use MLI-based implementations are kept in the
*tensorflow/lite/micro/kernels/arc_mli* folder. For applications which may not
benefit from MLI library, the project can be generated without these
implementations by adding `TAGS=no_arc_mli` in the command line. This can reduce
code size when the optimized kernels are not required.
implementations by adding `ARC_TAGS=no_arc_mli` in the command line. This can
reduce code size when the optimized kernels are not required.
For more options on embARC MLI usage see
[kernels/arc_mli/README.md](/tensorflow/lite/micro/kernels/arc_mli/README.md).
@ -279,7 +279,7 @@ For instance, to build **Person Detection** test application, use the following
command from the root directory of the TensorFlow repo:
```
make -f tensorflow/lite/micro/tools/make/Makefile generate_person_detection_test_int8_make_project TARGET=arc_custom TCF_FILE=<path_to_tcf_file> LCF_FILE=<path_to_lcf_file>
make -f tensorflow/lite/micro/tools/make/Makefile generate_person_detection_test_int8_make_project TARGET=arc_custom OPTIMIZED_KERNEL_DIR=arc_mli TCF_FILE=<path_to_tcf_file> LCF_FILE=<path_to_lcf_file>
```
The application project will be generated into
@ -291,8 +291,8 @@ is used by default to speed up execution of some kernels for asymmetrically
quantized layers. Kernels which use MLI-based implementations are kept in the
*tensorflow/lite/micro/kernels/arc_mli* folder. For applications which may not
benefit from MLI library, the project can be generated without these
implementations by adding `TAGS=no_arc_mli` in the command line. This can reduce
code size when the optimized kernels are not required.
implementations by adding `ARC_TAGS=no_arc_mli` in the command line. This can
reduce code size when the optimized kernels are not required.
For more options on embARC MLI usage see
[kernels/arc_mli/README.md](/tensorflow/lite/micro/kernels/arc_mli/README.md).

View File

@ -21,7 +21,7 @@ ARC_TOOLCHAIN := mwdt
BUILD_ARC_MLI := false
ARC_MLI_PRE_COMPILED_TARGET := emsdp_em11d_em9d_dfss
ifneq ($(filter no_arc_mli,$(ALL_TAGS)),)
ifneq ($(filter no_arc_mli,$(ARC_TAGS)),)
MLI_LIB_DIR = arc_mli_package
$(eval $(call add_third_party_download,$(EMBARC_MLI_PRE_COMPILED_URL),$(EMBARC_MLI_PRE_COMPILED_MD5),$(MLI_LIB_DIR),))
else ifeq ($(BUILD_ARC_MLI), true)