Skip to content

Commit 92f11a3

Browse files
committed
Update on "[ET-VK] Allow int4 linear to execute without 8bit buffer support"
## Context Some Vulkan devices do not have support for 8-bit buffers, which is currently required to execute the int4 linear compute shader due to the prepacking shader requiring it. This diff bypasses that restriction by introducing a variant of the prepacking shader that does not need 8-bit buffers. ## Changes Introduce a variant of the int4 weight prepacking shader that interprets the tensor data as an array of `uint` instead of `uint8_t`. Each `uint` represents 4 `uint8_t` values. Differential Revision: [D72750897](https://our.internmc.facebook.com/intern/diff/D72750897/) [ghstack-poisoned]
2 parents 33365df + a5de081 commit 92f11a3

File tree

464 files changed

+9901
-4531
lines changed

Some content is hidden

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

464 files changed

+9901
-4531
lines changed

.ci/scripts/build_android_instrumentation.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

.ci/scripts/test_ios_ci.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
set -e
99

10-
APP_PATH="examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo"
10+
APP_PATH="executorch-examples/apple/ExecuTorchDemo/ExecuTorchDemo"
1111
MODEL_NAME="mv3"
1212
SIMULATOR_NAME="executorch"
1313

@@ -34,6 +34,10 @@ say() {
3434
echo -e "\033[1m\n\t** $1 **\n\033[0m"
3535
}
3636

37+
say "Cloning the Demo App"
38+
39+
git clone --depth 1 https://github.com/pytorch-labs/executorch-examples.git
40+
3741
say "Installing CoreML Backend Requirements"
3842

3943
./backends/apple/coreml/scripts/install_requirements.sh

.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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
runner: linux.2xlarge
1616
docker-image: executorch-ubuntu-22.04-clang12-android
17-
submodules: 'true'
17+
submodules: 'recursive'
1818
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
1919
timeout: 90
2020
upload-artifact: android-apps
@@ -36,8 +36,9 @@ jobs:
3636
cp ${BUILD_AAR_DIR}/executorch.aar $ARTIFACTS_DIR_NAME
3737
3838
mkdir -p ${ARTIFACTS_DIR_NAME}/library_test_dir
39-
bash .ci/scripts/build_android_instrumentation.sh
40-
cp ${BUILD_AAR_DIR}/executorch_android/build/outputs/apk/androidTest/debug/executorch_android-debug-androidTest.apk "${ARTIFACTS_DIR_NAME}/library_test_dir"
39+
bash extension/android/executorch_android/android_test_setup.sh
40+
(cd extension/android; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:assembleAndroidTest)
41+
cp extension/android/executorch_android/build/outputs/apk/androidTest/debug/executorch_android-debug-androidTest.apk "${ARTIFACTS_DIR_NAME}/library_test_dir"
4142
4243
mkdir -p ${ARTIFACTS_DIR_NAME}/fp32-xnnpack-custom
4344
bash examples/models/llama/install_requirements.sh
@@ -130,7 +131,8 @@ jobs:
130131
# https://github.com/ReactiveCircus/android-emulator-runner. The max number
131132
# of cores we can set is 6, any higher number will be reduced to 6.
132133
cores: 6
133-
ram-size: 12288M
134+
ram-size: 16384M
135+
heap-size: 12288M
134136
force-avd-creation: false
135137
disable-animations: true
136138
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none

.github/workflows/android-perf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ jobs:
345345
with:
346346
runner: linux.2xlarge
347347
docker-image: executorch-ubuntu-22.04-clang12-android
348-
submodules: 'true'
348+
submodules: 'recursive'
349349
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
350350
timeout: 90
351351
upload-artifact: android-apps

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

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
description: Version name to be uploaded for AAR release
88
required: false
99
type: string
10+
upload_to_maven:
11+
description: Upload the AAR to maven staging repository
12+
required: false
13+
type: boolean
14+
schedule:
15+
- cron: 0 10 * * *
1016

