Fix Corstone Ethos-U CI failure (#2460)
@tensorflow/micro
Capture size, then remove model size var from person_detect_model_data_vela.cc
Update model size var in person_detect_model_data.h
Add cortex_m_generic and cortex_m_corstone_300 tests to CI full run
bug=fixes #2455
diff --git a/.github/workflows/cortex_m.yml b/.github/workflows/cortex_m.yml
index 26fe77d..7a78b3f 100644
--- a/.github/workflows/cortex_m.yml
+++ b/.github/workflows/cortex_m.yml
@@ -14,13 +14,19 @@
# Allow manually triggering of the workflow.
workflow_dispatch: {}
+ pull_request_target:
+ types:
+ - closed
+ - labeled
+
jobs:
cortex_m_generic:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
- (github.event_name == 'schedule' && github.repository == 'tensorflow/tflite-micro')
+ (github.event_name == 'schedule' && github.repository == 'tensorflow/tflite-micro') ||
+ contains(github.event.pull_request.labels.*.name, 'ci:run_full')
name: Cortex-M Generic
steps:
@@ -42,7 +48,8 @@
if: |
github.event_name == 'workflow_dispatch' ||
- (github.event_name == 'schedule' && github.repository == 'tensorflow/tflite-micro')
+ (github.event_name == 'schedule' && github.repository == 'tensorflow/tflite-micro') ||
+ contains(github.event.pull_request.labels.*.name, 'ci:run_full')
name: Cortex-M Corstone 300 (FVP)
steps:
diff --git a/.github/workflows/tests_post.yml b/.github/workflows/tests_post.yml
index 719adaa..91c1946 100644
--- a/.github/workflows/tests_post.yml
+++ b/.github/workflows/tests_post.yml
@@ -29,8 +29,16 @@
secrets:
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}
+ cortex_m_ci_full:
+ if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:run_full') }}
+ uses: ./.github/workflows/cortex_m.yml
+ with:
+ trigger-sha: ${{ github.event.pull_request.head.sha }}
+ secrets:
+ tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}
+
issue_on_error:
- needs: [riscv_postmerge,xtensa_postmerge]
+ needs: [riscv_postmerge,xtensa_postmerge,cortex_m_ci_full]
if: ${{ always() && contains(needs.*.result, 'failure') &&
!contains(github.event.pull_request.labels.*.name, 'ci:run_full') }}
uses: ./.github/workflows/issue_on_error.yml
diff --git a/tensorflow/lite/micro/tools/make/ext_libs/person_detection_int8_vela_convert.sh b/tensorflow/lite/micro/tools/make/ext_libs/person_detection_int8_vela_convert.sh
index da51d75..4b0ee89 100755
--- a/tensorflow/lite/micro/tools/make/ext_libs/person_detection_int8_vela_convert.sh
+++ b/tensorflow/lite/micro/tools/make/ext_libs/person_detection_int8_vela_convert.sh
@@ -47,6 +47,7 @@
# See tensorflow/lite/micro/kernels/ethos_u/README.md for more info.
MODEL_DIR=${GENERATED_SRCS_DIR}tensorflow/lite/micro/models
CONVERTED_PERSON_MODEL_INT8=${MODEL_DIR}/person_detect_model_data_vela.cc
+PERSON_MODEL_HEADER=${MODEL_DIR}/person_detect_model_data.h
if [ ! -f ${CONVERTED_PERSON_MODEL_INT8} ]; then
# Compile an optimized .tflite version for Ethos-U.
@@ -68,9 +69,10 @@
xxd -i ${MODEL_DIR}/person_detect_vela.tflite >> ${CONVERTED_PERSON_MODEL_INT8}
sed -i 's/gen_cortex_m_corstone_300_cortex_m55_default_genfiles_tensorflow_lite_micro_models_person_detect_vela_tflite/g_person_detect_model_data/' \
${CONVERTED_PERSON_MODEL_INT8}
- sed -i 's/^const unsigned char g_person_detect_model_data/alignas\(16\) &/' ${CONVERTED_PERSON_MODEL_INT8}
- sed -i 's/g_person_detect_model_data_len/g_person_detect_model_data_size/' ${CONVERTED_PERSON_MODEL_INT8}
- sed -i 's/unsigned int/const unsigned int/' ${CONVERTED_PERSON_MODEL_INT8}
+ sed -i 's/^const unsigned char g_person_detect_model_data/alignas\(16\) &/' ${CONVERTED_PERSON_MODEL_INT8}
+ SIZE=$(sed -E -n -e 's/^.*g_person_detect_model_data_len = ([0-9]+);/\1/p' ${CONVERTED_PERSON_MODEL_INT8})
+ sed -i 's/^.*g_person_detect_model_data_len.*$//' ${CONVERTED_PERSON_MODEL_INT8}
+ sed -E -i "s/(^constexpr.*g_person_detect_model_data_size = )([0-9]+);/\1$SIZE;/" ${PERSON_MODEL_HEADER}
fi
echo "SUCCESS"