Skip to content

Commit 3bedb8d

Browse files
committed
Update on "[executorch][serialization] Serialize PTD files."
Introduce top-level serialization file that calls: - serialize_pte_binary for PTE file - FlatTensor.serialize_tensors for PTD files. Differential Revision: [D66523267](https://our.internmc.facebook.com/intern/diff/D66523267/) [ghstack-poisoned]
2 parents d25ae36 + 2992d47 commit 3bedb8d

File tree

194 files changed

+4301
-2389
lines changed

Some content is hidden

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

194 files changed

+4301
-2389
lines changed

.ci/docker/requirements-ci.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
mpmath==1.3.0
2-
numpy==1.21.3; python_version == '3.10'
3-
numpy==1.23.2; python_version == '3.11'
4-
numpy; python_version >= '3.12'
2+
numpy==2.0.0; python_version >= '3.10'
53
PyYAML==6.0.1
64
ruamel.yaml==0.17.32
75
sympy==1.12
86
timm==0.6.13
97
tomli==2.0.1
108
torchsr==1.0.4
11-
transformers==4.38.0
9+
transformers==4.47.1
1210
zstd==1.5.5.1
13-
pandas==2.0.3; python_version == '3.10'
14-
pandas; python_version >= '3.11'
11+
pandas==2.2.2; python_version >= '3.10'
1512
pytest==7.2.0
1613
pytest-cov==4.1.0
1714
expecttest==0.1.6
@@ -24,7 +21,7 @@ sphinx-gallery==0.14.0
2421
breathe==4.34.0
2522
exhale==0.2.3
2623
docutils==0.16
27-
matplotlib==3.7.2
24+
matplotlib==3.9.4
2825
# PyTorch Theme
2926
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
3027
myst-parser==0.18.1

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# Copyright 2025 Arm Limited and/or its affiliates.
34
# All rights reserved.
45
#
56
# This source code is licensed under the BSD-style license found in the
@@ -11,10 +12,16 @@ set -o xtrace
1112
build_qnn_backend() {
1213
echo "Start building qnn backend."
1314
export ANDROID_NDK_ROOT=/opt/ndk
14-
export QNN_SDK_ROOT=/tmp/qnn/2.25.0.240728
15+
export QNN_SDK_ROOT=/tmp/qnn/2.28.0.241029
1516
export EXECUTORCH_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
1617

17-
bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number 2 --release
18+
# Workaround to avoid issues around missing flatccrt library (depending on the
19+
# number of jobs used), see issue #7300:
20+
# Build twice (second time with `--no_clean`) to make sure libflatccrt.a is
21+
# available.
22+
# TODO: Remove this workaround once the underlying issue is fixed.
23+
bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number 2 --release || \
24+
bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number 2 --release --no_clean
1825
}
1926

2027
set_up_aot() {

.ci/scripts/setup-qnn-deps.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ install_qnn() {
1616
QNN_INSTALLATION_DIR=/tmp/qnn
1717
mkdir -p "${QNN_INSTALLATION_DIR}"
1818

19-
curl -Lo /tmp/v2.25.0.24.07.28.zip "https://softwarecenter.qualcomm.com/api/download/software/qualcomm_neural_processing_sdk/v2.25.0.240728.zip"
19+
curl -Lo /tmp/v2.28.0.24.10.29.zip "https://softwarecenter.qualcomm.com/api/download/software/qualcomm_neural_processing_sdk/v2.28.0.241029.zip"
2020
echo "Finishing downloading qnn sdk."
21-
unzip -qo /tmp/v2.25.0.24.07.28.zip -d /tmp
21+
unzip -qo /tmp/v2.28.0.24.10.29.zip -d /tmp
2222
echo "Finishing unzip qnn sdk."
2323

2424

.ci/scripts/test_llama.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ echo "COREML option ${COREML}"
121121
if [[ "${MODE}" =~ .*qnn.* ]]; then
122122
QNN=ON
123123
export EXECUTORCH_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
124-
export QNN_SDK_ROOT=/tmp/qnn/2.25.0.240728
124+
export QNN_SDK_ROOT=/tmp/qnn/2.28.0.241029
125125
export LD_LIBRARY_PATH="${QNN_SDK_ROOT}/lib/x86_64-linux-clang"
126126
export PYTHONPATH=".."
127127
cp schema/program.fbs exir/_serialize/program.fbs

.github/pytorch-probot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# The schema is from https://github.com/pytorch/pytorch/blob/main/.github/pytorch-probot.yml
2+
tracking_issue: 7679
23
ciflow_push_tags:
34
- ciflow/android
45
- ciflow/apple

.github/workflows/android-perf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ jobs:
260260
--output_name="${OUT_ET_MODEL_NAME}.pte"
261261
ls -lh "${OUT_ET_MODEL_NAME}.pte"
262262
elif [[ ${{ matrix.config }} == "llama3_qnn_htp" ]]; then
263-
export QNN_SDK_ROOT=/tmp/qnn/2.25.0.240728
263+
export QNN_SDK_ROOT=/tmp/qnn/2.28.0.241029
264264
export LD_LIBRARY_PATH=$QNN_SDK_ROOT/lib/x86_64-linux-clang/
265265
export PYTHONPATH=$(pwd)/..
266266
@@ -347,7 +347,7 @@ jobs:
347347
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
348348
349349
export ANDROID_ABIS="arm64-v8a"
350-
PYTHON_EXECUTABLE=python EXECUTORCH_BUILD_QNN=ON QNN_SDK_ROOT=/tmp/qnn/2.25.0.240728 bash build/build_android_llm_demo.sh ${ARTIFACTS_DIR_NAME}
350+
PYTHON_EXECUTABLE=python EXECUTORCH_BUILD_QNN=ON QNN_SDK_ROOT=/tmp/qnn/2.28.0.241029 bash build/build_android_llm_demo.sh ${ARTIFACTS_DIR_NAME}
351351
352352
# Let's see how expensive this job is, we might want to tone it down by running it periodically
353353
benchmark-on-device:

.github/workflows/pull.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ jobs:
333333

334334
unittest-arm:
335335
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
336+
permissions:
337+
id-token: write
338+
contents: read
336339
with:
337340
runner: linux.2xlarge
338341
docker-image: executorch-ubuntu-22.04-arm-sdk
@@ -395,6 +398,25 @@ jobs:
395398
# Test llama2
396399
PYTHON_EXECUTABLE=python bash .ci/scripts/test_llama.sh -model stories110M -build_tool "${BUILD_TOOL}" -mode "${MODE}" -dtype "${DTYPE}" -pt2e_quantize "${PT2E_QUANTIZE}"
397400
401+
test-qnn-models-linux:
402+
name: test-qnn-models-linux
403+
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
404+
strategy:
405+
fail-fast: false
406+
with:
407+
runner: linux.2xlarge
408+
docker-image: executorch-ubuntu-22.04-qnn-sdk
409+
submodules: 'true'
410+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
411+
timeout: 180
412+
script: |
413+
# The generic Linux job chooses to use base env, not the one setup by the image
414+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
415+
conda activate "${CONDA_ENV}"
416+
417+
# placeholder for running test_qnn_delegate.py, can use matrix such that we can trigger different jobs, refers to test-llama-runner-qnn-linux
418+
# reminder: make sure each job runs fast
419+
398420
test-phi-3-mini-runner-linux:
399421
name: test-phi-3-mini-runner-linux
400422
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main

.github/workflows/trunk.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ jobs:
132132
test-arm-backend-delegation:
133133
name: test-arm-backend-delegation
134134
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
135+
permissions:
136+
id-token: write
137+
contents: read
135138
with:
136139
runner: linux.2xlarge
137140
docker-image: executorch-ubuntu-22.04-arm-sdk
@@ -159,6 +162,9 @@ jobs:
159162
test-arm-reference-delegation:
160163
name: test-arm-reference-delegation
161164
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
165+
permissions:
166+
id-token: write
167+
contents: read
162168
with:
163169
runner: linux.2xlarge
164170
docker-image: executorch-ubuntu-22.04-arm-sdk

.lintrunner.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ include_patterns = [
294294
'build/**/*.py',
295295
'codegen/**/*.py',
296296
# 'devtools/**/*.py',
297+
'devtools/visualization/**/*.py',
297298
'docs/**/*.py',
298299
# 'examples/**/*.py',
299300
# 'exir/**/*.py',

backends/apple/coreml/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ class Model(torch.nn.Module):
9393
source_model = Model()
9494
example_inputs = (torch.randn((1, 3, 256, 256)), )
9595

96-
pre_autograd_aten_dialect = export_for_training(model, example_inputs).module()
96+
pre_autograd_aten_dialect = export_for_training(source_model, example_inputs).module()
9797

9898
quantization_config = LinearQuantizerConfig.from_dict(
9999
{
100100
"global_config": {
101101
"quantization_scheme": QuantizationScheme.symmetric,
102-
"activation_dtype": torch.uint8,
103-
"weight_dtype": torch.int8,
102+
"activation_dtype": torch.quint8,
103+
"weight_dtype": torch.qint8,
104104
"weight_per_channel": True,
105105
}
106106
}

0 commit comments

Comments
 (0)