From b98ba523684b19b41b20c65f28e4c9ef5ccd2e58 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 16:11:03 -0700 Subject: [PATCH 01/34] add a docker config --- .ci/docker/build.sh | 4 ++++ .ci/docker/ubuntu/Dockerfile | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.ci/docker/build.sh b/.ci/docker/build.sh index 1c4e2a72f54..c867b740d55 100755 --- a/.ci/docker/build.sh +++ b/.ci/docker/build.sh @@ -26,6 +26,9 @@ case "${IMAGE_NAME}" in executorch-ubuntu-22.04-linter) LINTRUNNER=yes ;; + executorch-ubuntu-22.04-arm-sdk) + ARM_SDK=yes + ;; *) echo "Invalid image name ${IMAGE_NAME}" exit 1 @@ -54,6 +57,7 @@ docker build \ --build-arg "BUCK2_VERSION=${BUCK2_VERSION}" \ --build-arg "LINTRUNNER=${LINTRUNNER}" \ --build-arg "BUILD_DOCS=${BUILD_DOCS}" \ + --build-arg "ARM_SDK=${ARM_SDK:-}" \ -f "${OS}"/Dockerfile \ "$@" \ . diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 6afb6ab7bdc..53392a52265 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -51,5 +51,9 @@ COPY ./requirements-lintrunner.txt requirements-lintrunner.txt RUN if [ -n "${LINTRUNNER}" ]; then bash ./install_linter.sh; fi RUN rm install_linter.sh utils.sh requirements-lintrunner.txt +ARG ARM_SDK +# Set up ARM SDK if needed +RUN if [ -n "${ARM_SDK}" ]; then bash ./examples/arm/setup.sh --i-agree-to-the-contained-eula; fi + USER ci-user CMD ["bash"] From 1c2da64942754afd64e89b849334f98880624259 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 16:14:34 -0700 Subject: [PATCH 02/34] add a workflow to trigger it --- .github/workflows/trunk.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 63625f76ebf..92d4c259c0e 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -131,6 +131,23 @@ jobs: # Test selective build PYTHON_EXECUTABLE=python bash examples/portable/scripts/test_demo_backend_delegation.sh "${BUILD_TOOL}" + test-arm-backend-delegation: + name: test-arm-backend-delegation + uses: pytorch/test-infra/.github/workflows/linux_job.yml@main + with: + runner: linux.2xlarge + docker-image: executorch-ubuntu-22.04-clang12-arm-sdk + submodules: 'true' + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + 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}" + # Test selective build + PYTHON_EXECUTABLE=python bash examples/arm/run.sh + test-coreml-delegate: name: test-coreml-delegate uses: pytorch/test-infra/.github/workflows/macos_job.yml@main From f575b593c9f26b44f25d760571d4243dbfb2fc19 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 20:37:57 -0700 Subject: [PATCH 03/34] comment out --- .ci/docker/ubuntu/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 53392a52265..54bab13e5bc 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -53,7 +53,7 @@ RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK # Set up ARM SDK if needed -RUN if [ -n "${ARM_SDK}" ]; then bash ./examples/arm/setup.sh --i-agree-to-the-contained-eula; fi +# RUN if [ -n "${ARM_SDK}" ]; then bash ./examples/arm/setup.sh --i-agree-to-the-contained-eula; fi USER ci-user CMD ["bash"] From fb5e1da7501bbd0a16d3326b00de428672502f1e Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 20:40:23 -0700 Subject: [PATCH 04/34] need to add to workflow --- .github/workflows/docker-builds.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-builds.yml b/.github/workflows/docker-builds.yml index 814961a5b97..07bf7150ec4 100644 --- a/.github/workflows/docker-builds.yml +++ b/.github/workflows/docker-builds.yml @@ -27,6 +27,7 @@ jobs: include: - docker-image-name: executorch-ubuntu-22.04-clang12 - docker-image-name: executorch-ubuntu-22.04-linter + - docker-image-name: executorch-ubuntu-22.04-arm-sdk env: DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/executorch/${{ matrix.docker-image-name }} steps: From 6e5c1eb7f43a5dc5b539b6f5ec19665dbcd4022c Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 20:42:19 -0700 Subject: [PATCH 05/34] fix lintrunner --- .ci/docker/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/build.sh b/.ci/docker/build.sh index c867b740d55..d01ce654d70 100755 --- a/.ci/docker/build.sh +++ b/.ci/docker/build.sh @@ -55,7 +55,7 @@ docker build \ --build-arg "TORCHAUDIO_VERSION=${TORCHAUDIO_VERSION}.${NIGHTLY}" \ --build-arg "TORCHVISION_VERSION=${TORCHVISION_VERSION}.${NIGHTLY}" \ --build-arg "BUCK2_VERSION=${BUCK2_VERSION}" \ - --build-arg "LINTRUNNER=${LINTRUNNER}" \ + --build-arg "LINTRUNNER=${LINTRUNNER:-}" \ --build-arg "BUILD_DOCS=${BUILD_DOCS}" \ --build-arg "ARM_SDK=${ARM_SDK:-}" \ -f "${OS}"/Dockerfile \ From 1f0bc6c0b2a64beba50fa6021ab42b80a7ff0d3a Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 21:05:24 -0700 Subject: [PATCH 06/34] dockerfile --- .ci/docker/build.sh | 3 +++ .ci/docker/ubuntu/Dockerfile | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.ci/docker/build.sh b/.ci/docker/build.sh index d01ce654d70..34970aa4d2d 100755 --- a/.ci/docker/build.sh +++ b/.ci/docker/build.sh @@ -44,6 +44,9 @@ BUILD_DOCS=1 # Copy requirements-lintrunner.txt from root to here cp ../../requirements-lintrunner.txt ./ +# Copy arm setup script from root to here +cp ../../examples/arm/setup.sh ./arm-setup.sh + docker build \ --no-cache \ --progress=plain \ diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 54bab13e5bc..ef707e83a8a 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -52,8 +52,9 @@ RUN if [ -n "${LINTRUNNER}" ]; then bash ./install_linter.sh; fi RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK +COPY ./arm-setup.sh arm-setup.txt # Set up ARM SDK if needed -# RUN if [ -n "${ARM_SDK}" ]; then bash ./examples/arm/setup.sh --i-agree-to-the-contained-eula; fi +RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula; fi USER ci-user CMD ["bash"] From 0259e6436dc3223b7e603d4461613924ba44d794 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 21:19:19 -0700 Subject: [PATCH 07/34] sh --- .ci/docker/ubuntu/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index ef707e83a8a..ae2faa253f7 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -52,7 +52,7 @@ RUN if [ -n "${LINTRUNNER}" ]; then bash ./install_linter.sh; fi RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK -COPY ./arm-setup.sh arm-setup.txt +COPY ./arm-setup.sh arm-setup.sh # Set up ARM SDK if needed RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula; fi From 37e574eb64038e6df81e567f3acc35b9ec78724d Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 22:10:04 -0700 Subject: [PATCH 08/34] set up sdk --- .ci/docker/ubuntu/Dockerfile | 2 +- .github/workflows/trunk.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index ae2faa253f7..14d6cc17267 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -54,7 +54,7 @@ RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK COPY ./arm-setup.sh arm-setup.sh # Set up ARM SDK if needed -RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula; fi +RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula /arm-sdk; fi USER ci-user CMD ["bash"] diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 92d4c259c0e..efaae5ca4ac 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -146,6 +146,7 @@ jobs: PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}" # Test selective build + source /arm-sdk/setup_path.sh PYTHON_EXECUTABLE=python bash examples/arm/run.sh test-coreml-delegate: From c78399cc8fd0e5ed1cc5c64f836b6eab38003222 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 22:11:04 -0700 Subject: [PATCH 09/34] temp run --- .ci/docker/build.sh | 1 + .github/workflows/trunk.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/docker/build.sh b/.ci/docker/build.sh index 34970aa4d2d..2c71b90f0af 100755 --- a/.ci/docker/build.sh +++ b/.ci/docker/build.sh @@ -21,6 +21,7 @@ BUCK2_VERSION=$(cat ci_commit_pins/buck2.txt) case "${IMAGE_NAME}" in executorch-ubuntu-22.04-clang12) + ARM_SDK=yes LINTRUNNER="" ;; executorch-ubuntu-22.04-linter) diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index efaae5ca4ac..a71060cfb51 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -136,7 +136,7 @@ jobs: uses: pytorch/test-infra/.github/workflows/linux_job.yml@main with: runner: linux.2xlarge - docker-image: executorch-ubuntu-22.04-clang12-arm-sdk + docker-image: executorch-ubuntu-22.04-clang12 submodules: 'true' ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} script: | From 5572a94931c5d5f75d3d500b6c5b3aab52c89b7d Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 22:36:53 -0700 Subject: [PATCH 10/34] trigger pull --- .github/workflows/pull.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index b42220fecf2..d387c93aa7a 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -110,3 +110,21 @@ jobs: uses: ./.github/workflows/_unittest.yml with: docker-image: executorch-ubuntu-22.04-clang12 + + test-arm-backend-delegation: + name: test-arm-backend-delegation + uses: pytorch/test-infra/.github/workflows/linux_job.yml@main + with: + runner: linux.2xlarge + docker-image: executorch-ubuntu-22.04-clang12 + submodules: 'true' + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + 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}" + # Test selective build + source /arm-sdk/setup_path.sh + PYTHON_EXECUTABLE=python bash examples/arm/run.sh From f663e7bfeef371e1349380d9ae12328cd17c795e Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 22:47:34 -0700 Subject: [PATCH 11/34] build tool --- .github/workflows/pull.yml | 2 +- .github/workflows/trunk.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index d387c93aa7a..d2697022da0 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -124,7 +124,7 @@ jobs: 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}" + PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake # Test selective build source /arm-sdk/setup_path.sh PYTHON_EXECUTABLE=python bash examples/arm/run.sh diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index a71060cfb51..0ee47d79002 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -144,7 +144,7 @@ jobs: 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}" + PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake # Test selective build source /arm-sdk/setup_path.sh PYTHON_EXECUTABLE=python bash examples/arm/run.sh From a5b8db4b9223831828c7eaea04c73f293c7f8cfc Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 22:59:06 -0700 Subject: [PATCH 12/34] fix sdk path --- .github/workflows/pull.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index d2697022da0..1e90f8667a3 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -127,4 +127,4 @@ jobs: PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake # Test selective build source /arm-sdk/setup_path.sh - PYTHON_EXECUTABLE=python bash examples/arm/run.sh + PYTHON_EXECUTABLE=python bash examples/arm/run.sh /arm-sdk From 3b9da889e84d5b9220137f1afa41616c848b52a2 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 23:10:11 -0700 Subject: [PATCH 13/34] fix buck2 --- .github/workflows/pull.yml | 2 +- .github/workflows/trunk.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 1e90f8667a3..a260997bd9a 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -127,4 +127,4 @@ jobs: PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake # Test selective build source /arm-sdk/setup_path.sh - PYTHON_EXECUTABLE=python bash examples/arm/run.sh /arm-sdk + PYTHON_EXECUTABLE=python bash examples/arm/run.sh /arm-sdk buck2 diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 0ee47d79002..f735aa17cab 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -144,7 +144,7 @@ jobs: CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") conda activate "${CONDA_ENV}" - PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake + PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake buck2 # Test selective build source /arm-sdk/setup_path.sh PYTHON_EXECUTABLE=python bash examples/arm/run.sh From 9657c5a05986cae262efd3eafdbe63e807876c77 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 23:35:17 -0700 Subject: [PATCH 14/34] fix path --- .ci/docker/ubuntu/Dockerfile | 2 +- .github/workflows/pull.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 14d6cc17267..9bafe8ce7e3 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -54,7 +54,7 @@ RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK COPY ./arm-setup.sh arm-setup.sh # Set up ARM SDK if needed -RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula /arm-sdk; fi +RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula /pytorch/executorch/arm-sdk; fi USER ci-user CMD ["bash"] diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index a260997bd9a..774b6a35f90 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -126,5 +126,5 @@ jobs: PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake # Test selective build - source /arm-sdk/setup_path.sh - PYTHON_EXECUTABLE=python bash examples/arm/run.sh /arm-sdk buck2 + source ./arm-sdk/setup_path.sh + PYTHON_EXECUTABLE=python bash examples/arm/run.sh ./arm-sdk buck2 From 10038e9723a5e5d006dd38be958f975e816313c9 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 30 Oct 2023 23:53:10 -0700 Subject: [PATCH 15/34] fix path --- .ci/docker/ubuntu/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 9bafe8ce7e3..3535687ec49 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -54,6 +54,7 @@ RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK COPY ./arm-setup.sh arm-setup.sh # Set up ARM SDK if needed +RUN mkdir -p /pytorch/executorch/arm-sdk; chown ci-user /pytorch/executorch/arm-sdk RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula /pytorch/executorch/arm-sdk; fi USER ci-user From 6a6478d15a4f031348988aa999df9e412c7de744 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 00:10:05 -0700 Subject: [PATCH 16/34] fix path --- .github/workflows/pull.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 774b6a35f90..0a1dd9f65e4 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -126,5 +126,5 @@ jobs: PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake # Test selective build - source ./arm-sdk/setup_path.sh - PYTHON_EXECUTABLE=python bash examples/arm/run.sh ./arm-sdk buck2 + source /pytorch/executorch/arm-sdk/setup_path.sh + PYTHON_EXECUTABLE=python bash examples/arm/run.sh /pytorch/executorch/arm-sdk buck2 From 77cc058c4915d67b59ed7dc2592af1db1c9d4ffb Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 09:14:29 -0700 Subject: [PATCH 17/34] path --- .ci/docker/ubuntu/Dockerfile | 5 ++--- .github/workflows/pull.yml | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 3535687ec49..e2b29fa18cb 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -52,10 +52,9 @@ RUN if [ -n "${LINTRUNNER}" ]; then bash ./install_linter.sh; fi RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK -COPY ./arm-setup.sh arm-setup.sh +COPY ./arm-setup.sh /opt/arm-setup.sh # Set up ARM SDK if needed -RUN mkdir -p /pytorch/executorch/arm-sdk; chown ci-user /pytorch/executorch/arm-sdk -RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula /pytorch/executorch/arm-sdk; fi +RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown ci-user /opt/arm-sdk fi USER ci-user CMD ["bash"] diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 0a1dd9f65e4..36acd3637cb 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -126,5 +126,5 @@ jobs: PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake # Test selective build - source /pytorch/executorch/arm-sdk/setup_path.sh - PYTHON_EXECUTABLE=python bash examples/arm/run.sh /pytorch/executorch/arm-sdk buck2 + source /opt/arm-sdk/setup_path.sh + PYTHON_EXECUTABLE=python bash examples/arm/run.sh /opt/arm-sdk buck2 From 404481ae8462594945a0c1ca98acd2f650c4704d Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 09:26:51 -0700 Subject: [PATCH 18/34] fix --- .ci/docker/ubuntu/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index e2b29fa18cb..2ab125fe3ca 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -54,7 +54,7 @@ RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK COPY ./arm-setup.sh /opt/arm-setup.sh # Set up ARM SDK if needed -RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown ci-user /opt/arm-sdk fi +RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown ci-user /opt/arm-sdk; fi USER ci-user CMD ["bash"] From 678ac636b263bd017f5f5359f76a62c2f461cd56 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 09:41:18 -0700 Subject: [PATCH 19/34] sh path --- .ci/docker/ubuntu/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 2ab125fe3ca..44d818c792c 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -54,7 +54,7 @@ RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK COPY ./arm-setup.sh /opt/arm-setup.sh # Set up ARM SDK if needed -RUN if [ -n "${ARM_SDK}" ]; then bash arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown ci-user /opt/arm-sdk; fi +RUN if [ -n "${ARM_SDK}" ]; then bash /opt/arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown ci-user /opt/arm-sdk; fi USER ci-user CMD ["bash"] From 010f4c7bebc3c8e664f09d2fda1ff4c281ee3129 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 10:51:58 -0700 Subject: [PATCH 20/34] mkdir -p --- examples/arm/run.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/arm/run.sh b/examples/arm/run.sh index 44ba9ba0fab..566e120edcf 100755 --- a/examples/arm/run.sh +++ b/examples/arm/run.sh @@ -88,6 +88,7 @@ function build_executorch_runner() { [[ $# -ne 1 ]] && { echo "[${FUNCNAME[0]}]" "Expecting a single pte file as argument got, $*"; exit 1; } local pte=${1} cd "${ethos_u_root_dir}"/core_platform + mkdir -p build cmake \ -DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} \ -B build targets/corstone-300 \ From 52951462f475297d9b85b5a629078c578e7741ea Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 11:08:46 -0700 Subject: [PATCH 21/34] chown fix --- .ci/docker/ubuntu/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 44d818c792c..7650ebf602a 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -54,7 +54,7 @@ RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK COPY ./arm-setup.sh /opt/arm-setup.sh # Set up ARM SDK if needed -RUN if [ -n "${ARM_SDK}" ]; then bash /opt/arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown ci-user /opt/arm-sdk; fi +RUN if [ -n "${ARM_SDK}" ]; then bash /opt/arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user /opt/arm-sdk; fi USER ci-user CMD ["bash"] From 7ef54d52dfd0f9544cf4849db53713019bc84088 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 11:48:15 -0700 Subject: [PATCH 22/34] chown fix --- .ci/docker/ubuntu/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 7650ebf602a..a51a9147fa4 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -54,7 +54,7 @@ RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK COPY ./arm-setup.sh /opt/arm-setup.sh # Set up ARM SDK if needed -RUN if [ -n "${ARM_SDK}" ]; then bash /opt/arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user /opt/arm-sdk; fi +RUN if [ -n "${ARM_SDK}" ]; then bash /opt/arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user:ci-user /opt/arm-sdk; fi USER ci-user CMD ["bash"] From 181fa123d7bf3a7faab71fb64df6f7d7cca71c4b Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 12:07:34 -0700 Subject: [PATCH 23/34] run as user --- .ci/docker/ubuntu/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index a51a9147fa4..458ae0ddfe7 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -53,8 +53,9 @@ RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK COPY ./arm-setup.sh /opt/arm-setup.sh +RUN mkdir /opt/arm-sdk; chown ci-user:ci-user /opt/arm-sdk # Set up ARM SDK if needed -RUN if [ -n "${ARM_SDK}" ]; then bash /opt/arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user:ci-user /opt/arm-sdk; fi +RUN if [ -n "${ARM_SDK}" ]; then su - ci-user -c "bash /opt/arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk"; fi USER ci-user CMD ["bash"] From 5fc0f1598fa9e09c2774f83884e1bd0797017661 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 12:22:50 -0700 Subject: [PATCH 24/34] Revert "run as user" This reverts commit 181fa123d7bf3a7faab71fb64df6f7d7cca71c4b. --- .ci/docker/ubuntu/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 458ae0ddfe7..a51a9147fa4 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -53,9 +53,8 @@ RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK COPY ./arm-setup.sh /opt/arm-setup.sh -RUN mkdir /opt/arm-sdk; chown ci-user:ci-user /opt/arm-sdk # Set up ARM SDK if needed -RUN if [ -n "${ARM_SDK}" ]; then su - ci-user -c "bash /opt/arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk"; fi +RUN if [ -n "${ARM_SDK}" ]; then bash /opt/arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user:ci-user /opt/arm-sdk; fi USER ci-user CMD ["bash"] From 1d2e72472af55461adcf0d54c2dfb6fd845acbfe Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 12:39:09 -0700 Subject: [PATCH 25/34] copy stuff --- .ci/docker/build.sh | 2 +- .ci/docker/ubuntu/Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/docker/build.sh b/.ci/docker/build.sh index 2c71b90f0af..8b7e1ecac7e 100755 --- a/.ci/docker/build.sh +++ b/.ci/docker/build.sh @@ -46,7 +46,7 @@ BUILD_DOCS=1 cp ../../requirements-lintrunner.txt ./ # Copy arm setup script from root to here -cp ../../examples/arm/setup.sh ./arm-setup.sh +cp -r ../../examples/arm/./arm docker build \ --no-cache \ diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index a51a9147fa4..83d632ab754 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -52,9 +52,9 @@ RUN if [ -n "${LINTRUNNER}" ]; then bash ./install_linter.sh; fi RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK -COPY ./arm-setup.sh /opt/arm-setup.sh +COPY ./arm /opt/arm # Set up ARM SDK if needed -RUN if [ -n "${ARM_SDK}" ]; then bash /opt/arm-setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user:ci-user /opt/arm-sdk; fi +RUN if [ -n "${ARM_SDK}" ]; then bash /opt/arm/setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user:ci-user /opt/arm-sdk; fi USER ci-user CMD ["bash"] From 5e43b9996102d3abc4d1bb54e5eb4f72a9f14162 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 12:41:39 -0700 Subject: [PATCH 26/34] copy stuff --- .ci/docker/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/build.sh b/.ci/docker/build.sh index 8b7e1ecac7e..9225841849c 100755 --- a/.ci/docker/build.sh +++ b/.ci/docker/build.sh @@ -46,7 +46,7 @@ BUILD_DOCS=1 cp ../../requirements-lintrunner.txt ./ # Copy arm setup script from root to here -cp -r ../../examples/arm/./arm +cp -r ../../examples/arm/ ./arm docker build \ --no-cache \ From c1e4233fa899f61eb3708ecb233dc3c98069fd4d Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 13:25:44 -0700 Subject: [PATCH 27/34] print dir --- examples/arm/setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/arm/setup.sh b/examples/arm/setup.sh index 72cf5adc961..dd15e3bd1df 100755 --- a/examples/arm/setup.sh +++ b/examples/arm/setup.sh @@ -155,6 +155,7 @@ function patch_repo() { git reset --hard ${base_rev} patch_dir=${script_dir}/ethos-u-setup/${name}/patches/ + ls -al ${patch_dir}/*.patch [[ -e ${patch_dir} && $(ls -A ${patch_dir}) ]] && \ git am -3 ${patch_dir}/*.patch From ab6e335b59333c99168924d9691a9bbef921de01 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 13:26:38 -0700 Subject: [PATCH 28/34] refresh --- .ci/docker/ubuntu/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 83d632ab754..73aca3d7cac 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -52,7 +52,7 @@ RUN if [ -n "${LINTRUNNER}" ]; then bash ./install_linter.sh; fi RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK -COPY ./arm /opt/arm +COPY --chown=ci-user:ci-user ./arm /opt/arm # Set up ARM SDK if needed RUN if [ -n "${ARM_SDK}" ]; then bash /opt/arm/setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user:ci-user /opt/arm-sdk; fi From 1388e366a20607c4a818b4085622c3149c3549ee Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 13:45:11 -0700 Subject: [PATCH 29/34] setup git --- .ci/docker/ubuntu/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/ubuntu/Dockerfile b/.ci/docker/ubuntu/Dockerfile index 73aca3d7cac..cd9a0a1f372 100644 --- a/.ci/docker/ubuntu/Dockerfile +++ b/.ci/docker/ubuntu/Dockerfile @@ -54,7 +54,7 @@ RUN rm install_linter.sh utils.sh requirements-lintrunner.txt ARG ARM_SDK COPY --chown=ci-user:ci-user ./arm /opt/arm # Set up ARM SDK if needed -RUN if [ -n "${ARM_SDK}" ]; then bash /opt/arm/setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user:ci-user /opt/arm-sdk; fi +RUN if [ -n "${ARM_SDK}" ]; then git config --global user.email "you@example.com"; git config --global user.name "OSS CI"; bash /opt/arm/setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user:ci-user /opt/arm-sdk; fi USER ci-user CMD ["bash"] From 170eb22701ac07385a3b7fe4b0b45b1e8fe2693d Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 14:20:36 -0700 Subject: [PATCH 30/34] remove arm --- examples/arm/run.sh | 1 - examples/arm/setup.sh | 1 - 2 files changed, 2 deletions(-) diff --git a/examples/arm/run.sh b/examples/arm/run.sh index 566e120edcf..44ba9ba0fab 100755 --- a/examples/arm/run.sh +++ b/examples/arm/run.sh @@ -88,7 +88,6 @@ function build_executorch_runner() { [[ $# -ne 1 ]] && { echo "[${FUNCNAME[0]}]" "Expecting a single pte file as argument got, $*"; exit 1; } local pte=${1} cd "${ethos_u_root_dir}"/core_platform - mkdir -p build cmake \ -DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} \ -B build targets/corstone-300 \ diff --git a/examples/arm/setup.sh b/examples/arm/setup.sh index dd15e3bd1df..72cf5adc961 100755 --- a/examples/arm/setup.sh +++ b/examples/arm/setup.sh @@ -155,7 +155,6 @@ function patch_repo() { git reset --hard ${base_rev} patch_dir=${script_dir}/ethos-u-setup/${name}/patches/ - ls -al ${patch_dir}/*.patch [[ -e ${patch_dir} && $(ls -A ${patch_dir}) ]] && \ git am -3 ${patch_dir}/*.patch From e4c9e77be4d895ef9b6ec9616f0d4b268f510573 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 14:31:07 -0700 Subject: [PATCH 31/34] CI caught an issue --- backends/arm/arm_backend.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/backends/arm/arm_backend.py b/backends/arm/arm_backend.py index 2a4fca05e6f..fc2fe45c1a5 100644 --- a/backends/arm/arm_backend.py +++ b/backends/arm/arm_backend.py @@ -196,9 +196,7 @@ def vela_compile(tosa_fb): # Add a block for scratch, inputs and outputs; scratch shape is a 1 element # array giving us size in bytes so extract this and add a block of 0's. # Currently we preallocated this on the host to provide SRAM for computation. - if len(data["scratch_shape"][0]) != 1: - raise RuntimeError("Expected scratch to be single array") - block_length = data["scratch_shape"][0].item() + block_length = int(data["scratch_shape"][0]) bin_blocks["scratch_data"] = b"\x00" * block_length # Capture inputs and outputs From 65e04245e0ff5a654ebef3b72933c344752aa1f5 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 14:53:17 -0700 Subject: [PATCH 32/34] clean up --- .ci/docker/build.sh | 1 - .github/workflows/pull.yml | 18 ------------------ .github/workflows/trunk.yml | 6 +++--- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/.ci/docker/build.sh b/.ci/docker/build.sh index 9225841849c..48d95f8b450 100755 --- a/.ci/docker/build.sh +++ b/.ci/docker/build.sh @@ -21,7 +21,6 @@ BUCK2_VERSION=$(cat ci_commit_pins/buck2.txt) case "${IMAGE_NAME}" in executorch-ubuntu-22.04-clang12) - ARM_SDK=yes LINTRUNNER="" ;; executorch-ubuntu-22.04-linter) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 36acd3637cb..b42220fecf2 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -110,21 +110,3 @@ jobs: uses: ./.github/workflows/_unittest.yml with: docker-image: executorch-ubuntu-22.04-clang12 - - test-arm-backend-delegation: - name: test-arm-backend-delegation - uses: pytorch/test-infra/.github/workflows/linux_job.yml@main - with: - runner: linux.2xlarge - docker-image: executorch-ubuntu-22.04-clang12 - submodules: 'true' - ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} - 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 cmake - # Test selective build - source /opt/arm-sdk/setup_path.sh - PYTHON_EXECUTABLE=python bash examples/arm/run.sh /opt/arm-sdk buck2 diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index f735aa17cab..ff352f11e95 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -136,7 +136,7 @@ jobs: uses: pytorch/test-infra/.github/workflows/linux_job.yml@main with: runner: linux.2xlarge - docker-image: executorch-ubuntu-22.04-clang12 + docker-image: executorch-ubuntu-22.04-clang12-arm-sdk submodules: 'true' ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} script: | @@ -144,10 +144,10 @@ jobs: CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") conda activate "${CONDA_ENV}" - PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake buck2 + PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake # Test selective build source /arm-sdk/setup_path.sh - PYTHON_EXECUTABLE=python bash examples/arm/run.sh + PYTHON_EXECUTABLE=python bash examples/arm/run.sh /opt/arm-sdk buck2 test-coreml-delegate: name: test-coreml-delegate From e1aab582ed3d3507f6e4c31dcdfb45878c0e1985 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 16:41:37 -0700 Subject: [PATCH 33/34] update docker image name --- .github/workflows/trunk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index ff352f11e95..98bbabc31c8 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -136,7 +136,7 @@ jobs: uses: pytorch/test-infra/.github/workflows/linux_job.yml@main with: runner: linux.2xlarge - docker-image: executorch-ubuntu-22.04-clang12-arm-sdk + docker-image: executorch-ubuntu-22.04-arm-sdk submodules: 'true' ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} script: | From cf472707f28aaa94f336de337d16c7b81de61b7b Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 16:56:27 -0700 Subject: [PATCH 34/34] update path --- .github/workflows/trunk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 98bbabc31c8..047c59525a6 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -146,7 +146,7 @@ jobs: PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake # Test selective build - source /arm-sdk/setup_path.sh + source /opt/arm-sdk/setup_path.sh PYTHON_EXECUTABLE=python bash examples/arm/run.sh /opt/arm-sdk buck2 test-coreml-delegate: