Skip to content

Add stories ci for qnn #4662

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

Merged
merged 38 commits into from
Aug 13, 2024
Merged

Add stories ci for qnn #4662

merged 38 commits into from
Aug 13, 2024

Conversation

cccclai
Copy link
Contributor

@cccclai cccclai commented Aug 11, 2024

As title, add stories end to end ci for qnn. See the success job in https://github.com/pytorch/executorch/actions/runs/10347877541/job/28638999876

Copy link

pytorch-bot bot commented Aug 11, 2024

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit 5174d8f with merge base 99e1ae1 (image):

NEW FAILURE - The following job has failed:

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

@facebook-github-bot facebook-github-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 Aug 11, 2024
@cccclai cccclai marked this pull request as draft August 11, 2024 20:49
@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@cccclai
Copy link
Contributor Author

cccclai commented Aug 12, 2024

As a note, this pr just test fp, and quantized version need to be added later

@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

COPY --chown=ci-user:ci-user ./qualcomm /opt/qualcomm
# Set up QNN SDK if needed
RUN if [ -n "${QNN_SDK}" ]; then git config --global user.email "ossci@example.com"; git config --global user.name "OSS CI"; fi

Copy link
Contributor

Choose a reason for hiding this comment

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

ARG QNN_SDK
COPY --chown=ci-user:ci-user ./scripts/setup-qnn-deps.sh setup-qnn-deps.sh
# Set up QNN SDK if needed
RUN if [ -n "${QNN_SDK}" ]; then ./setup-qnn-deps.sh; fi

Copy link
Contributor

Choose a reason for hiding this comment

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

ARG QNN_SDK
COPY --chown=ci-user:ci-user ./scripts/setup-qnn-deps.sh setup-qnn-deps.sh
RUN mkdir /opt/qualcomm; chown ci-user:ci-user /opt/qualcomm
RUN if [ -n "${QNN_SDK}" ]; then ./setup-qnn-deps.sh; fi

Copy link
Contributor

Choose a reason for hiding this comment

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

ARG QNN_SDK
COPY --chown=ci-user:ci-user ./scripts/setup-qnn-deps.sh setup-qnn-deps.sh
RUN if [ -n "${QNN_SDK}" ]; then mkdir /opt/qualcomm; chown ci-user:ci-user /opt/qualcomm; ./setup-qnn-deps.sh; fi


install_qnn() {
echo "Start installing qnn."
QNN_INSTALLATION_DIR=/tmp/qnn
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe /opt instead of /tmp ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah will address it in next diff

@@ -37,6 +37,10 @@ case "${IMAGE_NAME}" in
ARM_SDK=yes
CLANG_VERSION=12
;;
executorch-ubuntu-22.04-qnn-sdk)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not adding qnn sdk by extending the executorch-ubuntu-22.04-clang12-android image below? QNN backend would require ndk and cross-compilation, making it a good fit to the android image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not android, it's x86

Copy link
Contributor

@guangy10 guangy10 left a comment

Choose a reason for hiding this comment

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

@cccclai Thanks for adding the QNN deps to the docker image! We'er thinking of doing the same work for benchmarking infra.

Copy link
Contributor

@guangy10 guangy10 left a comment

Choose a reason for hiding this comment

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

I think it's more intuitive to make it part of the existing executorch-ubuntu-22.04-clang12-android docker image, otherwise have to switch to load different dockers to build QNN runtime and android app

@cccclai
Copy link
Contributor Author

cccclai commented Aug 12, 2024

I think it's more intuitive to make it part of the existing executorch-ubuntu-22.04-clang12-android docker image, otherwise have to switch to load different dockers to build QNN runtime and android app

no this is x86, not android

@guangy10
Copy link
Contributor

I think it's more intuitive to make it part of the existing executorch-ubuntu-22.04-clang12-android docker image, otherwise have to switch to load different dockers to build QNN runtime and android app

no this is x86, not android

I see. So this work enables running QNN with the emulator on x86_64, the android build is not covered in this PR correct?

@kirklandsign
Copy link
Contributor

I think it's more intuitive to make it part of the existing executorch-ubuntu-22.04-clang12-android docker image, otherwise have to switch to load different dockers to build QNN runtime and android app

no this is x86, not android

I see. So this work enables running QNN with the emulator on x86_64, the android build is not covered in this PR correct?