1117
concurrency:
1218
group: ${{ github.workflow }}-${{ github.ref }}
@@ -22,6 +28,10 @@ jobs:
2228
shell: bash
2329
run: |
2430
VERSION="${{ inputs.version }}"
31+
if [ -z "$VERSION" ]; then
32+
echo "No version name specified. Will create a snapshot AAR"
33+
exit 0
34+
fi
2535
if curl -I "https://ossci-android.s3.amazonaws.com/executorch/release/${VERSION}/executorch.aar" | grep "200 OK"; then
2636
echo "AAR already exists at https://ossci-android.s3.amazonaws.com/executorch/release/${VERSION}/executorch.aar"
2737
echo "Will skip build/upload"
@@ -31,14 +41,17 @@ jobs:
3141
build-aar:
3242
name: build-aar
3343
needs: check-if-aar-exists
34-
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
44+
if: ${{ !github.event.pull_request.head.repo.fork }}
45+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.7
46+
secrets: inherit
3547
permissions:
3648
id-token: write
3749
contents: read
3850
with:
51+
secrets-env: EXECUTORCH_MAVEN_SIGNING_KEYID EXECUTORCH_MAVEN_SIGNING_PASSWORD EXECUTORCH_MAVEN_CENTRAL_PASSWORD EXECUTORCH_MAVEN_CENTRAL_USERNAME EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS
3952
runner: linux.2xlarge
4053
docker-image: executorch-ubuntu-22.04-clang12-android
41-
submodules: 'true'
54+
submodules: 'recursive'
4255
ref: ${{ github.sha }}
4356
timeout: 90
4457
upload-artifact: android-apps
@@ -52,6 +65,16 @@ jobs:
5265
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool buck2
5366
export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
5467
68+
mkdir -p ~/.gradle
69+
touch ~/.gradle/gradle.properties
70+
echo "signing.keyId=${SECRET_EXECUTORCH_MAVEN_SIGNING_KEYID}" >> ~/.gradle/gradle.properties
71+
echo "signing.password=${SECRET_EXECUTORCH_MAVEN_SIGNING_PASSWORD}" >> ~/.gradle/gradle.properties
72+
echo "mavenCentralUsername=${SECRET_EXECUTORCH_MAVEN_CENTRAL_USERNAME}" >> ~/.gradle/gradle.properties
73+
echo "mavenCentralPassword=${SECRET_EXECUTORCH_MAVEN_CENTRAL_PASSWORD}" >> ~/.gradle/gradle.properties
74+
echo "signing.secretKeyRingFile=/tmp/secring.gpg" >> ~/.gradle/gradle.properties
75+
76+
echo -n "$SECRET_EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS" | base64 -d > /tmp/secring.gpg
77+
5578
# Build AAR Package
5679
mkdir aar-out
5780
export BUILD_AAR_DIR=aar-out
@@ -61,6 +84,12 @@ jobs:
6184
6285
shasum -a 256 "${ARTIFACTS_DIR_NAME}/executorch.aar"
6386
87+
# Publish to maven staging
88+
UPLOAD_TO_MAVEN="${{ inputs.upload_to_maven }}"
89+
if [[ "$UPLOAD_TO_MAVEN" == "true" ]]; then
90+
(cd aar-out; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:publishToMavenCentral)
91+
fi
92+
6493
upload-release-aar:
6594
name: upload-release-aar
6695
needs: build-aar
@@ -84,6 +113,8 @@ jobs:
84113
pip install awscli==1.32.18
85114
AWS_CMD="aws s3 cp"
86115
VERSION="${{ inputs.version }}"
87-
VERSION_NAME="${VERSION:-temp_snapshot}"
88-
${AWS_CMD} executorch.aar s3://ossci-android/executorch/release/${VERSION_NAME}/executorch.aar --acl public-read
89-
${AWS_CMD} executorch.aar.sha256sums s3://ossci-android/executorch/release/${VERSION_NAME}/executorch.aar.sha256sums --acl public-read
116+
if [ -z "$VERSION" ]; then
117+
VERSION="snapshot-$(date +"%Y%m%d")"
118+
fi
119+
${AWS_CMD} executorch.aar s3://ossci-android/executorch/release/${VERSION}/executorch.aar --acl public-read
120+
${AWS_CMD} executorch.aar.sha256sums s3://ossci-android/executorch/release/${VERSION}/executorch.aar.sha256sums --acl public-read

.mypy.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ ignore_missing_imports = True
8080
[mypy-serializer.*]
8181
ignore_missing_imports = True
8282

83+
[mypy-tosa_tools.*]
84+
ignore_missing_imports = True
85+
8386
[mypy-setuptools.*]
8487
ignore_missing_imports = True
8588

0 commit comments

Comments
 (0)