Skip to content

Commit ee27cf0

Browse files
Merge branch 'main' into export-D78291986
2 parents 8de200f + 0d0769a commit ee27cf0

File tree

160 files changed

+6888
-2025
lines changed

Some content is hidden

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

160 files changed

+6888
-2025
lines changed

.ci/scripts/setup-vulkan-linux-deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ install_vulkan_sdk() {
4343
export PATH="${PATH}:${_vulkan_sdk_dir}/${VULKAN_SDK_VERSION}/x86_64/bin/"
4444
}
4545

46-
VULKAN_SDK_VERSION="1.3.296.0"
46+
VULKAN_SDK_VERSION="1.4.321.1"
4747

4848
install_swiftshader
4949
install_vulkan_sdk "${VULKAN_SDK_VERSION}"

.github/workflows/apple-perf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ jobs:
416416
- set-parameters
417417
secrets: inherit
418418
with:
419-
runner: macos-latest-xlarge
419+
runner: macos-14-xlarge
420420
python-version: '3.11'
421421
submodules: 'recursive'
422422
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

.github/workflows/apple.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
5050
secrets: inherit
5151
with:
52-
runner: macos-latest-xlarge
52+
runner: macos-14-xlarge
5353
python-version: '3.11'
5454
submodules: 'recursive'
5555
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
@@ -136,7 +136,7 @@ jobs:
136136
needs: set-version
137137
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
138138
with:
139-
runner: macos-latest-xlarge
139+
runner: macos-14-xlarge
140140
python-version: '3.11'
141141
submodules: 'recursive'
142142
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
@@ -276,7 +276,7 @@ jobs:
276276
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
277277
secrets: inherit
278278
with:
279-
runner: macos-latest-xlarge
279+
runner: macos-14-xlarge
280280
python-version: '3.11'
281281
submodules: 'recursive'
282282
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

.github/workflows/build-presets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
job-name: build
2424
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
25-
runner: macos-latest-xlarge
25+
runner: macos-14-xlarge
2626
python-version: 3.12
2727
submodules: recursive
2828
timeout: 90

.github/workflows/build-wheels-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
post-script: ${{ matrix.post-script }}
6464
package-name: ${{ matrix.package-name }}
6565
# Meta's macOS runners do not have Xcode, so use GitHub's runners.
66-
runner-type: macos-latest-xlarge
66+
runner-type: macos-14-xlarge
6767
setup-miniconda: true
6868
smoke-test-script: ${{ matrix.smoke-test-script }}
6969
trigger-event: ${{ github.event_name }}

.github/workflows/pull.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,13 +855,14 @@ jobs:
855855
.ci/scripts/setup-linux.sh --build-tool "cmake"
856856
857857
# Install test requirements
858-
pip install -r backends/nxp/requirements-tests.txt
858+
pip install -r backends/nxp/requirements-tests-pypi.txt
859+
pip install -r backends/nxp/requirements-tests-eiq.txt
859860
860861
# Run pytest
861862
PYTHON_EXECUTABLE=python bash backends/nxp/run_unittests.sh
862863
863864
# Run aot examples:
864-
PYTHON_EXECUTABLE=python bash examples/nxp/run_aot_example.sh cifar10
865+
PYTHON_EXECUTABLE=python bash examples/nxp/run_aot_example.sh cifar10
865866
PYTHON_EXECUTABLE=python bash examples/nxp/run_aot_example.sh mobilenetv2
866867
867868
@@ -901,6 +902,34 @@ jobs:
901902
done
902903
903904
905+
test-vulkan-operators-linux:
906+
name: test-vulkan-operators-linux
907+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
908+
permissions:
909+
id-token: write
910+
contents: read
911+
with:
912+
runner: linux.2xlarge
913+
docker-image: ci-image:executorch-ubuntu-22.04-clang12
914+
submodules: 'recursive'
915+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
916+
timeout: 90
917+
script: |
918+
set -eux
919+
920+
# The generic Linux job chooses to use base env, not the one setup by the image
921+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
922+
conda activate "${CONDA_ENV}"
923+
924+
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate
925+
source .ci/scripts/setup-vulkan-linux-deps.sh
926+
927+
# Setup python
928+
PYTHON_EXECUTABLE=python \
929+
CMAKE_ARGS="-DEXECUTORCH_BUILD_VULKAN=ON" \
930+
.ci/scripts/setup-linux.sh --build-tool "cmake"
931+
932+
PYTHON_EXECUTABLE=python bash backends/vulkan/test/custom_ops/build_and_run.sh add
904933
905934
nxp-build-test:
906935
name: nxp-build-test

.github/workflows/trunk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ jobs:
435435
name: test-coreml-delegate
436436
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
437437
with:
438-
runner: macos-latest-xlarge
438+
runner: macos-14-xlarge
439439
python-version: '3.11'
440440
submodules: 'recursive'
441441
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

backends/apple/mps/serialization/mps_graph_serialize.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# Copyright (c) Meta Platforms, Inc. and affiliates.
22
# All rights reserved.
3+
# Copyright 2025 Arm Limited and/or its affiliates.
34
#
45
# This source code is licensed under the BSD-style license found in the
56
# LICENSE file in the root directory of this source tree.
67

8+
import importlib.resources as _resources
79
import json
810
import os
911
import tempfile
1012

