Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/android-release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
options:
- "xnnpack"
- "vulkan+xnnpack"
- "qnn"
schedule:
- cron: 0 10 * * *

Expand Down Expand Up @@ -89,11 +90,22 @@ jobs:
sed -i "s/\(coordinates(\"org.pytorch\", \"executorch-android\", \"\)\([0-9]\+.[0-9]\+.[0-9]\+\)\(\")\)/\1$VERSION\3/" extension/android/executorch_android/build.gradle
fi

GRADLE_ARGS=""

FLAVOR="${{ inputs.flavor }}"
if [[ "$FLAVOR" == "vulkan+xnnpack" || -z "$FLAVOR" ]]; then
export EXECUTORCH_BUILD_VULKAN=ON
fi

if [[ "$FLAVOR" == "qnn" ]]; then
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-qnn-deps.sh
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
export EXECUTORCH_BUILD_QNN=ON
export QNN_SDK_ROOT=/tmp/qnn/2.28.0.241029
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we try to reduce the hardcode version and refer to this https://github.com/pytorch/executorch/blob/main/backends/qualcomm/scripts/qnn_config.sh ? If it needs to refactor a bit that's fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... This is part of docker image anyways..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah I just meant this part /tmp/qnn/2.28.0.241029, the 2.28.0.241029 can be different when we bump the qnn version

export ANDROID_ABIS=arm64-v8a
GRADLE_ARGS+="-DqnnVersion=2.33.0"
fi

# Build AAR Package
mkdir aar-out
export BUILD_AAR_DIR=aar-out
Expand All @@ -106,7 +118,7 @@ jobs:
# Publish to maven staging
UPLOAD_TO_MAVEN="${{ inputs.upload_to_maven }}"
if [[ "$UPLOAD_TO_MAVEN" == "true" ]]; then
(cd extension/android; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:publishToMavenCentral)
(cd extension/android; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew ${GRADLE_ARGS} :executorch_android:publishToMavenCentral)
fi

upload-release-aar:
Expand Down
8 changes: 7 additions & 1 deletion extension/android/executorch_android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
* LICENSE file in the root directory of this source tree.
*/


plugins {
id "com.android.library" version "8.9.0"
id "com.vanniktech.maven.publish" version "0.31.0"
alias(libs.plugins.jetbrains.kotlin.android)
}

def qnnVersion = System.properties['qnnVersion']

android {
namespace = "org.pytorch.executorch"
compileSdk = 34
Expand Down Expand Up @@ -56,13 +59,16 @@ dependencies {
androidTestImplementation 'commons-io:commons-io:2.4'
androidTestImplementation 'org.json:json:20250107'
androidTestImplementation 'org.jetbrains.kotlin:kotlin-test:1.9.23'
if (qnnVersion) {
implementation "com.qualcomm.qti:qnn-runtime:$qnnVersion"
}
}

mavenPublishing {
publishToMavenCentral()
signAllPublications()

coordinates("org.pytorch", "executorch-android", "0.7.0-SNAPSHOT")
coordinates("org.pytorch", "executorch-android" + (qnnVersion ? "-qnn" : ""), "0.7.0-SNAPSHOT")

pom {
name = "ExecuTorch Android"
Expand Down
13 changes: 0 additions & 13 deletions scripts/build_android_library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,6 @@ build_android_native_library() {
mkdir -p ${SO_STAGE_DIR}
cp "${CMAKE_OUT}"/extension/android/*.so "${SO_STAGE_DIR}/libexecutorch.so"

# Copy QNN related so library
if [ -n "$QNN_SDK_ROOT" ] && [ "$ANDROID_ABI" == "arm64-v8a" ]; then
cp "${CMAKE_OUT}"/lib/libqnn_executorch_backend.so ${SO_STAGE_DIR}
cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtp.so ${SO_STAGE_DIR}
cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnSystem.so ${SO_STAGE_DIR}
cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtpV69Stub.so ${SO_STAGE_DIR}
cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtpV73Stub.so ${SO_STAGE_DIR}
cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtpV75Stub.so ${SO_STAGE_DIR}
cp "${QNN_SDK_ROOT}"/lib/hexagon-v69/unsigned/libQnnHtpV69Skel.so ${SO_STAGE_DIR}
cp "${QNN_SDK_ROOT}"/lib/hexagon-v73/unsigned/libQnnHtpV73Skel.so ${SO_STAGE_DIR}
cp "${QNN_SDK_ROOT}"/lib/hexagon-v75/unsigned/libQnnHtpV75Skel.so ${SO_STAGE_DIR}
fi

# Copy MTK related so library
if [ -n "$NEURON_BUFFER_ALLOCATOR_LIB" ] && [ -n "$NEURON_USDK_ADAPTER_LIB" ] && [ "$ANDROID_ABI" == "arm64-v8a" ]; then
cp "${CMAKE_OUT}"/backends/mediatek/libneuron_backend.so ${SO_STAGE_DIR}
Expand Down
Loading