@@ -3,6 +3,16 @@ name: apple-perf
3
3
on :
4
4
schedule :
5
5
- 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
6
16
# Note: GitHub has an upper limit of 10 inputs
7
17
workflow_dispatch :
8
18
inputs :
25
35
description : The list of configs used the benchmark
26
36
required : false
27
37
type : string
28
- test_spec :
29
- description : The test spec to drive the test on AWS devices
30
- required : false
31
- type : string
32
38
workflow_call :
33
39
inputs :
34
40
models :
50
56
description : The list of configs used the benchmark
51
57
required : false
52
58
type : string
53
- test_spec :
54
- description : The test spec to drive the test on AWS devices
55
- required : false
56
- type : string
57
59
58
60
concurrency :
59
61
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' }}
74
76
# Separate default values from the workflow dispatch. To ensure defaults are accessible
75
77
# during scheduled runs and to provide flexibility for different defaults between
76
78
# 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' }}
80
82
run : |
81
83
set -ex
82
84
MODELS="${{ inputs.models }}"
@@ -114,6 +116,41 @@ jobs:
114
116
echo "devices=$(echo "$MAPPED_ARNS_JSON" | jq -c .)" >> $GITHUB_OUTPUT
115
117
echo "delegates=$(echo $DELEGATES | jq -Rc 'split(",")')" >> $GITHUB_OUTPUT
116
118
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
+
117
154
export-models :
118
155
name : export-models
119
156
uses : pytorch/test-infra/.github/workflows/macos_job.yml@main
@@ -173,10 +210,19 @@ jobs:
173
210
DELEGATE_CONFIG="mps"
174
211
fi
175
212
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}"
177
219
else
178
220
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}"
180
226
fi
181
227
echo "::endgroup::"
182
228
@@ -282,6 +328,7 @@ jobs:
282
328
if : always()
283
329
needs :
284
330
- set-parameters
331
+ - prepare-test-specs
285
332
- upload-benchmark-app
286
333
- export-models
287
334
permissions :
@@ -307,8 +354,7 @@ jobs:
307
354
# Uploaded to S3 from the previous job
308
355
ios-ipa-archive : https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/Benchmark.ipa
309
356
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
312
358
313
359
upload-benchmark-results :
314
360
needs :
0 commit comments