Skip to content

Commit

Permalink
Merge branch 'develop' into fix/readme
Browse files Browse the repository at this point in the history
  • Loading branch information
panickal-xmos authored Jul 22, 2024
2 parents dd42c40 + ee1a8d6 commit 0d82385
Show file tree
Hide file tree
Showing 67 changed files with 5,488 additions and 179 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,19 @@ jobs:
popd
cd $GITHUB_WORKSPACE
if [[ -n $GOOGLE_APPLICATION_CREDENTIALS ]]; then
docker run -e SETUPTOOLS_SCM_PRETEND_VERSION=${{ env.PRETEND_VERSION }} \
-e GOOGLE_APPLICATION_CREDENTIALS=/tmp/gcloud-credentials.json \
-v $GOOGLE_APPLICATION_CREDENTIALS:/tmp/gcloud-credentials.json:ro \
-v ${PWD}:/ai_tools -w /ai_tools \
tensorflow/build:2.15-python${{ matrix.python-version }} \
.github/scripts/build_linux_wheel.sh
else
docker run -e SETUPTOOLS_SCM_PRETEND_VERSION=${{ env.PRETEND_VERSION }} \
-v ${PWD}:/ai_tools -w /ai_tools \
tensorflow/build:2.15-python${{ matrix.python-version }} \
.github/scripts/build_linux_wheel.sh
fi
sudo apt-get -y -qq install patchelf --no-install-recommends
python -m pip install auditwheel==5.2.0
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
if: github.event.pull_request.merged == true
name: Build release wheels for macOS arm64
needs: [build-release-archive]
runs-on: macos-11
runs-on: macos-14
strategy:
matrix:
python-version: [3.9]
Expand Down Expand Up @@ -228,12 +228,19 @@ jobs:
fi
popd
docker run \
if [[ -n $GOOGLE_APPLICATION_CREDENTIALS ]]; then
docker run -e SETUPTOOLS_SCM_PRETEND_VERSION=${{ env.PRETEND_VERSION }} \
-e GOOGLE_APPLICATION_CREDENTIALS=/tmp/gcloud-credentials.json \
-v $GOOGLE_APPLICATION_CREDENTIALS:/tmp/gcloud-credentials.json:ro \
-v ${PWD}:/ai_tools -w /ai_tools \
tensorflow/build:2.15-python${{ matrix.python-version }} \
.github/scripts/build_linux_wheel.sh
else
docker run -e SETUPTOOLS_SCM_PRETEND_VERSION=${{ env.PRETEND_VERSION }} \
-v ${PWD}:/ai_tools -w /ai_tools \
tensorflow/build:2.15-python${{ matrix.python-version }} \
.github/scripts/build_linux_wheel.sh
fi
sudo apt-get -y -qq install patchelf --no-install-recommends
python -m pip install auditwheel==5.2.0 --no-cache-dir
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
macos-arm-release-wheel:
name: Build release wheels for macOS arm64
needs: [build-release-archive]
runs-on: macos-11
runs-on: macos-14
strategy:
matrix:
python-version: [3.9]
Expand Down Expand Up @@ -243,12 +243,19 @@ jobs:
fi
popd
docker run -e SETUPTOOLS_SCM_PRETEND_VERSION=${{ env.TAG_VERSION }} \
if [[ -n $GOOGLE_APPLICATION_CREDENTIALS ]]; then
docker run -e SETUPTOOLS_SCM_PRETEND_VERSION=${{ env.PRETEND_VERSION }} \
-e GOOGLE_APPLICATION_CREDENTIALS=/tmp/gcloud-credentials.json \
-v $GOOGLE_APPLICATION_CREDENTIALS:/tmp/gcloud-credentials.json:ro \
-v ${PWD}:/ai_tools -w /ai_tools \
tensorflow/build:2.15-python${{ matrix.python-version }} \
.github/scripts/build_linux_wheel.sh
else
docker run -e SETUPTOOLS_SCM_PRETEND_VERSION=${{ env.PRETEND_VERSION }} \
-v ${PWD}:/ai_tools -w /ai_tools \
tensorflow/build:2.15-python${{ matrix.python-version }} \
.github/scripts/build_linux_wheel.sh
fi
sudo apt-get -y -qq install patchelf --no-install-recommends
python -m pip install auditwheel==5.2.0 --no-cache-dir
Expand Down
43 changes: 43 additions & 0 deletions examples/app_single_model_on_two_tiles/Makefile
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

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.
21 changes: 21 additions & 0 deletions examples/app_single_model_on_two_tiles/src/config.xscope
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>
Loading

0 comments on commit 0d82385

Please sign in to comment.