That's correct. The reusable part is the docker image with QNN SDK set up.

@guangy10
Copy link
Contributor

guangy10 commented Aug 12, 2024

I think it's more intuitive to make it part of the existing executorch-ubuntu-22.04-clang12-android docker image, otherwise have to switch to load different dockers to build QNN runtime and android app

no this is x86, not android

I see. So this work enables running QNN with the emulator on x86_64, the android build is not covered in this PR correct?

That's correct. The reusable part is the docker image with QNN SDK set up.

Thanks for the clarification. BTW, IIUC that's not reusable because we will have to set up the QNN SDK for the android docker as this is for Linux x86. The wrapper script .ci/scripts/setup-qnn-deps.sh is reusable.

Copy link
Contributor

@guangy10 guangy10 left a comment

Choose a reason for hiding this comment

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

unblocking after clarification

@kirklandsign
Copy link
Contributor

I think it's more intuitive to make it part of the existing executorch-ubuntu-22.04-clang12-android docker image, otherwise have to switch to load different dockers to build QNN runtime and android app

no this is x86, not android

I see. So this work enables running QNN with the emulator on x86_64, the android build is not covered in this PR correct?

That's correct. The reusable part is the docker image with QNN SDK set up.

Thanks for the clarification. BTW, IIUC that's not reusable because we will have to set up the QNN SDK for the android docker as this is for Linux x86.

Oh we want a separate docker like executorch-ubuntu-22.04-android which sets QNN as well, plus other android components? If not other components, we can use executorch-ubuntu-22.04-qnn-sdk. Otherwise .ci/scripts/setup-qnn-deps.sh is reusable.

@guangy10
Copy link
Contributor

I think it's more intuitive to make it part of the existing executorch-ubuntu-22.04-clang12-android docker image, otherwise have to switch to load different dockers to build QNN runtime and android app

no this is x86, not android

I see. So this work enables running QNN with the emulator on x86_64, the android build is not covered in this PR correct?

That's correct. The reusable part is the docker image with QNN SDK set up.

Thanks for the clarification. BTW, IIUC that's not reusable because we will have to set up the QNN SDK for the android docker as this is for Linux x86.

Oh we want a separate docker like executorch-ubuntu-22.04-android which sets QNN as well, plus other android components? If not other components, we can use executorch-ubuntu-22.04-qnn-sdk. Otherwise .ci/scripts/setup-qnn-deps.sh is reusable.

If I understand @cccclai 's comment correctly, executorch-ubuntu-22.04-qnn-sdk is for Linux x86 not for android. If we extend executorch-ubuntu-22.04-qnn-sdk by adding additional android deps to build runners and apps, it's kind of duplicate to executorch-ubuntu-22.04-android. A better option seems to be extending executorch-ubuntu-22.04-android with QNN SDK for benchmarking and leave executorch-ubuntu-22.04-qnn-sdk is for Linux x86 w/ emulator only. @cccclai @kirklandsign what do you guys think?

@kirklandsign
Copy link
Contributor

I think it's more intuitive to make it part of the existing executorch-ubuntu-22.04-clang12-android docker image, otherwise have to switch to load different dockers to build QNN runtime and android app

no this is x86, not android

I see. So this work enables running QNN with the emulator on x86_64, the android build is not covered in this PR correct?

That's correct. The reusable part is the docker image with QNN SDK set up.

Thanks for the clarification. BTW, IIUC that's not reusable because we will have to set up the QNN SDK for the android docker as this is for Linux x86.

Oh we want a separate docker like executorch-ubuntu-22.04-android which sets QNN as well, plus other android components? If not other components, we can use executorch-ubuntu-22.04-qnn-sdk. Otherwise .ci/scripts/setup-qnn-deps.sh is reusable.

If I understand @cccclai 's comment correctly, executorch-ubuntu-22.04-qnn-sdk is for Linux x86 not for android. If we extend executorch-ubuntu-22.04-qnn-sdk by adding additional android deps to build runners and apps, it's kind of duplicate to executorch-ubuntu-22.04-android. A better option seems to be extending executorch-ubuntu-22.04-android with QNN SDK for benchmarking and leave executorch-ubuntu-22.04-qnn-sdk is for Linux x86 w/ emulator only. @cccclai @kirklandsign what do you guys think?

Oh I guess @cccclai means the CI is for linux x86. The docker is pulling in QNN SDK so it can be used for everything which requires QNN SDK (including Android)

