Skip to content

Commit 40caf28

Browse files
committed
Merge remote-tracking branch 'origin/main' into android-sh-update
2 parents 2f46787 + 21adbe2 commit 40caf28

File tree

414 files changed

+11138
-2674
lines changed

Some content is hidden

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

414 files changed

+11138
-2674
lines changed

.ci/docker/requirements-ci.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ parameterized==0.9.0
1717

1818
# Doc build requirements, same as https://github.com/pytorch/pytorch/blob/main/.ci/docker/requirements-docs.txt
1919
sphinx==5.3.0
20+
sphinx-reredirects==0.1.4
2021
sphinx-gallery==0.14.0
2122
breathe==4.34.0
2223
exhale==0.2.3

.ci/scripts/gather_benchmark_configs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"samsung_galaxy_s22": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/e59f866a-30aa-4aa1-87b7-4510e5820dfa",
2424
"samsung_galaxy_s24": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/98f8788c-2e25-4a3c-8bb2-0d1e8897c0db",
2525
"google_pixel_8_pro": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/d65096ab-900b-4521-be8b-a3619b69236a",
26+
"google_pixel_3_private_rooted": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/98d23ca8-ea9e-4fb7-b725-d402017b198d",
2627
}
2728

2829
# Predefined benchmark configurations

