Skip to content

Qualcomm AI Engine Direct - Verify Direct Build in External CI#19763

Merged
psiddh merged 2 commits into
pytorch:mainfrom
CodeLinaro:dev1/winskuo/hexagon_build_external_ci
Jun 10, 2026
Merged

Qualcomm AI Engine Direct - Verify Direct Build in External CI#19763
psiddh merged 2 commits into
pytorch:mainfrom
CodeLinaro:dev1/winskuo/hexagon_build_external_ci

Conversation

@winskuo-quic

@winskuo-quic winskuo-quic commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

QNN Backend supports direct build, which is to build library with hexagon tool chain. Since it is using its own tool chain, some of the C/C++ files or functions are not accessible. For example, in this PR, extension/data_loader/mman.h uses some MACRO that is not no Hexagon toolchain. Due to this reason, mainline often breaks direct-build when someone included functions that's not supported by Hexagon tool chain. To prevent this to happen, this PR added:

  1. direct-build to CI test to ensure changes doesn't break direct build
  2. Ensure the direct build artifact size is smaller than 200kb

Test plan

Passing test-qnn-direct-build-linux under pull.yml

@pytorch-bot

pytorch-bot Bot commented May 26, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19763

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 Cancelled Job, 4 Unrelated Failures, 2 Unclassified Failures

As of commit c978d61 with merge base 2b9e9bf (image):

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

CANCELLED JOB - The following job was cancelled. Please retry:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 26, 2026
@linux-foundation-easycla

linux-foundation-easycla Bot commented May 26, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/hexagon_build_external_ci branch 5 times, most recently from 189c612 to 6453fd2 Compare June 4, 2026 07:42
@winskuo-quic winskuo-quic marked this pull request as ready for review June 8, 2026 02:29
@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/hexagon_build_external_ci branch from 3c69416 to b7c8e68 Compare June 8, 2026 02:29
install_qnn
install_hexagon_sdk

bash backends/qualcomm/scripts/build.sh \

Copy link
Copy Markdown
Contributor

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..

Copy link
Copy Markdown
Collaborator Author

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

# 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"

@psiddh psiddh Jun 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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 ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The 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.

PYTHON_EXECUTABLE=python bash .ci/scripts/test_model.sh ${{ matrix.model }} "cmake" "qnn"

test-qnn-direct-build-linux:
name: test-qnn-direct-build-linux

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The 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.

@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/hexagon_build_external_ci branch from 72900be to 16140f5 Compare June 10, 2026 07:09
@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/hexagon_build_external_ci branch from 16140f5 to c978d61 Compare June 10, 2026 07:34
@psiddh psiddh merged commit 10bc51e into pytorch:main Jun 10, 2026
323 of 330 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants