-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/readme
- Loading branch information
Showing
67 changed files
with
5,488 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
TARGET = XCORE-AI-EXPLORER | ||
APP_NAME = app_device | ||
|
||
APP_FLAGS = -report \ | ||
-O3 -fcomment-asm -mcmodel=large -fxscope -Wno-xcore-fptrgroup \ | ||
-Wno-unknown-pragmas \ | ||
-Wno-bidirectional-buffered-port \ | ||
-lquadflash \ | ||
-g | ||
#-Wm,--image-size,8388608,--image-base,8388608 | ||
|
||
# Comment out the below TFLMC_XCORE_PROFILE definition to disable profiling | ||
APP_FLAGS += -DTFLMC_XCORE_PROFILE | ||
|
||
# Enable the below SHARED_TENSOR_ARENA definition for multiple models | ||
# or to manage tensor arena array yourself | ||
#APP_FLAGS += -DSHARED_TENSOR_ARENA | ||
|
||
# ******************************************************* | ||
# Include AI Tools library and headers | ||
# ******************************************************* | ||
# The following variables are defined for AI Tools library | ||
# and should be included when building the app. | ||
# XMOS_AITOOLSLIB_DEFINITIONS | ||
# XMOS_AITOOLSLIB_INCLUDES | ||
# XMOS_AITOOLSLIB_LIBRARIES | ||
# | ||
ifeq ($(XMOS_AITOOLSLIB_PATH),) | ||
$(error Path to XMOS AI Tools library and headers not set correctly!) | ||
endif | ||
include ${XMOS_AITOOLSLIB_PATH}/buildfiles/aitoolslib.make | ||
|
||
XCC_FLAGS = $(APP_FLAGS) $(XMOS_AITOOLSLIB_DEFINITIONS) $(XMOS_AITOOLSLIB_INCLUDES) | ||
XCC_CPP_FLAGS = $(APP_FLAGS) -std=c++14 $(XMOS_AITOOLSLIB_DEFINITIONS) $(XMOS_AITOOLSLIB_INCLUDES) | ||
XCC_MAP_FLAGS = $(APP_FLAGS) $(XMOS_AITOOLSLIB_LIBRARIES) | ||
|
||
#============================================================================= | ||
# The following part of the Makefile includes the common build infrastructure | ||
# for compiling XMOS applications. You should not need to edit below here. | ||
|
||
XMOS_MAKE_PATH ?= ../.. | ||
include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common | ||
|
33 changes: 33 additions & 0 deletions
33
examples/app_single_model_on_two_tiles/generate_optimized_cpp_for_xcore.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from xmos_ai_tools import xformer | ||
|
||
TFLITE_MODEL_PATH = "mobilenetv1_25.tflite" | ||
OPTIMIZED_MODEL_PATH = "src/model.tflite" | ||
|
||
OPTIMIZED_MODEL_PATH = "src/model.tflite" | ||
WEIGHT_PARAMS_PATH = "src/model_weights.h" | ||
print("Generating app cpp files for model...") | ||
xformer.convert( | ||
TFLITE_MODEL_PATH, | ||
OPTIMIZED_MODEL_PATH, | ||
{ | ||
"xcore-thread-count": "5", | ||
# set conv err threshold | ||
"xcore-conv-err-threshold": "0.6", | ||
# operation splitting to reduce tensor arena size | ||
"xcore-op-split-tensor-arena": "True", | ||
"xcore-op-split-top-op": "0", | ||
"xcore-op-split-bottom-op": "4", | ||
"xcore-op-split-num-splits": "10", | ||
# write weights as a header file to be | ||
# placed on second tile | ||
"xcore-load-tile" : "True", | ||
# roughly(tensors are not split) specifies | ||
# size of weights to move out to header file | ||
"xcore-max-load-external-size" : "270000", | ||
# move weights to this file | ||
"xcore-weights-file" : WEIGHT_PARAMS_PATH, | ||
}, | ||
) | ||
xformer.print_optimization_report() | ||
|
||
print("Done!") |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- ======================================================= --> | ||
<!-- The 'ioMode' attribute on the xSCOPEconfig --> | ||
<!-- element can take the following values: --> | ||
<!-- "none", "basic", "timed" --> | ||
<!-- --> | ||
<!-- The 'type' attribute on Probe --> | ||
<!-- elements can take the following values: --> | ||
<!-- "STARTSTOP", "CONTINUOUS", "DISCRETE", "STATEMACHINE" --> | ||
<!-- --> | ||
<!-- The 'datatype' attribute on Probe --> | ||
<!-- elements can take the following values: --> | ||
<!-- "NONE", "UINT", "INT", "FLOAT" --> | ||
<!-- ======================================================= --> | ||
|
||
<xSCOPEconfig ioMode="basic" enabled="true"> | ||
<!-- For example: --> | ||
<!-- <Probe name="Probe Name" type="CONTINUOUS" datatype="UINT" units="Value" enabled="true"/> --> | ||
<!-- From the target code, call: xscope_int(PROBE_NAME, value); --> | ||
</xSCOPEconfig> |
Oops, something went wrong.