11-
import pkg_resources
13+
import executorch.backends.apple.mps.serialization as serialization_package
1214
from executorch.backends.apple.mps.serialization.mps_graph_schema import MPSGraph
1315
from executorch.exir._serialize._dataclass import _DataclassEncoder
1416
from executorch.exir._serialize._flatbuffer import _flatc_compile
@@ -19,7 +21,9 @@ def convert_to_flatbuffer(mps_graph: MPSGraph) -> bytes:
1921
with tempfile.TemporaryDirectory() as d:
2022
schema_path = os.path.join(d, "schema.fbs")
2123
with open(schema_path, "wb") as schema_file:
22-
schema_file.write(pkg_resources.resource_string(__name__, "schema.fbs"))
24+
schema_file.write(
25+
_resources.read_binary(serialization_package, "schema.fbs")
26+
)
2327
json_path = os.path.join(d, "schema.json")
2428
with open(json_path, "wb") as json_file:
2529
json_file.write(mps_graph_json.encode("ascii"))

backends/arm/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ if(EXECUTORCH_BUILD_VGF)
7373
# vgf backend
7474
list(TRANSFORM _vgf_backend_sources PREPEND "${EXECUTORCH_ROOT}/")
7575
add_library(vgf_backend ${_vgf_backend_sources})
76+
install(TARGETS vgf_backend EXPORT ExecuTorchTargets)
7677
target_include_directories(
77-
vgf_backend PUBLIC ${_common_include_directories} ${VULKAN_HEADERS_PATH}
78-
${VOLK_HEADERS_PATH}
78+
vgf_backend PRIVATE ${_common_include_directories} ${VULKAN_HEADERS_PATH}
79+
${VOLK_HEADERS_PATH}
7980
)
8081
target_compile_options(
8182
vgf_backend PRIVATE -DUSE_VULKAN_WRAPPER -DUSE_VULKAN_VOLK

backends/arm/README.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,19 @@ You can test to run some models with the full fvp test flow
8888
backends/arm/test/test_arm_baremetal.sh test_full_ethosu_fvp
8989
```
9090

91+
To run the unit test suite with VKML use the following. Note Vulkan SDK need to be installed.
92+
Have a look at install_vulkan_sdk() in .ci/scripts/setup-vulkan-linux-deps.sh on how to install Vulkan SDK.
93+
94+
```
95+
backends/arm/test/test_arm_baremetal.sh test_pytest_vkml
96+
```
97+
98+
You can test to run some models with the full VKML flow
99+
100+
```
101+
backends/arm/test/test_arm_baremetal.sh test_full_vkml
102+
```
103+
91104
## Unit tests
92105

93106
This is the structure of the test directory
@@ -102,6 +115,7 @@ test # Root test folder
102115
├── tosautil # Utility functions for TOSA artifacts
103116
├ common.py # Common functions and definitions used by many tests
104117
├ setup_testing.sh # Script to prepare testing for using the Corstone 3x0 FVP
118+
├ setup_testing_vkml.sh # Script to prepare testing for using the VKML
105119
├ test_arm_baremetal.sh # Help script to trigger testing
106120
```
107121

@@ -123,7 +137,7 @@ first you need to build and prepare some used target libs
123137

124138
```
125139
examples/arm/run.sh --model_name=add --build_only
126-
backends/arm/test/setup_testing.sh
140+
backends/arm/test/setup_testing.sh and/or backends/arm/test/setup_testing_vkml.sh
127141
```
128142

129143
The you can run the tests with
@@ -195,6 +209,38 @@ List of model specific and optional passes:
195209
- InsertCastForOpsWithInt64InputPass
196210
- Functionality:
197211
- For LLMs such as LLama, some opeartors like aten.embedding have int64 input. In order to lower these operators to TOSA, this pass will insert a casting node that converts the input from int64 to int32.
198-
- Example usage: backends/arm/test/models/test_llama.py
199212
- Supported Ops:
200213
- aten.embedding.default, aten.slice_copy.Tensor
214+
- Example usage:
215+
- backends/arm/test/models/test_llama.py
216+
217+
- ConvertInt64ConstOpsToInt32Pass
218+
- Functionalities:
219+
- Rewrites constant-producing ops that output int64 to instead output int32, when values are within int32 bounds.
220+
- Supported Ops:
221+
- `torch.full`, `torch.arange`, `torch.eye`, `torch.linspace`, `torch.tensor`
222+
- Example usage:
223+
- backends/arm/test/models/stable_diffusion/test_CLIPTextModelWithProjection.py
224+
- backends/arm/test/models/stable_diffusion/test_T5EncoderModel.py
225+
226+
- ConvertInt64OutputOpsToInt32Pass
227+
- Overview:
228+
- Rewrites or removes operations that produce int64 outputs, converting them to int32 where possible.
229+
- Overflow checks are applied selectively; for ops without such checks, users need to ensure values fit within the int32 range.
230+
- Functionalities:
231+
1. Handling casting to int64:
232+
- (1) int32 -> int64:
233+
- Removes the cast and redirect uses of int64 to int32
234+
- (2) other types -> int64:
235+
- Rewrites the cast to other types -> int32
236+
- Supported Ops:
237+
- torch.ops.aten.to.\[dtype|dtype_layout\]
238+
- exir_ops.edge.dim_order_ops._to_dim_order_copy.default
239+
2. Post-process argmax outputs:
240+
- Inserts an int64->int32 cast after the argmax operations that produce int64 outputs:
241+
- Supported Ops:
242+
- torch.ops.aten.argmax.default
243+
- exir_ops.edge.aten.argmax.default
244+
- Example usage:
245+
- (Functionality 1) backends/arm/test/models/stable_diffusion/test_T5EncoderModel.py
246+
- (Functionality 2) backends/arm/test/models/stable_diffusion/test_CLIPTextModelWithProjection.py

0 commit comments

Comments
 (0)