Skip to content

Commit 9a4440e

Browse files
committed
Merge branch 'main' of https://github.com/pytorch/executorch into export-D82171193
2 parents bccaa2a + f6a5fa0 commit 9a4440e

File tree

106 files changed

+2752
-3516
lines changed

Some content is hidden

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

106 files changed

+2752
-3516
lines changed

.ci/scripts/test_torchao_huggingface_checkpoints.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
set -euo pipefail
2+
set -euxo pipefail
33

44
# -------------------------
55
# Args / flags
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Test Backend
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
backend:
7+
description: 'Backend to test (xnnpack, coreml, vulkan, qnn)'
8+
required: true
9+
type: string
10+
flows:
11+
description: 'JSON array of flows to test'
12+
required: true
13+
type: string
14+
ref:
15+
description: 'Git ref to checkout'
16+
required: false
17+
type: string
18+
default: ${{ github.sha }}
19+
timeout:
20+
description: 'Job timeout in minutes'
21+
required: false
22+
type: number
23+
default: 120
24+
run-linux:
25+
description: 'Whether to run Linux tests'
26+
required: false
27+
type: boolean
28+
default: false
29+
run-macos:
30+
description: 'Whether to run macOS tests'
31+
required: false
32+
type: boolean
33+
default: false
34+
35+
jobs:
36+
test-backend-linux:
37+
if: ${{ inputs.run-linux }}
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
flow: ${{ fromJSON(inputs.flows) }}
42+
suite: [models, operators]
43+
44+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
45+
with:
46+
ref: ${{ inputs.ref }}
47+
runner: linux.4xlarge.memory
48+
docker-image: ci-image:executorch-ubuntu-22.04-clang12
49+
submodules: recursive
50+
timeout: ${{ inputs.timeout }}
51+
upload-artifact: test-report-${{ matrix.flow }}-${{ matrix.suite }}
52+
script: |
53+
set -eux
54+
55+
source .ci/scripts/test_backend_linux.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"
56+
57+
test-backend-macos:
58+
if: ${{ inputs.run-macos }}
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
flow: ${{ fromJSON(inputs.flows) }}
63+
suite: [models, operators]
64+
65+
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
66+
with:
67+
ref: ${{ inputs.ref }}
68+
runner: macos-m1-stable
69+
python-version: "3.12"
70+
submodules: recursive
71+
timeout: ${{ inputs.timeout }}
72+
upload-artifact: test-report-${{ matrix.flow }}-${{ matrix.suite }}
73+
script: |
74+
set -eux
75+
76+
# This is needed to get the prebuilt PyTorch wheel from S3
77+
${CONDA_RUN} --no-capture-output pip install awscli==1.37.21
78+
79+
source .ci/scripts/test_backend_macos.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"

.github/workflows/nightly.yml

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -36,51 +36,3 @@ jobs:
3636
uses: ./.github/workflows/_link_check.yml
3737
with:
3838
ref: ${{ github.sha }}
39-
40-
backend-test-linux:
41-
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
42-
strategy:
43-
fail-fast: false
44-
matrix:
45-
flow: [
46-
qnn, qnn_16a16w, qnn_16a8w, qnn_16a4w, qnn_16a4w_block, qnn_8a8w,
47-
vulkan, vulkan_static_int8_per_channel,
48-
xnnpack, xnnpack_dynamic_int8_per_channel, xnnpack_static_int8_per_channel, xnnpack_static_int8_per_tensor
49-
]
50-
suite: [models, operators]
51-
with:
52-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
53-
runner: linux.4xlarge.memory
54-
docker-image: ci-image:executorch-ubuntu-22.04-clang12
55-
submodules: recursive
56-
timeout: 120
57-
upload-artifact: test-report-${{ matrix.flow }}-${{ matrix.suite }}
58-
script: |
59-
set -eux
60-
61-
source .ci/scripts/test_backend_linux.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"
62-
63-
backend-test-macos:
64-
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
65-
permissions:
66-
id-token: write
67-
contents: read
68-
strategy:
69-
fail-fast: false
70-
matrix:
71-
flow: [coreml, coreml_static_int8]
72-
suite: [models, operators]
73-
with:
74-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
75-
runner: macos-m1-stable
76-
python-version: 3.12
77-
submodules: recursive
78-
timeout: 120
79-
upload-artifact: test-report-${{ matrix.flow }}-${{ matrix.suite }}
80-
script: |
81-
set -eux
82-
83-
# This is needed to get the prebuilt PyTorch wheel from S3
84-
${CONDA_RUN} --no-capture-output pip install awscli==1.37.21
85-
86-
source .ci/scripts/test_backend_macos.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"

