@@ -3,6 +3,16 @@ name: apple-perf
33on :
44 schedule :
55 - cron : 0 1 * * *
6+ pull_request :
7+ paths :
8+ - .github/workflows/apple-perf.yml
9+ - extension/benchmark/apple/Benchmark/default-ios-device-farm-appium-test-spec.yml.j2
10+ push :
11+ branches :
12+ - main
13+ paths :
14+ - .github/workflows/apple-perf.yml
15+ - extension/benchmark/apple/Benchmark/default-ios-device-farm-appium-test-spec.yml.j2
616 # Note: GitHub has an upper limit of 10 inputs
717 workflow_dispatch :
818 inputs :
2535 description : The list of configs used the benchmark
2636 required : false
2737 type : string
28- test_spec :
29- description : The test spec to drive the test on AWS devices
30- required : false
31- type : string
3238 workflow_call :
3339 inputs :
3440 models :
5056 description : The list of configs used the benchmark
5157 required : false
5258 type : string
53- test_spec :
54- description : The test spec to drive the test on AWS devices
55- required : false
56- type : string
5759
5860concurrency :
5961 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
7476 # Separate default values from the workflow dispatch. To ensure defaults are accessible
7577 # during scheduled runs and to provide flexibility for different defaults between
7678 # on-demand and periodic benchmarking.
77- CRON_DEFAULT_MODELS : " stories110M,mv3,mv2,ic4,ic3,resnet50,edsr,mobilebert,w2l"
78- CRON_DEFAULT_DEVICES : " apple_iphone_15"
79- CRON_DEFAULT_DELEGATES : " xnnpack,coreml,mps"
79+ CRON_DEFAULT_MODELS : ${{ github.event_name == 'schedule' && ' stories110M,mv3,mv2,ic4,ic3,resnet50,edsr,mobilebert,w2l' || 'stories110M' }}
80+ CRON_DEFAULT_DEVICES : apple_iphone_15
81+ CRON_DEFAULT_DELEGATES : ${{ github.event_name == 'schedule' && ' xnnpack,coreml,mps' || 'xnnpack' }}
8082 run : |
8183 set -ex
8284 MODELS="${{ inputs.models }}"
@@ -114,6 +116,41 @@ jobs:
114116 echo "devices=$(echo "$MAPPED_ARNS_JSON" | jq -c .)" >> $GITHUB_OUTPUT
115117 echo "delegates=$(echo $DELEGATES | jq -Rc 'split(",")')" >> $GITHUB_OUTPUT
116118
119+ prepare-test-specs :
120+ runs-on : linux.2xlarge
121+ needs : set-parameters
122+ strategy :
123+ matrix :
124+ model : ${{ fromJson(needs.set-parameters.outputs.models) }}
125+ delegate : ${{ fromJson(needs.set-parameters.outputs.delegates) }}
126+ fail-fast : false
127+ steps :
128+ - uses : actions/checkout@v3
129+
130+ - name : Prepare the spec
131+ shell : bash
132+ working-directory : extension/benchmark/apple/Benchmark
133+ run : |
134+ set -eux
135+ # The model will be exported in the next step to this S3 path
136+ MODEL_PATH="https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.delegate }}/model.zip"
137+ # We could write a script to properly use jinja here, but there is only one variable,
138+ # so let's just sed it
139+ sed -i -e 's,{{ model_path }},'"${MODEL_PATH}"',g' default-ios-device-farm-appium-test-spec.yml.j2
140+ cp default-ios-device-farm-appium-test-spec.yml.j2 default-ios-device-farm-appium-test-spec.yml
141+ # Just print the test spec for debugging
142+ cat default-ios-device-farm-appium-test-spec.yml
143+
144+ - name : Upload the spec
145+ uses : seemethere/upload-artifact-s3@v5
146+ with :
147+ s3-bucket : gha-artifacts
148+ s3-prefix : |
149+ ${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.delegate }}
150+ retention-days : 1
151+ if-no-files-found : error
152+ path : extension/benchmark/apple/Benchmark/default-ios-device-farm-appium-test-spec.yml
153+
117154 export-models :
118155 name : export-models
119156 uses : pytorch/test-infra/.github/workflows/macos_job.yml@main
@@ -173,10 +210,19 @@ jobs:
173210 DELEGATE_CONFIG="mps"
174211 fi
175212 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
176- bash .ci/scripts/test_llama.sh "${{ matrix.model }}" "${BUILD_MODE}" "${DTYPE}" "${DELEGATE_CONFIG}" "${ARTIFACTS_DIR_NAME}"
213+ bash .ci/scripts/test_llama.sh \
214+ -model "${{ matrix.model }}" \
215+ -build_tool "${BUILD_MODE}" \
216+ -dtype "${DTYPE}" \
217+ -mode "${DELEGATE_CONFIG}" \
218+ -upload "${ARTIFACTS_DIR_NAME}"
177219 else
178220 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
179- bash .ci/scripts/test_model.sh "${{ matrix.model }}" "${BUILD_MODE}" "${{ matrix.delegate }}" "${ARTIFACTS_DIR_NAME}"
221+ bash .ci/scripts/test_model.sh \
222+ "${{ matrix.model }}" \
223+ "${BUILD_MODE}" \
224+ "${{ matrix.delegate }}" \
225+ "${ARTIFACTS_DIR_NAME}"
180226 fi
181227 echo "::endgroup::"
182228
@@ -282,6 +328,7 @@ jobs:
282328 if : always()
283329 needs :
284330 - set-parameters
331+ - prepare-test-specs
285332 - upload-benchmark-app
286333 - export-models
287334 permissions :
@@ -307,8 +354,7 @@ jobs:
307354 # Uploaded to S3 from the previous job
308355 ios-ipa-archive : https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/Benchmark.ipa
309356 ios-xctestrun-zip : https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/Benchmark.xctestrun.zip
310- test-spec : ${{ inputs.test_spec || 'https://ossci-ios.s3.amazonaws.com/executorch/default-ios-device-farm-appium-test-spec.yml' }}
311- extra-data : https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.delegate }}/model.zip
357+ test-spec : https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.delegate }}/default-ios-device-farm-appium-test-spec.yml
312358
313359 upload-benchmark-results :
314360 needs :
0 commit comments