@guangy10
Copy link
Contributor

I think it's more intuitive to make it part of the existing executorch-ubuntu-22.04-clang12-android docker image, otherwise have to switch to load different dockers to build QNN runtime and android app

no this is x86, not android

I see. So this work enables running QNN with the emulator on x86_64, the android build is not covered in this PR correct?

That's correct. The reusable part is the docker image with QNN SDK set up.

Thanks for the clarification. BTW, IIUC that's not reusable because we will have to set up the QNN SDK for the android docker as this is for Linux x86.

Oh we want a separate docker like executorch-ubuntu-22.04-android which sets QNN as well, plus other android components? If not other components, we can use executorch-ubuntu-22.04-qnn-sdk. Otherwise .ci/scripts/setup-qnn-deps.sh is reusable.

If I understand @cccclai 's comment correctly, executorch-ubuntu-22.04-qnn-sdk is for Linux x86 not for android. If we extend executorch-ubuntu-22.04-qnn-sdk by adding additional android deps to build runners and apps, it's kind of duplicate to executorch-ubuntu-22.04-android. A better option seems to be extending executorch-ubuntu-22.04-android with QNN SDK for benchmarking and leave executorch-ubuntu-22.04-qnn-sdk is for Linux x86 w/ emulator only. @cccclai @kirklandsign what do you guys think?

Oh I guess @cccclai means the CI is for linux x86. The docker is pulling in QNN SDK so it can be used for everything which requires QNN SDK (including Android)

I understand that part, and @kirklandsign what's your actionable suggestion? Like expending executorch-ubuntu-22.04-qnn-sdk for android benchmarking and delete executorch-ubuntu-22.04-android, or something else?

@kirklandsign
Copy link
Contributor

I think it's more intuitive to make it part of the existing executorch-ubuntu-22.04-clang12-android docker image, otherwise have to switch to load different dockers to build QNN runtime and android app

no this is x86, not android

I see. So this work enables running QNN with the emulator on x86_64, the android build is not covered in this PR correct?

That's correct. The reusable part is the docker image with QNN SDK set up.

Thanks for the clarification. BTW, IIUC that's not reusable because we will have to set up the QNN SDK for the android docker as this is for Linux x86.

Oh we want a separate docker like executorch-ubuntu-22.04-android which sets QNN as well, plus other android components? If not other components, we can use executorch-ubuntu-22.04-qnn-sdk. Otherwise .ci/scripts/setup-qnn-deps.sh is reusable.

If I understand @cccclai 's comment correctly, executorch-ubuntu-22.04-qnn-sdk is for Linux x86 not for android. If we extend executorch-ubuntu-22.04-qnn-sdk by adding additional android deps to build runners and apps, it's kind of duplicate to executorch-ubuntu-22.04-android. A better option seems to be extending executorch-ubuntu-22.04-android with QNN SDK for benchmarking and leave executorch-ubuntu-22.04-qnn-sdk is for Linux x86 w/ emulator only. @cccclai @kirklandsign what do you guys think?

Oh I guess @cccclai means the CI is for linux x86. The docker is pulling in QNN SDK so it can be used for everything which requires QNN SDK (including Android)

I understand that part, and @kirklandsign what's your actionable suggestion? Like expending executorch-ubuntu-22.04-qnn-sdk for android benchmarking and delete executorch-ubuntu-22.04-android, or something else?

I see. I would say we can keep two docker images for now. Just in case -qnn-sdk and -android diverged further next.

A quick patch for -android is in https://github.com/pytorch/executorch/pull/4662/files#diff-e6d9e0419b8aac6f9b7664fe9d2398da07ab195b26f0dce338e13968511daba5R46, add QNN_SDK=yes We get QNN SDK set up for android image for free

@@ -25,9 +25,9 @@ usage() {
[ "$1" = -h ] && usage

BUILD_X86_64="true"
CMAKE_X86_64="cmake-out"
CMAKE_X86_64="build-x86"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chiwwang I rename it to the similar name as before, because the ci job will clean up cmake-out for every run. We can make build.sh takes configurable name as next step and change the default name to cmake-out and cmake-out-android

@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot merged commit e71fa03 into main Aug 13, 2024
70 of 72 checks passed
@cccclai cccclai mentioned this pull request Aug 13, 2024
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.

7 participants