.ci/scripts/test_llava.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ run_and_verify() {
154154
EXPECTED_PREFIX="ASSISTANT: image captures a basketball game in progress, with several players on the court. One of the players is dribbling the ball, while the others are in various"
155155
else
156156
# set the expected prefix to be the same as prompt because there's a bug in sdpa_with_kv_cache that causes <unk> tokens.
157-
EXPECTED_PREFIX="ASSISTANT:"
157+
EXPECTED_PREFIX="ASSISTANT: image"
158158
fi
159159
if [[ "${RESULT}" == *"${EXPECTED_PREFIX}"* ]]; then
160160
echo "Expected result prefix: ${EXPECTED_PREFIX}"

.github/workflows/_android.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ jobs:
2222
script: |
2323
set -eux
2424
25+
# Use sccache for NDK compiler as well
26+
export CMAKE_CXX_COMPILER_LAUNCHER=sccache
27+
export CMAKE_C_COMPILER_LAUNCHER=sccache
28+
2529
# The generic Linux job chooses to use base env, not the one setup by the image
2630
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
2731
conda activate "${CONDA_ENV}"
@@ -131,7 +135,8 @@ jobs:
131135
# https://github.com/ReactiveCircus/android-emulator-runner. The max number
132136
# of cores we can set is 6, any higher number will be reduced to 6.
133137
cores: 6
134-
ram-size: 12288M
138+
ram-size: 16384M
139+
heap-size: 12288M
135140
force-avd-creation: false
136141
disable-animations: true
137142
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: android-perf (private devices)
2+
3+
on:
4+
schedule:
5+
- cron: 0 0,4,8,12,16,20 * * *
6+
pull_request:
7+
paths:
8+
- .github/workflows/android-perf-private-device-experiment.yml
9+
push:
10+
branches:
11+
- main
12+
paths:
13+
- .github/workflows/android-perf-private-device-experiment.yml
14+
# Note: GitHub has an upper limit of 10 inputs
15+
workflow_dispatch:
16+
inputs:
17+
models:
18+
description: Models to be benchmarked
19+
required: false
20+
type: string
21+
default: mv3,meta-llama/Llama-3.2-1B-Instruct-SpinQuant_INT4_EO8,meta-llama/Llama-3.2-1B-Instruct-QLORA_INT4_EO8
22+
devices:
23+
description: Target devices to run benchmark
24+
required: false
25+
type: string
26+
default: google_pixel_3_private_rooted
27+
benchmark_configs:
28+
description: The list of configs used the benchmark
29+
required: false
30+
type: string
31+
workflow_call:
32+
inputs:
33+
models:
34+
description: Models to be benchmarked
35+
required: false
36+
type: string
37+
default: mv3,meta-llama/Llama-3.2-1B-Instruct-SpinQuant_INT4_EO8,meta-llama/Llama-3.2-1B-Instruct-QLORA_INT4_EO8
38+
devices:
39+
description: Target devices to run benchmark
40+
required: false
41+
type: string
42+
default: google_pixel_3_private_rooted
43+
benchmark_configs:
44+
description: The list of configs used the benchmark
45+
required: false
46+
type: string
47+
48+
concurrency:
49+
group: android-perf-private-devices-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
50+
cancel-in-progress: true
51+
52+
jobs:
53+
android:
54+
uses: ./.github/workflows/android-perf.yml
55+
secrets: inherit
56+
permissions:
57+
id-token: write
58+
contents: read
59+
with:
60+
models: ${{ inputs.models || 'mv3,meta-llama/Llama-3.2-1B-Instruct-SpinQuant_INT4_EO8,meta-llama/Llama-3.2-1B-Instruct-QLORA_INT4_EO8' }}
61+
devices: google_pixel_3_private_rooted
62+
benchmark_configs: ${{ inputs.benchmark_configs }}

.github/workflows/android-perf.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ jobs:
353353
script: |
354354
set -eux
355355
356+
# Use sccache for NDK compiler as well
357+
export CMAKE_CXX_COMPILER_LAUNCHER=sccache
358+
export CMAKE_C_COMPILER_LAUNCHER=sccache
359+
356360
# The generic Linux job chooses to use base env, not the one setup by the image
357361
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
358362
conda activate "${CONDA_ENV}"
@@ -392,7 +396,7 @@ jobs:
392396
fail-fast: false
393397
with:
394398
# Due to scheduling a job may be pushed beyond the default 60m threshold
395-
timeout: 120
399+
timeout: 240
396400
device-type: android
397401
runner: linux.2xlarge
398402
test-infra-ref: ''

.github/workflows/android-release-artifacts.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
description: Upload the AAR to maven staging repository
1212
required: false
1313
type: boolean
14+
flavor:
15+
type: choice
16+
options:
17+
- "xnnpack"
18+
- "vulkan+xnnpack"
1419
schedule:
1520
- cron: 0 10 * * *
1621

@@ -49,7 +54,8 @@ jobs:
4954
contents: read
5055
with:
5156
secrets-env: EXECUTORCH_MAVEN_SIGNING_KEYID EXECUTORCH_MAVEN_SIGNING_PASSWORD EXECUTORCH_MAVEN_CENTRAL_PASSWORD EXECUTORCH_MAVEN_CENTRAL_USERNAME EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS
52-
runner: linux.2xlarge
57+
# As this job has access to Maven credential, run this on a fresh ephemeral runner
58+
runner: ephemeral.linux.2xlarge
5359
docker-image: executorch-ubuntu-22.04-clang12-android
5460
submodules: 'recursive'
5561
ref: ${{ github.sha }}
@@ -59,6 +65,10 @@ jobs:
5965
script: |
6066
set -eux
6167
68+
# Use sccache for NDK compiler as well
69+
export CMAKE_CXX_COMPILER_LAUNCHER=sccache
70+
export CMAKE_C_COMPILER_LAUNCHER=sccache
71+
6272
# The generic Linux job chooses to use base env, not the one setup by the image
6373
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
6474
conda activate "${CONDA_ENV}"
@@ -75,6 +85,17 @@ jobs:
7585
7686
echo -n "$SECRET_EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS" | base64 -d > /tmp/secring.gpg
7787
88+
# Update the version name in build.gradle in case of maven publish
89+
VERSION="${{ inputs.version }}"
90+
if [ ! -z "$VERSION" ]; then
91+
sed -i "s/\(coordinates(\"org.pytorch\", \"executorch-android\", \"\)\([0-9]\+.[0-9]\+.[0-9]\+\)\(\")\)/\1$VERSION\3/" extension/android/executorch_android/build.gradle
92+
fi
93+
94+
FLAVOR="${{ inputs.flavor }}"
95+
if [[ "$FLAVOR" == "vulkan+xnnpack" ]]; then
96+
export EXECUTORCH_BUILD_VULKAN=ON
97+
fi
98+
7899
# Build AAR Package
79100
mkdir aar-out
80101
export BUILD_AAR_DIR=aar-out
@@ -87,7 +108,7 @@ jobs:
87108
# Publish to maven staging
88109
UPLOAD_TO_MAVEN="${{ inputs.upload_to_maven }}"
89110
if [[ "$UPLOAD_TO_MAVEN" == "true" ]]; then
90-
(cd aar-out; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:publishToMavenCentral)
111+
(cd extension/android; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:publishToMavenCentral)
91112
fi
92113
93114
upload-release-aar:

.github/workflows/doc-build.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ on:
1414
- cron: '0 0 * * *'
1515

1616
jobs:
17+
check-urls:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Check URLs
22+
run: bash ./scripts/check_urls.sh
23+
24+
check-links:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v3
28+
- name: Check Links
29+
run: bash ./scripts/check_links.sh
30+
1731
build:
1832
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
1933
permissions:

CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,12 +761,16 @@ if(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR)
761761
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/flat_tensor)
762762
endif()
763763

764+
if(EXECUTORCH_BUILD_EXTENSION_MODULE)
765+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/module)
766+
endif()
767+
764768
if(EXECUTORCH_BUILD_EXTENSION_LLM)
765769
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/tokenizers)
766770
endif()
767771

768-
if(EXECUTORCH_BUILD_EXTENSION_MODULE)
769-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/module)
772+
if(EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER)
773+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/runner)
770774
endif()
771775

772776
if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL)
@@ -810,6 +814,10 @@ if(EXECUTORCH_BUILD_PYBIND)
810814
torch
811815
)
812816

817+
if(EXECUTORCH_BUILD_TESTS)
818+
list(APPEND _dep_libs test_backend_compiler_lib)
819+
endif()
820+
813821
if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
814822
list(APPEND _dep_libs optimized_native_cpu_ops_lib)
815823
else()

0 commit comments

Comments
 (0)