-
Notifications
You must be signed in to change notification settings - Fork 653
Summary: Add MCU model verification to CI #13572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -19,23 +19,16 @@ set -u | |
|
||
# Valid targets for MCU model validation | ||
VALID_TARGETS=( | ||
"ethos-u55-32" | ||
"ethos-u55-64" | ||
"ethos-u55-128" | ||
"ethos-u55-256" | ||
"ethos-u85-128" | ||
"ethos-u85-256" | ||
"ethos-u85-512" | ||
"ethos-u85-1024" | ||
"ethos-u85-2048" | ||
"cortex-m55" | ||
"cortex-m85" | ||
) | ||
|
||
# Default models for MCU validation with portable kernels | ||
DEFAULT_MODELS=(mv2 mv3 lstm resnet18) | ||
DEFAULT_MODELS=(mv2 mv3 lstm) | ||
# Available models (on FVP) | ||
AVAILABLE_MODELS=(mv2 mv3 lstm resnet18) | ||
AVAILABLE_MODELS=(mv2 mv3 lstm) | ||
# Add the following models if you want to enable them later (atm they are not working on FVP) | ||
# edsr w2l ic3 ic4 resnet50 | ||
# edsr w2l ic3 ic4 resnet18 resnet50 | ||
|
||
# Variables | ||
TARGET="" | ||
|
@@ -71,6 +64,22 @@ validate_models() { | |
return 0 | ||
} | ||
|
||
cpu_to_ethos_target() { | ||
local cpu=$1 | ||
case $cpu in | ||
cortex-m55) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah perfect!! ❤️ |
||
echo "ethos-u55-128" | ||
;; | ||
cortex-m85) | ||
echo "ethos-u85-128" | ||
;; | ||
*) | ||
echo "Unknown CPU: $cpu" >&2 | ||
return 1 | ||
;; | ||
esac | ||
} | ||
|
||
# Function to show usage | ||
show_usage() { | ||
echo "Usage: $0 --target=<target> [--models=<model1,model2,...>]" | ||
|
@@ -224,6 +233,13 @@ fi | |
echo "✅ ExecuteTorch libraries built successfully" | ||
echo "" | ||
|
||
ETHOS_TARGET=$(cpu_to_ethos_target "$TARGET") | ||
if [[ $? -ne 0 ]]; then | ||
echo "Invalid CPU target: $TARGET" | ||
exit 1 | ||
fi | ||
echo "Using ETHOS target: $ETHOS_TARGET" | ||
|
||
# Process each model | ||
for model in "${MODELS[@]}"; do | ||
echo "=== 🚀 Processing $model for $TARGET ===" | ||
|
@@ -239,7 +255,7 @@ for model in "${MODELS[@]}"; do | |
echo "⚙️ AOT compilation for $model" | ||
if ! python3 -m examples.arm.aot_arm_compiler \ | ||
-m "$model" \ | ||
--target="$TARGET" \ | ||
--target="$ETHOS_TARGET" \ | ||
--quantize \ | ||
--output="arm_test/$model"; then | ||
echo "❌ AOT compilation failed for $model" | ||
|
@@ -250,8 +266,8 @@ for model in "${MODELS[@]}"; do | |
if [[ "$MODEL_SUCCESS" == true ]]; then | ||
echo "🔨 Building executor runner for $model" | ||
if ! backends/arm/scripts/build_executor_runner.sh \ | ||
--pte="arm_test/$model/${model}_arm_${TARGET}.pte" \ | ||
--target="$TARGET" \ | ||
--pte="arm_test/$model/${model}_arm_${ETHOS_TARGET}.pte" \ | ||
--target="$ETHOS_TARGET" \ | ||
--output="arm_test/$model"; then | ||
echo "❌ Executor runner build failed for $model" | ||
MODEL_SUCCESS=false | ||
|
@@ -263,7 +279,7 @@ for model in "${MODELS[@]}"; do | |
echo "🏃 Running $model on FVP with portable kernels" | ||
if ! backends/arm/scripts/run_fvp.sh \ | ||
--elf="arm_test/$model/arm_executor_runner" \ | ||
--target="$TARGET"; then | ||
--target="$ETHOS_TARGET"; then | ||
echo "❌ FVP execution failed for $model" | ||
MODEL_SUCCESS=false | ||
fi | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.