2525 description : The list of configs used the benchmark
2626 required : false
2727 type : string
28- test_spec :
29- description : The test spec to drive the test on AWS devices
30- required : false
31- type : string
3228 workflow_call :
3329 inputs :
3430 models :
5046 description : The list of configs used the benchmark
5147 required : false
5248 type : string
53- test_spec :
54- description : The test spec to drive the test on AWS devices
55- required : false
56- type : string
5749
5850concurrency :
5951 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' }}
@@ -114,6 +106,41 @@ jobs:
114106 echo "devices=$(echo "$MAPPED_ARNS_JSON" | jq -c .)" >> $GITHUB_OUTPUT
115107 echo "delegates=$(echo $DELEGATES | jq -Rc 'split(",")')" >> $GITHUB_OUTPUT
116108
109+ prepare-test-specs :
110+ runs-on : linux.2xlarge
111+ needs : set-parameters
112+ strategy :
113+ matrix :
114+ model : ${{ fromJson(needs.set-parameters.outputs.models) }}
115+ delegate : ${{ fromJson(needs.set-parameters.outputs.delegates) }}
116+ fail-fast : false
117+ steps :
118+ - uses : actions/checkout@v3
119+
120+ - name : Prepare the spec
121+ shell : bash
122+ working-directory : extension/benchmark/apple/Benchmark
123+ run : |
124+ set -eux
125+ # The model will be exported in the next step to this S3 path
126+ MODEL_PATH="https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.delegate }}/model.zip"
127+ # We could write a script to properly use jinja here, but there is only one variable,
128+ # so let's just sed it
129+ sed -i -e 's,{{ model_path }},'"${MODEL_PATH}"',g' default-ios-device-farm-appium-test-spec.yml.j2
130+ cp default-ios-device-farm-appium-test-spec.yml.j2 default-ios-device-farm-appium-test-spec.yml
131+ # Just print the test spec for debugging
132+ cat default-ios-device-farm-appium-test-spec.yml
133+
134+ - name : Upload the spec
135+ uses : seemethere/upload-artifact-s3@v5
136+ with :
137+ s3-bucket : gha-artifacts
138+ s3-prefix : |
139+ ${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.delegate }}
140+ retention-days : 1
141+ if-no-files-found : error
142+ path : extension/benchmark/apple/Benchmark/default-ios-device-farm-appium-test-spec.yml
143+
117144 export-models :
118145 name : export-models
119146 uses : pytorch/test-infra/.github/workflows/macos_job.yml@main
@@ -173,10 +200,19 @@ jobs:
173200 DELEGATE_CONFIG="mps"
174201 fi
175202 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}"
203+ bash .ci/scripts/test_llama.sh \
204+ -model "${{ matrix.model }}" \
205+ -build_tool "${BUILD_MODE}" \
206+ -dtype "${DTYPE}" \
207+ -mode "${DELEGATE_CONFIG}" \
208+ -upload "${ARTIFACTS_DIR_NAME}"
177209 else
178210 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
179- bash .ci/scripts/test_model.sh "${{ matrix.model }}" "${BUILD_MODE}" "${{ matrix.delegate }}" "${ARTIFACTS_DIR_NAME}"
211+ bash .ci/scripts/test_model.sh \
212+ "${{ matrix.model }}" \
213+ "${BUILD_MODE}" \
214+ "${{ matrix.delegate }}" \
215+ "${ARTIFACTS_DIR_NAME}"
180216 fi
181217 echo "::endgroup::"
182218
@@ -282,6 +318,7 @@ jobs:
282318 if : always()
283319 needs :
284320 - set-parameters
321+ - prepare-test-specs
285322 - upload-benchmark-app
286323 - export-models
287324 permissions :
@@ -307,8 +344,7 @@ jobs:
307344 # Uploaded to S3 from the previous job
308345 ios-ipa-archive : https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/Benchmark.ipa
309346 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
347+ 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
312348
313349 upload-benchmark-results :
314350 needs :
0 commit comments