-
Notifications
You must be signed in to change notification settings - Fork 1k
Qualcomm AI Engine Direct - Verify Direct Build in External CI #19763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #!/bin/bash | ||
| # Copyright (c) Qualcomm Innovation Center, Inc. | ||
| # All rights reserved | ||
| # | ||
| # This source code is licensed under the BSD-style license found in the | ||
| # LICENSE file in the root directory of this source tree. | ||
|
|
||
| set -eux | ||
|
|
||
| source "$(dirname "${BASH_SOURCE[0]}")/../../backends/qualcomm/scripts/install_qnn_sdk.sh" | ||
|
|
||
| setup_android_ndk | ||
| install_qnn | ||
| install_hexagon_sdk | ||
|
|
||
| bash backends/qualcomm/scripts/build.sh \ | ||
| --build_direct_mode 3 --soc_model SM8750 \ | ||
| --skip_x86_64 --skip_linux_android \ | ||
| --release | ||
|
|
||
| ARTIFACT="build-direct/backends/qualcomm/libqnn_executorch_backend.so" | ||
| if [ ! -f "${ARTIFACT}" ]; then | ||
| echo "ERROR: direct-mode build did not produce ${ARTIFACT}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| MAX_SIZE_BYTES=$((200 * 1024)) | ||
| ARTIFACT_SIZE=$(stat -c%s "${ARTIFACT}") | ||
| if [ "${ARTIFACT_SIZE}" -gt "${MAX_SIZE_BYTES}" ]; then | ||
| echo "ERROR: ${ARTIFACT} is ${ARTIFACT_SIZE} bytes, exceeds ${MAX_SIZE_BYTES}-byte (200 KiB) limit" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "PASSED: direct-mode build produced ${ARTIFACT} (${ARTIFACT_SIZE} bytes, under ${MAX_SIZE_BYTES}-byte limit)" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -948,6 +948,25 @@ jobs: | |
| PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh | ||
| PYTHON_EXECUTABLE=python bash .ci/scripts/test_model.sh ${{ matrix.model }} "cmake" "qnn" | ||
|
|
||
| test-qnn-direct-build-linux: | ||
| name: test-qnn-direct-build-linux | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should we gate this job on QNN-related paths (e.g. backends/qualcomm/**, CMakeLists.txt, the build scripts) instead of running it on every PR?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is the intial idea. But the general layer can also introduce changes that does not work with Hexagon toolchain. For this reason, I have set it to run on every PR. |
||
| uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| with: | ||
| runner: linux.2xlarge | ||
| docker-image: ci-image:executorch-ubuntu-22.04-qnn-sdk | ||
| submodules: 'recursive' | ||
| ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | ||
| timeout: 30 | ||
| script: | | ||
| # The generic Linux job chooses to use base env, not the one setup by the image | ||
| CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") | ||
| conda activate "${CONDA_ENV}" | ||
| PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool cmake | ||
| PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-direct-sdk.sh | ||
|
|
||
| test-qnn-testsuite-linux: | ||
| name: test-qnn-testsuite-linux | ||
| permissions: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,11 @@ | |
| # QNN SDK Configuration | ||
| QNN_VERSION="2.37.0.250724" | ||
| QNN_ZIP_URL="https://softwarecenter.qualcomm.com/api/download/software/sdks/Qualcomm_AI_Runtime_Community/All/${QNN_VERSION}/v${QNN_VERSION}.zip" | ||
|
|
||
| # Hexagon SDK Configuration (used only by direct-mode CI build). | ||
| # HEXAGON_TOOLS_VERSION must match the toolchain shipped inside HEXAGON_SDK_VERSION. | ||
| HEXAGON_SDK_VERSION="6.5.0.0" | ||
| HEXAGON_TOOLS_VERSION="19.0.07" | ||
| HEXAGON_SDK_ZIP_URL="https://apigwx-aws.qualcomm.com/qsc/public/v1/api/download/software/sdks/Hexagon_SDK/Linux/Debian/${HEXAGON_SDK_VERSION}/Hexagon_SDK_Linux.zip" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nits: Should we add a SHA-256 check on the downloaded Hexagon SDK zip? as a follow up PR maybe ?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added this check in newest commit. Thanks for the suggestion on safety check. |
||
| # SHA-256 of the downloaded zip. Recompute and update when HEXAGON_SDK_VERSION changes. Command to gen followin sha: sha256sum Hexagon_SDK_Linux.zip | ||
| HEXAGON_SDK_ZIP_SHA256="668626f75c38ce1ca993768953db9bf4b632753c3e32ed8363a8287e3aaffc9a" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add --skip_x86_64 --skip_linux_android to this? iiuc, build.sh still builds the x86 and full Android stacks (those default on), so a job meant to verify just the direct build does a lot of extra work. Not sure..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @psiddh,
I think both are fine. I was doing a full build just to double check that direct_runner for build-android can also be properly build. Since the goal here is to verify .so is built successfully, I have skipped x86 and android in newest change.
Thanks