Skip to content

Commit fbbcb8c

Browse files
committed
Update on "[executorch] Migrate runtime/platform tests to new namespace"
The previous commit moved headers to the `::executorch::runtime` namespace. This diff updates the tests for those changes. After this, these tests should not use `::torch::executor` for the updated names. Differential Revision: [D60428953](https://our.internmc.facebook.com/intern/diff/D60428953/) [ghstack-poisoned]
2 parents cfbe6a1 + 3a15f0e commit fbbcb8c

File tree

241 files changed

+6665
-2404
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+6665
-2404
lines changed

.ci/scripts/test_llama.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ cleanup_files() {
130130
prepare_artifacts_upload() {
131131
if [ -n "$UPLOAD_DIR" ]; then
132132
echo "Preparing for uploading generated artifacs"
133+
zip -j model.zip "${EXPORTED_MODEL_NAME}" tokenizer.bin
133134
mkdir -p "${UPLOAD_DIR}"
134-
zip -j "model.zip" "${MODEL_NAME}" tokenizer.bin
135-
cp "model.zip" "${UPLOAD_DIR}"
135+
mv model.zip "${UPLOAD_DIR}"
136136
fi
137137
}
138138

.github/ghstack_direct

Whitespace-only changes.

.github/workflows/android-perf.yml

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,47 @@ on:
3030
description: The list of configs used the benchmark
3131
required: false
3232
type: string
33+
test_spec:
34+
description: The test spec to drive the test on AWS devices
35+
required: false
36+
type: string
37+
default: https://ossci-android.s3.amazonaws.com/executorch/android-llm-device-farm-test-spec.yml
38+
workflow_call:
39+
inputs:
40+
models:
41+
description: Models to be benchmarked
42+
required: false
43+
type: string
44+
default: stories110M
45+
devices:
46+
description: Target devices to run benchmark
47+
required: false
48+
type: string
49+
default: samsung_galaxy_s2x
50+
delegates:
51+
description: Backend delegates
52+
required: false
53+
type: string
54+
default: xnnpack
55+
threadpool:
56+
description: Run with threadpool?
57+
required: false
58+
type: boolean
59+
default: false
60+
benchmark_configs:
61+
description: The list of configs used the benchmark
62+
required: false
63+
type: string
64+
test_spec:
65+
description: The test spec to drive the test on AWS devices
66+
required: false
67+
type: string
68+
default: https://ossci-android.s3.amazonaws.com/executorch/android-llm-device-farm-test-spec.yml
3369

3470
concurrency:
3571
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' }}
3672
cancel-in-progress: true
3773

38-
permissions: read-all
39-
4074
jobs:
4175
set-parameters:
4276
runs-on: linux.2xlarge
@@ -48,11 +82,27 @@ jobs:
4882
- name: Set parameters
4983
id: set-parameters
5084
shell: bash
85+
env:
86+
# Separate default values from the workflow dispatch. To ensure defaults are accessible
87+
# during scheduled runs and to provide flexibility for different defaults between
88+
# on-demand and periodic benchmarking.
89+
CRON_DEFAULT_MODELS: "stories110M"
90+
CRON_DEFAULT_DEVICES: "samsung_galaxy_s2x"
91+
CRON_DEFAULT_DELEGATES: "xnnpack"
5192
run: |
5293
set -ex
5394
MODELS="${{ inputs.models }}"
95+
if [ -z "$MODELS" ]; then
96+
MODELS="$CRON_DEFAULT_MODELS"
97+
fi
5498
DEVICES="${{ inputs.devices }}"
99+
if [ -z "$DEVICES" ]; then
100+
DEVICES="$CRON_DEFAULT_DEVICES"
101+
fi
55102
DELEGATES="${{ inputs.delegates }}"
103+
if [ -z "$DELEGATES" ]; then
104+
DELEGATES="$CRON_DEFAULT_DELEGATES"
105+
fi
56106
57107
# Mapping devices to their corresponding device-pool-arn
58108
declare -A DEVICE_POOL_ARNS
@@ -218,7 +268,6 @@ jobs:
218268
# TODO: Hard code llm_demo_bpe for now in this job.
219269
android-app-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/llm_demo_bpe/app-debug.apk
220270
android-test-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/llm_demo_bpe/app-debug-androidTest.apk
221-
# The test spec can be downloaded from https://ossci-assets.s3.amazonaws.com/android-llama2-device-farm-test-spec.yml
222-
test-spec: arn:aws:devicefarm:us-west-2:308535385114:upload:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/abd86868-fa63-467e-a5c7-218194665a77
271+
test-spec: ${{ inputs.test_spec }}
223272
# Uploaded to S3 from the previous job
224273
extra-data: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/${{ matrix.model }}_${{ matrix.delegate }}/model.zip

.github/workflows/android.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ jobs:
170170
# Uploaded to S3 from the previous job, the name of the app comes from the project itself
171171
android-app-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/llm_demo_${{ matrix.tokenizer }}/app-debug.apk
172172
android-test-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/llm_demo_${{ matrix.tokenizer }}/app-debug-androidTest.apk
173-
# The test spec can be downloaded from https://ossci-assets.s3.amazonaws.com/android-llama2-device-farm-test-spec.yml
174-
test-spec: arn:aws:devicefarm:us-west-2:308535385114:upload:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/abd86868-fa63-467e-a5c7-218194665a77
173+
test-spec: https://ossci-android.s3.amazonaws.com/executorch/android-llm-device-farm-test-spec.yml
175174
# Among the input, this is the biggest file, so it is cached on AWS to make the test faster. Note that the file is deleted by AWS after 30
176175
# days and the job will automatically re-upload the file when that happens.
177176
extra-data: https://ossci-assets.s3.amazonaws.com/executorch-android-llama2-7b-0717.zip

.github/workflows/pull.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -205,27 +205,13 @@ jobs:
205205
206206
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "cmake"
207207
208+
# install pybind
209+
bash install_requirements.sh --pybind xnnpack
210+
208211
# install Llava requirements
209212
bash examples/models/llama2/install_requirements.sh
210213
bash examples/models/llava/install_requirements.sh
211214
212-
# run export_llava.sh
213-
python examples/models/llava/export_llava.py --use-sdpa-with-kv-cache --pte-name llava_custom_sdpa.pte
214-
215-
# verify file exists
216-
if [ ! -f "llava_custom_sdpa.pte" ]; then
217-
echo "llava_custom_sdpa.pte not found!"
218-
exit 1
219-
fi
220-
221-
python examples/models/llava/export_llava.py --no-use-sdpa-with-kv-cache --pte-name llava.pte
222-
223-
# verify file exists
224-
if [ ! -f "llava.pte" ]; then
225-
echo "llava.pte not found!"
226-
exit 1
227-
fi
228-
229215
# run python unittest
230216
python -m unittest examples.models.llava.test.test_llava
231217
@@ -337,7 +323,7 @@ jobs:
337323
size=${arr[4]}
338324
# threshold=48120 on devserver with gcc11.4
339325
# todo(lfq): update once binary size is below 50kb.
340-
threshold="51768"
326+
threshold="51784"
341327
if [[ "$size" -le "$threshold" ]]; then
342328
echo "Success $size <= $threshold"
343329
else
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Upload AWS Device Farm test specs
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .github/workflows/upload-test-specs.yml
7+
- examples/demo-apps/android/LlamaDemo/android-llm-device-farm-test-spec.yml
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- .github/workflows/upload-test-specs.yml
13+
- examples/demo-apps/android/LlamaDemo/android-llm-device-farm-test-spec.yml
14+
15+
concurrency:
16+
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' }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
upload-android-test-spec-for-validation:
21+
runs-on: linux.2xlarge
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: Upload the spec as a GitHub artifact for validation
26+
uses: seemethere/upload-artifact-s3@v5
27+
with:
28+
s3-bucket: gha-artifacts
29+
s3-prefix: |
30+
${{ github.repository }}/${{ github.run_id }}/artifact
31+
retention-days: 1
32+
if-no-files-found: error
33+
path: examples/demo-apps/android/LlamaDemo/android-llm-device-farm-test-spec.yml
34+
35+
validate-android-test-spec:
36+
needs: upload-android-test-spec-for-validation
37+
uses: ./.github/workflows/android-perf.yml
38+
permissions:
39+
id-token: write
40+
contents: read
41+
with:
42+
# Just use a small model here with a minimal amount of configuration to test the spec
43+
models: stories110M
44+
devices: samsung_galaxy_s2x
45+
delegates: xnnpack
46+
test_spec: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/android-llm-device-farm-test-spec.yml
47+
48+
upload-android-test-spec:
49+
needs: validate-android-test-spec
50+
runs-on: ubuntu-22.04
51+
timeout-minutes: 15
52+
permissions:
53+
id-token: write
54+
contents: read
55+
steps:
56+
- uses: actions/checkout@v3
57+
58+
- uses: actions/setup-python@v4
59+
with:
60+
python-version: '3.11'
61+
cache: pip
62+
63+
- name: configure aws credentials
64+
uses: aws-actions/[email protected]
65+
with:
66+
role-to-assume: arn:aws:iam::308535385114:role/gha_executorch_upload-frameworks-android
67+
aws-region: us-east-1
68+
69+
- name: Only push to S3 when running the workflow manually from main branch
70+
if: ${{ github.ref == 'refs/heads/main' }}
71+
shell: bash
72+
run: |
73+
set -eux
74+
echo "UPLOAD_ON_MAIN=1" >> "${GITHUB_ENV}"
75+
76+
- name: Upload the spec to S3 ossci-android bucket
77+
shell: bash
78+
working-directory: examples/demo-apps/android/LlamaDemo/
79+
env:
80+
SPEC_FILE: android-llm-device-farm-test-spec.yml
81+
run: |
82+
set -eux
83+
84+
pip install awscli==1.32.18
85+
86+
AWS_CMD="aws s3 cp --dryrun"
87+
if [[ "${UPLOAD_ON_MAIN:-0}" == "1" ]]; then
88+
AWS_CMD="aws s3 cp"
89+
fi
90+
91+
shasum -a 256 "${SPEC_FILE}"
92+
${AWS_CMD} "${SPEC_FILE}" s3://ossci-android/executorch/ --acl public-read

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
[submodule "backends/xnnpack/third-party/pthreadpool"]
2929
path = backends/xnnpack/third-party/pthreadpool
3030
url = https://github.com/Maratyszcza/pthreadpool.git
31-
[submodule "examples/third-party/LLaVA"]
32-
path = examples/third-party/LLaVA
33-
url = https://github.com/haotian-liu/LLaVA.git
3431
[submodule "examples/third-party/fbjni"]
3532
path = examples/third-party/fbjni
3633
url = https://github.com/facebookincubator/fbjni.git

backends/apple/coreml/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ xcode-select --install
5050

5151
```bash
5252
cd executorch
53-
./build/build_apple_frameworks.sh --Release --coreml
53+
./build/build_apple_frameworks.sh --coreml
5454
```
5555
5. Open the project in Xcode, and drag `executorch.xcframework` and `coreml_backend.xcframework` frameworks generated from Step 2 to Frameworks.
5656

backends/apple/mps/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ add_library(mpsdelegate ${_mps_backend__srcs})
6969
find_library(FOUNDATION_FRAMEWORK Foundation)
7070
find_library(METAL_FRAMEWORK Metal)
7171
find_library(MPS_FRAMEWORK MetalPerformanceShaders)
72-
find_library(MPS_GRAPG_FRAMEWORK MetalPerformanceShadersGraph)
72+
find_library(MPS_GRAPH_FRAMEWORK MetalPerformanceShadersGraph)
7373

7474
target_link_libraries(
7575
mpsdelegate
@@ -79,7 +79,7 @@ target_link_libraries(
7979
${FOUNDATION_FRAMEWORK}
8080
${METAL_FRAMEWORK}
8181
${MPS_FRAMEWORK}
82-
${MPS_GRAPG_FRAMEWORK}
82+
${MPS_GRAPH_FRAMEWORK}
8383
)
8484

8585
target_link_options_shared_lib(mpsdelegate)

0 commit comments

Comments
 (0)