Skip to content

Commit c620875

Browse files
committed
Update on "Support Half/BFloat16 in op_allclose"
We incorrectly required these types to be bitwise-identical rather than close. Partial fix for #7748. (I had to develop this internally because the op_allclose_test doesn't run in OSS.) Differential Revision: [D68366831](https://our.internmc.facebook.com/intern/diff/D68366831/) [ghstack-poisoned]
2 parents 8e8cb97 + 43580f5 commit c620875

File tree

218 files changed

+5898
-5076
lines changed

Some content is hidden

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

218 files changed

+5898
-5076
lines changed

.ci/scripts/utils.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ retry () {
1717
}
1818

1919
clean_executorch_install_folders() {
20-
./install_requirements.sh --clean
20+
./install_executorch.sh --clean
2121
}
2222

2323
install_executorch() {
2424
which pip
2525
# Install executorch, this assumes that Executorch is checked out in the
2626
# current directory.
2727
if [[ "${1:-}" == "use-pt-pinned-commit" ]]; then
28-
./install_requirements.sh --pybind xnnpack --use-pt-pinned-commit
28+
./install_executorch.sh --pybind xnnpack --use-pt-pinned-commit
2929
else
30-
./install_requirements.sh --pybind xnnpack
30+
./install_executorch.sh --pybind xnnpack
3131
fi
3232
# Just print out the list of packages for debugging
3333
pip list

.github/workflows/apple.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
paths:
1010
- .ci/scripts/setup-ios.sh
1111
- .github/workflows/apple.yml
12-
- install_requirements.sh
12+
- install_executorch.sh
1313
- backends/apple/**
1414
- build/build_apple_frameworks.sh
1515
- build/build_apple_llm_demo.sh

.github/workflows/pull.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ jobs:
200200
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "cmake"
201201
202202
# install pybind
203-
bash install_requirements.sh --pybind xnnpack
203+
bash install_executorch.sh --pybind xnnpack
204204
205205
# install Llava requirements
206206
bash examples/models/llama/install_requirements.sh
@@ -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
@@ -433,7 +436,7 @@ jobs:
433436
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "cmake"
434437
435438
# install pybind
436-
bash install_requirements.sh --pybind xnnpack
439+
bash install_executorch.sh --pybind xnnpack
437440
438441
# install phi-3-mini requirements
439442
bash examples/models/phi-3-mini/install_requirements.sh
@@ -460,7 +463,7 @@ jobs:
460463
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "cmake"
461464
462465
# install pybind
463-
bash install_requirements.sh --pybind xnnpack
466+
bash install_executorch.sh --pybind xnnpack
464467
465468
# install llama requirements
466469
bash examples/models/llama/install_requirements.sh
@@ -487,7 +490,7 @@ jobs:
487490
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "cmake"
488491
489492
# install pybind
490-
bash install_requirements.sh --pybind xnnpack
493+
bash install_executorch.sh --pybind xnnpack
491494
492495
# install llama requirements
493496
bash examples/models/llama/install_requirements.sh
@@ -514,7 +517,7 @@ jobs:
514517
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "cmake"
515518
516519
# install pybind
517-
bash install_requirements.sh --pybind xnnpack
520+
bash install_executorch.sh --pybind xnnpack
518521
519522
# install llama requirements
520523
bash examples/models/llama/install_requirements.sh

.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

backends/apple/coreml/test/test_coreml_partitioner.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717

1818
class TestCoreMLPartitioner(unittest.TestCase):
19-
# TODO(T182928844): Delegate dim order op to backend.
20-
edge_compile_config = executorch.exir.EdgeCompileConfig(_skip_dim_order=True)
19+
edge_compile_config = executorch.exir.EdgeCompileConfig()
2120

2221
def test_add_sub_skip_mm(self):
2322
class Model(torch.nn.Module):

backends/apple/mps/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ I 00:00:00.122615 executorch:mps_executor_runner.mm:501] Model verified successf
9797
### [Optional] Run the generated model directly using pybind
9898
1. Make sure `pybind` MPS support was installed:
9999
```bash
100-
./install_requirements.sh --pybind mps
100+
./install_executorch.sh --pybind mps
101101
```
102102
2. Run the `mps_example` script to trace the model and run it directly from python:
103103
```bash

backends/arm/_passes/annotate_channels_last_dim_order_pass.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 Arm Limited and/or its affiliates.
1+
# Copyright 2024-2025 Arm Limited and/or its affiliates.
22
# All rights reserved.
33
#
44
# This source code is licensed under the BSD-style license found in the
@@ -15,7 +15,7 @@
1515
get_node_arg,
1616
insert_q_dq_pair,
1717
)
18-
from executorch.backends.arm.tosa_quant_utils import dq_op, q_op, register_passable_op
18+
from executorch.backends.arm.tosa_quant_utils import dq_op, q_op
1919
from executorch.backends.arm.tosa_utils import is_consumer_node_depthwise_conv2d
2020
from executorch.exir.dialects._ops import ops as exir_ops
2121
from executorch.exir.pass_base import ExportPass, PassResult
@@ -43,9 +43,6 @@ def _transpose_impl(*args, **kwargs):
4343
return args[0]
4444

4545

46-
register_passable_op(torch.ops.passthrough_to_tosa._transpose)
47-
48-
4946
class AnnotateChannelsLastDimOrder(ExportPass):
5047
"""
5148
Annotates each node with a tosa_dim_order. tosa_dim_order can be seen as a channels-last dim-order

backends/arm/_passes/fold_qdq_with_annotated_qparams_pass.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,16 @@ def get_input_qparams(node: Node) -> dict[int, QuantArgs]:
3232
Raises a ValueError if the node doesn't have any parameters set.
3333
"""
3434
if "input_qparams" not in node.meta.keys():
35-
raise ValueError(f"No input quantization parameter found in node {node}")
35+
raise ValueError(
36+
f"No input quantization parameter found in node {node}\n"
37+
f"original_aten={node.meta.get('original_aten', 'None')}"
38+
)
3639
input_qparams = cast(dict[int, QuantArgs], node.meta["input_qparams"])
3740
if len(input_qparams) == 0:
38-
raise ValueError(f"No input quantization parameter found in node {node}")
41+
raise ValueError(
42+
f"No input quantization parameter found in node {node}\n"
43+
f"original_aten={node.meta.get('original_aten', 'None')}"
44+
)
3945
return input_qparams
4046

4147

@@ -45,11 +51,17 @@ def get_output_qparams(node: Node) -> dict[int, QuantArgs]:
4551
Raises a ValueError if the node doesn't have any parameters set.
4652
"""
4753
if "output_qparams" not in node.meta.keys():
48-
raise ValueError(f"No output quantization parameter found in node {node}")
49-
input_qparams = cast(dict[int, QuantArgs], node.meta["output_qparams"])
50-
if len(input_qparams) == 0:
51-
raise ValueError(f"No output quantization parameter found in node {node}")
52-
return input_qparams
54+
raise ValueError(
55+
f"No output quantization parameter found in node {node}\n"
56+
f"original_aten={node.meta.get('original_aten', 'None')}"
57+
)
58+
output_qparams = cast(dict[int, QuantArgs], node.meta["output_qparams"])
59+
if len(output_qparams) == 0:
60+
raise ValueError(
61+
f"No output quantization parameter found in node {node}\n"
62+
f"original_aten={node.meta.get('original_aten', 'None')}"
63+
)
64+
return output_qparams
5365

5466

5567
class FoldAndAnnotateQParamsPass(ExportPass):

backends/arm/_passes/fuse_quantized_activation_pass.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ def _is_fuseable_quantized_activation(self, node: Node):
1919
is_fuseable = min_val == 0
2020

2121
is_quantized = len(node.users) == 1 and next(iter(node.users)).target == q_op
22-
if is_quantized:
22+
if is_fuseable and is_quantized:
2323
quant_node = next(iter(node.users))
2424
zp = quant_node.args[2]
2525
qmin = quant_node.args[3]
26-
27-
return is_fuseable and is_quantized and zp == qmin
26+
return zp == qmin
27+
else:
28+
return False
2829

2930
def _is_fuseable_input(self, node: Node):
3031
return (

backends/arm/arm_backend.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def __init__(self):
5050
self.output_format = None
5151
self.path_for_intermediates = None
5252
self.tosa_version = None
53+
self.tosa_spec = None
5354
self.input_order = None
5455

5556
def ethosu_compile_spec(

0 commit comments

Comments
 (0)