Skip to content

Commit 26dc9fd

Browse files
Guang Yangfacebook-github-bot
authored andcommitted
Ensure iOS benchmark app build is tested in CI (pytorch#5609)
Summary: The benchmark app is broken ([link](https://github.com/pytorch/executorch/actions/runs/11005283319/job/30557685672)) as it builds only on the scheduled job. Fix the build (WIP) and protest it in pull/trunk Pull Request resolved: pytorch#5609 Reviewed By: kirklandsign Differential Revision: D63673334 Pulled By: guangy10 fbshipit-source-id: 58ae482e23df50de80b87bbdad7d359c70f30361
1 parent a91eb8a commit 26dc9fd

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/apple.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- install_requirements.sh
1414
- backends/apple/**
1515
- build/build_apple_frameworks.sh
16+
- build/build_apple_llm_demo.sh
1617
- build/create_frameworks.sh
1718
- build/test_ios_ci.sh
1819
- examples/demo-apps/apple_ios/**
@@ -215,3 +216,70 @@ jobs:
215216
shasum -a 256 "${FILENAME}"
216217
${AWS_CMD} "${FILENAME}" s3://ossci-ios/executorch/ --acl public-read
217218
done
219+
220+
build-benchmark-app:
221+
name: build-benchmark-app
222+
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
223+
secrets: inherit
224+
with:
225+
runner: macos-latest-xlarge
226+
python-version: '3.11'
227+
submodules: 'true'
228+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
229+
upload-artifact: ios-apps
230+
secrets-env: BUILD_CERTIFICATE_BASE64 EXECUTORCH_BENCHMARK_BUILD_PROVISION_PROFILE_BASE64 KEYCHAIN_PASSWORD
231+
timeout: 90
232+
script: |
233+
set -eux
234+
235+
echo "::group::Setting up CI environment"
236+
.ci/scripts/setup-conda.sh
237+
238+
BUILD_TOOL=cmake
239+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
240+
GITHUB_RUNNER=1 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
241+
.ci/scripts/setup-macos.sh "${BUILD_TOOL}"
242+
export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
243+
244+
# Setup Apple certificate for iOS development
245+
BUILD_PROVISION_PROFILE_BASE64="${SECRET_EXECUTORCH_BENCHMARK_BUILD_PROVISION_PROFILE_BASE64}" \
246+
BUILD_CERTIFICATE_BASE64="${SECRET_BUILD_CERTIFICATE_BASE64}" \
247+
KEYCHAIN_PASSWORD="${SECRET_KEYCHAIN_PASSWORD}" \
248+
.ci/scripts/setup-ios.sh
249+
250+
# Install CoreML Backend Requirements
251+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
252+
backends/apple/coreml/scripts/install_requirements.sh
253+
254+
# Install MPS Backend Requirements
255+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
256+
backends/apple/mps/install_requirements.sh
257+
echo "::endgroup::"
258+
259+
echo "::group::Build ExecuTorch iOS frameworks"
260+
FRAMEWORKS=(
261+
"executorch"
262+
"backend_coreml"
263+
"backend_mps"
264+
"backend_xnnpack"
265+
"kernels_custom"
266+
"kernels_optimized"
267+
"kernels_portable"
268+
"kernels_quantized"
269+
)
270+
271+
# Build Release iOS Frameworks
272+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
273+
build/build_apple_frameworks.sh --coreml --custom --mps --optimized --portable --quantized --xnnpack
274+
275+
mkdir -p extension/apple/Benchmark/Frameworks
276+
for FRAMEWORK in "${FRAMEWORKS[@]}"; do (
277+
cp -r "cmake-out/${FRAMEWORK}.xcframework" extension/apple/Benchmark/Frameworks/
278+
) done
279+
echo "::endgroup::"
280+
281+
echo "::group::Build ExecuTorch benchmark app"
282+
mkdir -p extension/apple/Benchmark/Models
283+
${CONDA_RUN} --no-capture-output \
284+
build/build_apple_llm_demo.sh ${ARTIFACTS_DIR_NAME}
285+
echo "::endgroup::"

0 commit comments

Comments
 (0)