Skip to content

Commit c72057f

Browse files
committed
Merge branch 'main' of https://github.com/pytorch/executorch into change-1078286
2 parents c50a55f + 3485495 commit c72057f

File tree

116 files changed

+1418
-529
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1418
-529
lines changed

.ci/scripts/build-qnn-sdk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ build_qnn_backend() {
1818
export EXECUTORCH_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
1919

2020
parallelism=$(( $(nproc) - 1 ))
21-
bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number ${parallelism} --release
21+
bash backends/qualcomm/scripts/build.sh --skip_linux_android --skip_linux_embedded --job_number ${parallelism} --release
2222
}
2323

2424
set_up_aot() {

.ci/scripts/test_qnn_static_llama.sh

Lines changed: 0 additions & 69 deletions
This file was deleted.

.ci/scripts/test_qnn_static_llm.sh

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/bin/bash
2+
# Copyright (c) Qualcomm Innovation Center, Inc.
3+
# All rights reserved
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
set -euxo pipefail
9+
10+
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
11+
12+
TASK_NAME=$1
13+
if [[ -z "${TASK_NAME:-}" ]]; then
14+
echo "Missing task name, exiting..."
15+
exit 1
16+
fi
17+
18+
19+
# Download QNN_SDK. If already downloaded, export environment path
20+
source "$(dirname "${BASH_SOURCE[0]}")/../../backends/qualcomm/scripts/install_qnn_sdk.sh"
21+
install_qnn
22+
23+
export EXECUTORCH_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
24+
export LD_LIBRARY_PATH="${QNN_SDK_ROOT}/lib/x86_64-linux-clang"
25+
export PYTHONPATH=".."
26+
cp schema/program.fbs exir/_serialize/program.fbs
27+
cp schema/scalar_type.fbs exir/_serialize/scalar_type.fbs
28+
cp -f build-x86/backends/qualcomm/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python
29+
cp -f build-x86/backends/qualcomm/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python
30+
31+
if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
32+
PYTHON_EXECUTABLE=python3
33+
fi
34+
35+
which "${PYTHON_EXECUTABLE}"
36+
37+
# Although static llama CI does not require graphviz, it is required by test_qnn_delegate.py
38+
pip install graphviz
39+
40+
set +e
41+
42+
echo "Executing task: $TASK_NAME"
43+
if [[ "${TASK_NAME}" == "stories_110m" ]]; then
44+
# Download stories llama110m artifacts
45+
download_stories_model_artifacts
46+
echo "Creating tokenizer.bin"
47+
$PYTHON_EXECUTABLE -m pytorch_tokenizers.tools.llama2c.convert -t tokenizer.model -o tokenizer.bin
48+
49+
# Compile only as weight sharing is not applicable on x86.
50+
$PYTHON_EXECUTABLE backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleLLMScript.test_llama_stories_110m --model SM8650 --build_folder build-android/ --executorch_root . --artifact_dir ./stories_110m_pte_size --llama_artifacts . --compile_only
51+
exit_code1=$?
52+
53+
# Checks accuracy with weight sharing disabled since x86 does not support weight sharing.
54+
$PYTHON_EXECUTABLE backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleLLMScript.test_llama_stories_110m --model SM8650 --build_folder build-x86/ --executorch_root . --artifact_dir ./stories_110m_accuracy --llama_artifacts . --enable_x86_64
55+
exit_code2=$?
56+
57+
# Check the exit codes and print messages
58+
if [ $exit_code1 -ne 0 ]; then
59+
echo "Static Llama compile only with weight sharing test failed. $exit_code1."
60+
fi
61+
62+
if [ $exit_code2 -ne 0 ]; then
63+
echo "Static Llama accuracy test failed. $exit_code2."
64+
fi
65+
66+
if [ $exit_code1 -ne 0 ] || [ $exit_code2 -ne 0 ]; then
67+
exit 1
68+
else
69+
exit 0
70+
fi
71+
72+
elif [[ "${TASK_NAME}" == "stories_260k_bc" ]]; then
73+
74+
# Check BC
75+
bash backends/qualcomm/bc/test_qnn_static_llama_bc.sh
76+
exit_code1=$?
77+
if [ $exit_code1 -ne 0 ]; then
78+
exit 1
79+
else
80+
exit 0
81+
fi
82+
83+
elif [[ "${TASK_NAME}" == "smollm2_135m" ]]; then
84+
$PYTHON_EXECUTABLE backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleLLMScript.test_static_smollm2 --model SM8650 --build_folder build-x86/ --executorch_root . --artifact_dir ./static_smollm2 --enable_x86_64
85+
exit_code1=$?
86+
if [ $exit_code1 -ne 0 ]; then
87+
exit 1
88+
else
89+
exit 0
90+
fi
91+
else
92+
echo "Unsupported task: $TASK_NAME"
93+
exit 1
94+
fi

.github/workflows/_unittest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
id-token: write
3333
contents: read
3434
with:
35-
runner: linux.2xlarge
35+
runner: linux.2xlarge.memory
3636
docker-image: ${{ inputs.docker-image }}
3737
submodules: 'recursive'
3838
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

.github/workflows/cuda.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ jobs:
128128
echo "::endgroup::"
129129
130130
echo "::group::Setup Huggingface"
131-
pip install -U "huggingface_hub[cli]" accelerate
131+
pip install -U "huggingface_hub[cli]<1.0" accelerate
132132
huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
133133
OPTIMUM_ET_VERSION=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
134134
pip install git+https://github.com/huggingface/optimum-executorch.git@${OPTIMUM_ET_VERSION}
@@ -208,7 +208,7 @@ jobs:
208208
echo "::endgroup::"
209209
210210
echo "::group::Setup Huggingface"
211-
pip install -U "huggingface_hub[cli]" accelerate
211+
pip install -U "huggingface_hub[cli]<1.0" accelerate
212212
huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
213213
OPTIMUM_ET_VERSION=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
214214
pip install git+https://github.com/huggingface/optimum-executorch.git@${OPTIMUM_ET_VERSION}

.github/workflows/metal.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
3131
export-voxtral-metal-artifact:
3232
name: export-voxtral-metal-artifact
33+
# Skip this job if the pull request is from a fork (HuggingFace secrets are not available)
34+
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
3335
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
3436
secrets: inherit
3537
with:
@@ -44,7 +46,7 @@ jobs:
4446
set -eux
4547
4648
echo "::group::Setup Huggingface"
47-
${CONDA_RUN} pip install -U "huggingface_hub[cli]" accelerate
49+
${CONDA_RUN} pip install -U "huggingface_hub[cli]<1.0" accelerate
4850
${CONDA_RUN} huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
4951
echo "::endgroup::"
5052

.github/workflows/nightly.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,37 @@ jobs:
3636
uses: ./.github/workflows/_link_check.yml
3737
with:
3838
ref: ${{ github.sha }}
39+
40+
test-static-hf-llm-qnn-linux:
41+
name: test-static-hf-llm-qnn-linux
42+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
43+
permissions:
44+
id-token: write
45+
contents: read
46+
strategy:
47+
matrix:
48+
task: [smollm2_135m]
49+
fail-fast: false
50+
with:
51+
runner: linux.24xlarge
52+
docker-image: ci-image:executorch-ubuntu-22.04-qnn-sdk
53+
submodules: 'recursive'
54+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
55+
timeout: 900
56+
script: |
57+
# The generic Linux job chooses to use base env, not the one setup by the image
58+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
59+
conda activate "${CONDA_ENV}"
60+
61+
BUILD_TOOL="cmake"
62+
63+
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-qnn-deps.sh
64+
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
65+
66+
# Setup executorch
67+
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool "${BUILD_TOOL}"
68+
69+
# Setup install_requirements for llama
70+
PYTHON_EXECUTABLE=python bash examples/models/llama/install_requirements.sh
71+
72+
PYTHON_EXECUTABLE=python bash .ci/scripts/test_qnn_static_llm.sh ${{ matrix.task }}

.github/workflows/pull.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ jobs:
315315
echo "::endgroup::"
316316
317317
echo "::group::Setup Huggingface"
318-
pip install -U "huggingface_hub[cli]" accelerate
318+
pip install -U "huggingface_hub[cli]<1.0" accelerate
319319
huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
320320
OPTIMUM_ET_VERSION=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
321321
pip install git+https://github.com/huggingface/optimum-executorch.git@${OPTIMUM_ET_VERSION}
@@ -566,6 +566,8 @@ jobs:
566566
id-token: write
567567
contents: read
568568
strategy:
569+
matrix:
570+
task: [stories_110m, stories_260k_bc]
569571
fail-fast: false
570572
with:
571573
runner: linux.2xlarge
@@ -589,8 +591,7 @@ jobs:
589591
# Setup install_requirements for llama
590592
PYTHON_EXECUTABLE=python bash examples/models/llama/install_requirements.sh
591593
592-
# Test static llama weight sharing and accuracy
593-
PYTHON_EXECUTABLE=python bash .ci/scripts/test_qnn_static_llama.sh
594+
PYTHON_EXECUTABLE=python bash .ci/scripts/test_qnn_static_llm.sh ${{ matrix.task }}
594595
595596
test-qnn-models-linux:
596597
name: test-qnn-models-linux
@@ -635,7 +636,7 @@ jobs:
635636
echo "::group::Setup ExecuTorch"
636637
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool "cmake"
637638
echo "::endgroup::"
638-
639+
639640
echo "::group::Setup requirements"
640641
# install phi-3-mini requirements
641642
bash examples/models/phi-3-mini/install_requirements.sh
@@ -908,6 +909,8 @@ jobs:
908909
909910
test-samsung-models-linux:
910911
name: test-samsung-models-linux
912+
# Skip this job if the pull request is from a fork (secrets are not available)
913+
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
911914
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
912915
permissions:
913916
id-token: write

.github/workflows/trunk.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ jobs:
626626
BUILD_TORCHAO_EXPERIMENTAL=1 TORCHAO_BUILD_CPU_AARCH64=1 TORCHAO_BUILD_KLEIDIAI=1 TORCHAO_ENABLE_ARM_NEON_DOT=1 TORCHAO_PARALLEL_BACKEND=OPENMP pip install third-party/ao
627627
fi
628628
629-
pip install -U "huggingface_hub[cli]"
629+
pip install -U "huggingface_hub[cli]<1.0"
630630
631631
bash .ci/scripts/test_torchao_huggingface_checkpoints.sh ${{ matrix.model }} ${{ matrix.model != 'phi_4_mini' && '--test_with_runner' || '' }} ${{ matrix.backend == 'torchao' && '--use_torchao_kernels' || '' }}
632632
@@ -659,7 +659,7 @@ jobs:
659659
echo "::endgroup::"
660660
661661
echo "::group::Set up Huggingface"
662-
${CONDA_RUN} pip install -U "huggingface_hub[cli]" accelerate
662+
${CONDA_RUN} pip install -U "huggingface_hub[cli]<1.0" accelerate
663663
${CONDA_RUN} huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
664664
OPTIMUM_ET_VERSION=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
665665
${CONDA_RUN} pip install git+https://github.com/huggingface/optimum-executorch.git@${OPTIMUM_ET_VERSION}
@@ -834,7 +834,7 @@ jobs:
834834
echo "::endgroup::"
835835
836836
echo "::group::Setup Huggingface"
837-
pip install -U "huggingface_hub[cli]" accelerate
837+
pip install -U "huggingface_hub[cli]<1.0" accelerate
838838
huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
839839
OPTIMUM_ET_VERSION=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
840840
pip install git+https://github.com/huggingface/optimum-executorch.git@${OPTIMUM_ET_VERSION}
@@ -930,7 +930,7 @@ jobs:
930930
echo "::endgroup::"
931931
932932
echo "::group::Set up Huggingface"
933-
${CONDA_RUN} pip install -U "huggingface_hub[cli]" accelerate
933+
${CONDA_RUN} pip install -U "huggingface_hub[cli]<1.0" accelerate
934934
${CONDA_RUN} huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
935935
OPTIMUM_ET_VERSION=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
936936
${CONDA_RUN} pip install git+https://github.com/huggingface/optimum-executorch.git@${OPTIMUM_ET_VERSION}

backends/aoti/common_shims.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ int32_t aoti_torch_dtype_int32() {
184184
return 3; // PyTorch's int32 dtype code
185185
}
186186

187+
int32_t aoti_torch_dtype_bool() {
188+
return 11; // PyTorch's bool dtype code
189+
}
190+
187191
int32_t aoti_torch_dtype_int64() {
188192
return 4; // PyTorch's int64 dtype code
189193
}

0 commit comments

Comments
 (0)