.github/workflows/pull.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,7 @@ jobs:
779779
contents: read
780780
strategy:
781781
fail-fast: false
782+
if: false # TODO Re-enable after fixing timeouts (#14314)
782783
with:
783784
runner: linux.2xlarge
784785
docker-image: ci-image:executorch-ubuntu-22.04-gcc9
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test CoreML Backend
2+
3+
on:
4+
schedule:
5+
- cron: 0 2 * * *
6+
push:
7+
tags:
8+
- ciflow/nightly/*
9+
pull_request:
10+
paths:
11+
- .github/workflows/test-backend-coreml.yml
12+
- .github/workflows/_test_backend.yml
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
test-coreml:
21+
uses: ./.github/workflows/_test_backend.yml
22+
with:
23+
backend: coreml
24+
flows: '["coreml", "coreml_static_int8"]'
25+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
26+
timeout: 120
27+
run-macos: true
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test QNN Backend
2+
3+
on:
4+
schedule:
5+
- cron: 0 2 * * *
6+
push:
7+
tags:
8+
- ciflow/nightly/*
9+
pull_request:
10+
paths:
11+
- .github/workflows/test-backend-qnn.yml
12+
- .github/workflows/_test_backend.yml
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
test-qnn:
21+
uses: ./.github/workflows/_test_backend.yml
22+
with:
23+
backend: qnn
24+
flows: '["qnn", "qnn_16a16w", "qnn_16a8w", "qnn_16a4w", "qnn_16a4w_block", "qnn_8a8w"]'
25+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
26+
timeout: 120
27+
run-linux: true
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test Vulkan Backend
2+
3+
on:
4+
schedule:
5+
- cron: 0 2 * * *
6+
push:
7+
tags:
8+
- ciflow/nightly/*
9+
pull_request:
10+
paths:
11+
- .github/workflows/test-backend-vulkan.yml
12+
- .github/workflows/_test_backend.yml
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
test-vulkan:
21+
uses: ./.github/workflows/_test_backend.yml
22+
with:
23+
backend: vulkan
24+
flows: '["vulkan", "vulkan_static_int8_per_channel"]'
25+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
26+
timeout: 120
27+
run-linux: true
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test XNNPACK Backend
2+
3+
on:
4+
schedule:
5+
- cron: 0 2 * * *
6+
push:
7+
tags:
8+
- ciflow/nightly/*
9+
pull_request:
10+
paths:
11+
- .github/workflows/test-backend-xnnpack.yml
12+
- .github/workflows/_test_backend.yml
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
test-xnnpack:
21+
uses: ./.github/workflows/_test_backend.yml
22+
with:
23+
backend: xnnpack
24+
flows: '["xnnpack", "xnnpack_dynamic_int8_per_channel", "xnnpack_static_int8_per_channel", "xnnpack_static_int8_per_tensor"]'
25+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
26+
timeout: 120
27+
run-linux: true

backends/arm/ethosu/backend.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from typing import final, List
1616

1717
from executorch.backends.arm.arm_vela import vela_compile
18+
from executorch.backends.arm.ethosu.compile_spec import EthosUCompileSpec
1819

1920
from executorch.backends.arm.tosa.backend import TOSABackend
2021
from executorch.exir.backend.backend_details import BackendDetails, PreprocessResult
@@ -35,16 +36,13 @@ class EthosUBackend(BackendDetails):
3536

3637
@staticmethod
3738
def _compile_tosa_flatbuffer(
38-
tosa_flatbuffer: bytes, compile_spec: List[CompileSpec]
39+
tosa_flatbuffer: bytes, compile_spec: EthosUCompileSpec
3940
) -> bytes:
4041
"""
4142
Static helper method to do the compilation of the TOSA flatbuffer
4243
representation to a target specific binary stream.
4344
"""
44-
compile_flags = []
45-
for spec in compile_spec:
46-
if spec.key == "compile_flags":
47-
compile_flags.append(spec.value.decode())
45+
compile_flags = compile_spec.compiler_flags
4846

4947
if len(compile_flags) == 0:
5048
# Not testing for compile_flags correctness here, just that they are
@@ -64,10 +62,11 @@ def _compile_tosa_flatbuffer(
6462
@staticmethod
6563
def preprocess(
6664
edge_program: ExportedProgram,
67-
compile_spec: List[CompileSpec],
65+
compile_specs: List[CompileSpec],
6866
) -> PreprocessResult:
6967
logger.info(f"{EthosUBackend.__name__} preprocess")
7068

69+
compile_spec = EthosUCompileSpec.from_list(compile_specs)
7170
# deduce TOSA compile_spec from Ethos-U compile spec. We get a new
7271
# compile spec list, containing only elements relevant for the
7372
# TOSABackend.
@@ -77,7 +76,7 @@ def preprocess(
7776
# ('All backend implementation are final...'), so use composition instead.
7877
# preprocess returns the serialized TOSA flatbuffer in .processed_bytes,
7978
# which can be passed on to next compilation step.
80-
tosa_preprocess = TOSABackend.preprocess(edge_program, tosa_compile_spec)
79+
tosa_preprocess = TOSABackend._preprocess(edge_program, tosa_compile_spec)
8180

8281
binary = EthosUBackend._compile_tosa_flatbuffer(
8382
tosa_preprocess.processed_bytes, compile_spec

backends/arm/operators/op_abs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ def define_node(
7373
abs_output = output
7474

7575
# Do the INT32 Abs
76-
tosa_graph.addOperator(
76+
self._serialize_operator(
77+
node,
78+
tosa_graph,
7779
ts.TosaOp.Op().ABS,
7880
[
7981
rescaled_inputs[0].name,

0 commit comments

Comments
 (0)