Skip to content

Commit 3b0f271

Browse files
kirklandsignfacebook-github-bot
authored andcommitted
Add more prebuilt artifacts (#3245)
Summary: Build for different ABI in prebuild. Pull Request resolved: #3245 Test Plan: CI Reviewed By: kirklandsign Differential Revision: D56480274 Pulled By: huydhn fbshipit-source-id: 451116a0f90745dd9f08ef32be3fe02940d6fbb1
1 parent 1eaed2b commit 3b0f271

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

.github/workflows/android.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,23 @@ jobs:
4848
# Build Android demo app
4949
bash build/test_android_ci.sh
5050
51+
# Strip libraries for uploda
52+
strip cmake-out-android-arm64-v8a/lib/*.a cmake-out-android-arm64-v8a/extension/android/*.so
53+
strip cmake-out-android-x86_64/lib/*.a cmake-out-android-x86_64/extension/android/*.so
54+
5155
mkdir -p artifacts-to-be-uploaded
56+
mkdir -p artifacts-to-be-uploaded/arm64-v8a/
57+
mkdir -p artifacts-to-be-uploaded/x86_64/
58+
# Copy the jar to S3
59+
cp extension/android/build/libs/executorch.jar artifacts-to-be-uploaded/
5260
# Copy the app and its test suite to S3
5361
cp examples/demo-apps/android/LlamaDemo/app/build/outputs/apk/debug/*.apk artifacts-to-be-uploaded/
5462
cp examples/demo-apps/android/LlamaDemo/app/build/outputs/apk/androidTest/debug/*.apk artifacts-to-be-uploaded/
55-
# Also copy the share libraries
56-
cp cmake-out-android/lib/*.a artifacts-to-be-uploaded/
63+
# Also copy the libraries
64+
cp cmake-out-android-arm64-v8a/lib/*.a artifacts-to-be-uploaded/arm64-v8a/
65+
cp cmake-out-android-arm64-v8a/extension/android/*.so artifacts-to-be-uploaded/arm64-v8a/
66+
cp cmake-out-android-x86_64/lib/*.a artifacts-to-be-uploaded/x86_64/
67+
cp cmake-out-android-x86_64/extension/android/*.so artifacts-to-be-uploaded/x86_64/
5768
5869
# Upload the app and its test suite to S3 so that they can be downloaded by the test job
5970
upload-artifacts:

build/test_android_ci.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,20 @@
88
set -ex
99

1010
# https://github.com/pytorch/executorch/tree/main/examples/demo-apps/android/ExecuTorchDemo
11-
build_executorch() {
11+
export_model() {
1212
MODEL_NAME=dl3
1313
# Delegating DeepLab v3 to XNNPACK backend
1414
python -m examples.xnnpack.aot_compiler --model_name="${MODEL_NAME}" --delegate
1515

1616
ASSETS_DIR=examples/demo-apps/android/ExecuTorchDemo/app/src/main/assets/
1717
mkdir -p "${ASSETS_DIR}"
1818
cp "${MODEL_NAME}_xnnpack_fp32.pte" "${ASSETS_DIR}"
19+
}
1920

20-
rm -rf cmake-out && mkdir cmake-out
21-
ANDROID_NDK=/opt/ndk BUCK2=$(which buck2) FLATC=$(which flatc) ANDROID_ABI=arm64-v8a \
22-
bash examples/demo-apps/android/ExecuTorchDemo/setup.sh
21+
build_android_native_library() {
22+
pushd examples/demo-apps/android/LlamaDemo
23+
CMAKE_OUT="cmake-out-android-$1" ANDROID_NDK=/opt/ndk ANDROID_ABI="$1" ./gradlew setup
24+
popd
2325
}
2426

2527
build_android_demo_app() {
@@ -30,12 +32,13 @@ build_android_demo_app() {
3032

3133
build_android_llama_demo_app() {
3234
pushd examples/demo-apps/android/LlamaDemo
33-
ANDROID_NDK=/opt/ndk ANDROID_ABI=arm64-v8a ./gradlew setup
3435
ANDROID_HOME=/opt/android/sdk ./gradlew build
3536
ANDROID_HOME=/opt/android/sdk ./gradlew assembleAndroidTest
3637
popd
3738
}
3839

39-
build_executorch
40+
build_android_native_library arm64-v8a
41+
build_android_native_library x86_64
42+
export_model
4043
build_android_demo_app
4144
build_android_llama_demo_app

0 commit comments

Comments
 (0)