Skip to content

Commit c5c121b

Browse files
kirklandsignfacebook-github-bot
authored andcommitted
Move test spec file (#5218)
Summary: Use the new minibench for both LLM and generic model benchmarking. Pull Request resolved: #5218 Reviewed By: guangy10 Differential Revision: D62478090 Pulled By: kirklandsign fbshipit-source-id: 62a1b7a5cc0212031453e4962122db51c34e0559
1 parent f9da675 commit c5c121b

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

.github/workflows/android-perf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ jobs:
292292
# Unlike models there are limited numbers of build flavor for apps, and the model controls whether it should build with bpe/tiktoken tokenizer.
293293
# It's okay to build all possible apps with all possible flavors in job "build-llm-demo". However, in this job, once a model is given, there is only
294294
# one app+flavor that could load and run the model.
295-
android-app-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/llm_demo/app-debug.apk
296-
android-test-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/llm_demo/app-debug-androidTest.apk
295+
android-app-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/minibench/app-debug.apk
296+
android-test-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/minibench/app-debug-androidTest.apk
297297
# NB: Need to set the default spec here so that it works for periodic too
298298
test-spec: ${{ inputs.test_spec || 'https://ossci-android.s3.amazonaws.com/executorch/android-llm-device-farm-test-spec.yml' }}
299299
# Uploaded to S3 from the previous job

.github/workflows/upload-android-test-specs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ on:
44
pull_request:
55
paths:
66
- .github/workflows/upload-android-test-specs.yml
7-
- examples/demo-apps/android/LlamaDemo/android-llm-device-farm-test-spec.yml
7+
- extension/android/benchmark/android-llm-device-farm-test-spec.yml
88
push:
99
branches:
1010
- main
1111
paths:
1212
- .github/workflows/upload-android-test-specs.yml
13-
- examples/demo-apps/android/LlamaDemo/android-llm-device-farm-test-spec.yml
13+
- extension/android/benchmark/android-llm-device-farm-test-spec.yml
1414

1515
concurrency:
1616
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' }}
@@ -30,7 +30,7 @@ jobs:
3030
${{ github.repository }}/${{ github.run_id }}/artifact
3131
retention-days: 1
3232
if-no-files-found: error
33-
path: examples/demo-apps/android/LlamaDemo/android-llm-device-farm-test-spec.yml
33+
path: extension/android/benchmark/android-llm-device-farm-test-spec.yml
3434

3535
validate-android-test-spec:
3636
needs: upload-android-test-spec-for-validation
@@ -75,7 +75,7 @@ jobs:
7575
7676
- name: Upload the spec to S3 ossci-android bucket
7777
shell: bash
78-
working-directory: examples/demo-apps/android/LlamaDemo/
78+
working-directory: extension/android/benchmark/
7979
env:
8080
SPEC_FILE: android-llm-device-farm-test-spec.yml
8181
run: |

build/build_android_llm_demo.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ build_android_demo_apps() {
111111
mkdir -p extension/android/benchmark/app/libs
112112
cp ${BUILD_AAR_DIR}/executorch.aar extension/android/benchmark/app/libs
113113
pushd extension/android/benchmark
114-
ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew build
114+
ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew build assembleAndroidTest
115115
popd
116116
}
117117

@@ -136,6 +136,7 @@ collect_artifacts_to_be_uploaded() {
136136
MINIBENCH_APP_DIR="${ARTIFACTS_DIR_NAME}/minibench"
137137
mkdir -p "${MINIBENCH_APP_DIR}"
138138
cp extension/android/benchmark/app/build/outputs/apk/debug/*.apk "${MINIBENCH_APP_DIR}"
139+
cp extension/android/benchmark/app/build/outputs/apk/androidTest/debug/*.apk "${MINIBENCH_APP_DIR}"
139140
}
140141

141142
BUILD_AAR_DIR="$(mktemp -d)"

examples/demo-apps/android/LlamaDemo/android-llm-device-farm-test-spec.yml renamed to extension/android/benchmark/android-llm-device-farm-test-spec.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ phases:
6969
# Run the new generic benchmark activity https://developer.android.com/tools/adb#am
7070
- echo "Run LLM benchmark"
7171
- |
72-
adb -s $DEVICEFARM_DEVICE_UDID shell am start -W -n com.example.executorchllamademo/.LlmBenchmarkRunner \
72+
adb -s $DEVICEFARM_DEVICE_UDID shell am start -W -n org.pytorch.minibench/.LlmBenchmarkActivity \
7373
--es "model_dir" "/data/local/tmp/llama" \
7474
--es "tokenizer_path" "/data/local/tmp/llama/tokenizer.bin"
7575
@@ -82,12 +82,12 @@ phases:
8282
MAX_ATTEMPT=10
8383
while [ -z "${BENCHMARK_RESULTS}" ] && [ $ATTEMPT -lt $MAX_ATTEMPT ]; do
8484
echo "Waiting for benchmark results..."
85-
BENCHMARK_RESULTS=$(adb -s $DEVICEFARM_DEVICE_UDID shell run-as com.example.executorchllamademo cat files/benchmark_results.json)
85+
BENCHMARK_RESULTS=$(adb -s $DEVICEFARM_DEVICE_UDID shell run-as org.pytorch.minibench cat files/benchmark_results.json)
8686
sleep 30
8787
((ATTEMPT++))
8888
done
8989
90-
adb -s $DEVICEFARM_DEVICE_UDID shell run-as com.example.executorchllamademo ls -la files/
90+
adb -s $DEVICEFARM_DEVICE_UDID shell run-as org.pytorch.minibench ls -la files/
9191
# Trying to pull the file using adb ends up with permission error, but this works too, so why not
9292
echo "${BENCHMARK_RESULTS}" > $DEVICEFARM_LOG_DIR/benchmark_results.json
9393

0 commit comments

Comments
 (0)