Skip to content

Commit

Permalink
misc: Update workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
iabdalkader committed Jul 25, 2024
1 parent 3d397e9 commit b6158e3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/tflm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ jobs:
fail-fast: true

steps:
- name: '🛠 Configure locale'
run: |
sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
sudo update-locale LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=C.UTF-8
export LANGUAGE=en_US.UTF-8
locale
- name: '⏳ Checkout main'
uses: actions/checkout@v4
with:
Expand All @@ -62,6 +72,9 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: source tools/ci.sh && ci_install_arm_gcc

- name: '🛠 Install Make '
run: source tools/ci.sh && ci_install_make

- name: '🐍 Set up Python'
uses: actions/setup-python@v5
with:
Expand All @@ -75,6 +88,13 @@ jobs:
- name: '🏗 Build TFLM'
run: |
source tools/ci.sh
arm-none-eabi-gcc --version
make --version
sudo update-locale LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=C.UTF-8
export LANGUAGE=en_US.UTF-8
locale
ci_build_target ${{ matrix.target.name }} \
${{ matrix.target.arch }} \
"${{ matrix.target.kernel }}" \
Expand Down Expand Up @@ -111,7 +131,7 @@ jobs:
if-no-files-found: error

push-artifacts:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
needs: [build-tflm]
if: github.event_name == 'push'
permissions:
Expand Down
29 changes: 21 additions & 8 deletions tools/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,26 @@
TFLM_REPO_PATH=tflite-micro
TOOLCHAIN_PATH=${HOME}/cache/gcc
export PATH=${TOOLCHAIN_PATH}/bin:${PATH}
MAKE_URL="https://ftp.gnu.org/gnu/make/make-4.4.1.tar.gz"
TOOLCHAIN_URL="https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz"

ci_install_arm_gcc() {
mkdir -p ${TOOLCHAIN_PATH}
wget --no-check-certificate -O - ${TOOLCHAIN_URL} | tar --strip-components=1 -Jx -C ${TOOLCHAIN_PATH}
export PATH=${TOOLCHAIN_PATH}/bin:${PATH}
arm-none-eabi-gcc --version
}

ci_install_make() {
MAKE_PATH=make-build
# extract and build make then copy to ${TOOLCHAIN_PATH}
mkdir -p ${MAKE_PATH}
wget --no-check-certificate -O - ${MAKE_URL} | tar --strip-components=1 -xz -C ${MAKE_PATH}

pushd ${MAKE_PATH}
./configure --prefix=/usr
make -j$(nproc)
sudo make install
popd
}

# Update Submodules.
Expand All @@ -38,14 +51,14 @@ ci_build_target() {

ETHOSU_CONFIG="-DNPU_QCONFIG=0 -DNPU_REGIONCFG_0=0 -DAXI_LIMIT0_MAX_BEATS_BYTES=1 -DAXI_LIMIT0_MEM_TYPE=2 -DAXI_LIMIT1_MAX_BEATS_BYTES=1 -DAXI_LIMIT1_MEM_TYPE=2 -DAXI_LIMIT2_MAX_BEATS_BYTES=1 -DAXI_LIMIT2_MEM_TYPE=2 -DAXI_LIMIT3_MAX_BEATS_BYTES=1 -DAXI_LIMIT3_MEM_TYPE=2"

echo "make -j$(nproc) -f tensorflow/lite/micro/tools/make/Makefile \
TARGET=cortex_m_generic TARGET_ARCH=${TARGET_ARCH} CO_PROCESSOR=${TARGET_COPROC} \
${TARGET_ARGS} OPTIMIZED_KERNEL_DIR=${TARGET_KERNEL} CORE_OPTIMIZATION_LEVEL=-O2 \
KERNEL_OPTIMIZATION_LEVEL=-O2 THIRD_PARTY_KERNEL_OPTIMIZATION_LEVEL=-O2 \
TARGET_TOOLCHAIN_ROOT=${TOOLCHAIN_PATH}/bin/ TARGET_TOOLCHAIN_PREFIX=arm-none-eabi- \
ETHOSU_EXTRA_FLAGS=${ETHOSU_CONFIG} BUILD_TYPE=${TARGET_BUILD} MICROLITE_LIB_NAME=libtflm.a microlite"

pushd ${TFLM_REPO_PATH}
echo "make -j$(nproc) -f tensorflow/lite/micro/tools/make/Makefile \
TARGET=cortex_m_generic TARGET_ARCH=${TARGET_ARCH} CO_PROCESSOR=${TARGET_COPROC} \
${TARGET_ARGS} OPTIMIZED_KERNEL_DIR=${TARGET_KERNEL} CORE_OPTIMIZATION_LEVEL=-O2 \
KERNEL_OPTIMIZATION_LEVEL=-O2 THIRD_PARTY_KERNEL_OPTIMIZATION_LEVEL=-O2 \
TARGET_TOOLCHAIN_ROOT=${TOOLCHAIN_PATH}/bin/ TARGET_TOOLCHAIN_PREFIX=arm-none-eabi- \
ETHOSU_EXTRA_FLAGS=${ETHOSU_CONFIG} BUILD_TYPE=${TARGET_BUILD} MICROLITE_LIB_NAME=libtflm.a microlite"

make -j$(nproc) -f tensorflow/lite/micro/tools/make/Makefile \
TARGET=cortex_m_generic TARGET_ARCH=${TARGET_ARCH} CO_PROCESSOR=${TARGET_COPROC} \
${TARGET_ARGS} OPTIMIZED_KERNEL_DIR=${TARGET_KERNEL} CORE_OPTIMIZATION_LEVEL=-O2 \
Expand Down

0 comments on commit b6158e3

Please sign in to comment.