diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 7162049ac02..9c38dbb9936 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -940,3 +940,42 @@ jobs: build-mode: Release build-tool: cmake docker-image: ci-image:executorch-ubuntu-22.04-clang12 + + test-mcu-models: + name: test-mcu-models + uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main + strategy: + matrix: + include: + - build-tool: cmake + fail-fast: false + permissions: + id-token: write + contents: read + with: + runner: linux.2xlarge + docker-image: ci-image:executorch-ubuntu-22.04-arm-sdk + submodules: 'recursive' + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + timeout: 90 + script: | + BUILD_TOOL=${{ matrix.build-tool }} + + # The generic Linux job chooses to use base env, not the one setup by the image + CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") + conda activate "${CONDA_ENV}" + + # Try to mirror these as closely as possible + source .ci/scripts/utils.sh + install_executorch "--use-pt-pinned-commit" + + .ci/scripts/setup-arm-baremetal-tools.sh + source examples/arm/ethos-u-scratch/setup_path.sh + + # Run selective Build + chmod +x examples/selective_build/test_selective_build.sh + examples/selective_build/test_selective_build.sh "${BUILD_TOOL}" + + # Run MCU models + chmod +x examples/arm/run_mcu_models_fvp.sh + examples/arm/run_mcu_models_fvp.sh --target=cortex-m55 diff --git a/examples/arm/run_mcu_models_fvp.sh b/examples/arm/run_mcu_models_fvp.sh index fdaf1a6467f..2323b57b620 100755 --- a/examples/arm/run_mcu_models_fvp.sh +++ b/examples/arm/run_mcu_models_fvp.sh @@ -19,15 +19,8 @@ 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 @@ -71,6 +64,22 @@ validate_models() { return 0 } +cpu_to_ethos_target() { + local cpu=$1 + case $cpu in + cortex-m55) + 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= [--models=]" @@ -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