Skip to content

Commit f9c31aa

Browse files
authored
Merge branch 'main' into bump-cmake-version
2 parents fec4801 + b9bb3c1 commit f9c31aa

File tree

68 files changed

+2189
-184
lines changed

Some content is hidden

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

68 files changed

+2189
-184
lines changed

.github/workflows/trunk.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,37 @@ jobs:
302302
exit 1
303303
fi
304304
305+
test-arm-ootb-linux:
306+
name: test-arm-ootb-linux
307+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
308+
permissions:
309+
id-token: write
310+
contents: read
311+
with:
312+
runner: linux.2xlarge
313+
docker-image: executorch-ubuntu-22.04-arm-sdk
314+
submodules: 'recursive'
315+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
316+
timeout: 90
317+
script: |
318+
# The generic Linux job chooses to use base env, not the one setup by the image
319+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
320+
conda activate "${CONDA_ENV}"
321+
322+
# Follow the steps required before running the notebooks
323+
# Try to mirror these as closely as possible
324+
source .ci/scripts/utils.sh
325+
install_executorch "--use-pt-pinned-commit"
326+
327+
.ci/scripts/setup-arm-baremetal-tools.sh
328+
source examples/arm/ethos-u-scratch/setup_path.sh
329+
330+
# Install requirements for converting notebooks
331+
pip install notebook
332+
333+
# Run OOTB tests
334+
backends/arm/test/test_arm_ootb.sh
335+
305336
test-coreml-delegate:
306337
name: test-coreml-delegate
307338
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main

CMakeLists.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
cmake_minimum_required(VERSION 3.29)
5151
project(executorch)
5252

53-
# MARK: - Start EXECUTORCH_H12025_BUILD_MIGRATION
54-
5553
include(${PROJECT_SOURCE_DIR}/tools/cmake/common/preset.cmake)
5654
include(${PROJECT_SOURCE_DIR}/tools/cmake/Utils.cmake)
5755
include(CMakeDependentOption)
@@ -84,6 +82,7 @@ announce_configured_options(BUCK2)
8482

8583
announce_configured_options(CMAKE_CXX_COMPILER_ID)
8684
announce_configured_options(CMAKE_TOOLCHAIN_FILE)
85+
announce_configured_options(BUILD_TESTING)
8786

8887
load_build_preset()
8988
include(${PROJECT_SOURCE_DIR}/tools/cmake/preset/default.cmake)
@@ -99,11 +98,6 @@ else()
9998
endif()
10099
announce_configured_options(CCACHE_PROGRAM)
101100

102-
# Print all the configs that were called with announce_configured_options.
103-
print_configured_options()
104-
105-
# MARK: - End EXECUTORCH_H12025_BUILD_MIGRATION
106-
107101
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
108102

109103
# Setup RPATH. See
@@ -752,3 +746,6 @@ if(EXECUTORCH_BUILD_ANDROID_JNI)
752746
endif()
753747

754748
include(Test.cmake)
749+
750+
# Print all the configs that were called with announce_configured_options.
751+
print_configured_options()

CMakePresets.json

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
},
99
{
1010
"name": "macos",
11-
"displayName": "Build everything buildable on macOS",
11+
"displayName": "Build ExecuTorch for macOS",
1212
"inherits": ["common"],
1313
"generator": "Xcode",
1414
"cacheVariables": {
1515
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/third-party/ios-cmake/ios.toolchain.cmake",
1616
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/macos.cmake",
1717
"PLATFORM": "MAC_ARM64",
18-
"DEPLOYMENT_TARGET": "12.0"
18+
"DEPLOYMENT_TARGET": "12.0",
19+
"CMAKE_MACOSX_BUNDLE": "OFF"
1920
},
2021
"condition": {
2122
"lhs": "${hostSystemName}",
@@ -25,7 +26,7 @@
2526
},
2627
{
2728
"name": "ios",
28-
"displayName": "Build everything buildable on iOS",
29+
"displayName": "Build ExecuTorch for iOS",
2930
"inherits": ["common"],
3031
"generator": "Xcode",
3132
"cacheVariables": {
@@ -42,7 +43,7 @@
4243
},
4344
{
4445
"name": "ios-simulator",
45-
"displayName": "Build everything buildable on iOS simulator",
46+
"displayName": "Build ExecuTorch for iOS Simulator",
4647
"inherits": ["common"],
4748
"generator": "Xcode",
4849
"cacheVariables": {
@@ -59,7 +60,7 @@
5960
},
6061
{
6162
"name": "linux",
62-
"displayName": "Build everything buildable on Linux",
63+
"displayName": "Build ExecuTorch for Linux",
6364
"inherits": ["common"],
6465
"cacheVariables": {
6566
"CMAKE_SYSTEM_NAME": "Linux",
@@ -88,29 +89,21 @@
8889
{
8990
"name": "llm",
9091
"displayName": "Build LLM libraries",
91-
"inherits": [
92-
"common"
93-
],
92+
"inherits": ["common"],
9493
"cacheVariables": {
9594
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/llm.cmake",
9695
"CMAKE_OSX_DEPLOYMENT_TARGET": "12.0"
9796
},
9897
"condition": {
9998
"type": "inList",
10099
"string": "${hostSystemName}",
101-
"list": [
102-
"Darwin",
103-
"Linux",
104-
"Windows"
105-
]
100+
"list": ["Darwin", "Linux", "Windows"]
106101
}
107102
},
108103
{
109104
"name": "zephyr",
110-
"displayName": "Build everything buildable on Zephyr RTOS",
111-
"inherits": [
112-
"common"
113-
],
105+
"displayName": "Build ExecuTorch for Zephyr RTOS",
106+
"inherits": ["common"],
114107
"cacheVariables": {
115108
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/zephyr.cmake",
116109
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake"

backends/arm/_passes/decompose_asin_pass.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ def _build_polynomial(
8585
return result
8686

8787
def call_operator(self, op, args, kwargs, meta):
88+
if op not in edge_asin_op:
89+
return super().call_operator(op, args, kwargs, meta)
8890
logging.info(
8991
f"Approximating asin. This may introduce small numerical errors. For details, see {__file__}."
9092
)
91-
if op not in edge_asin_op:
92-
return super().call_operator(op, args, kwargs, meta)
93-
9493
x = args[0]
9594
half = 0.5
9695
one = 1.0

backends/arm/test/ops/test_add.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,5 @@ def test_add_tensor_vgf_int(test_data: input_t1):
205205
aten_op,
206206
exir_op,
207207
tosa_version="TOSA-1.0+INT",
208-
symmetric_io_quantization=True,
209208
)
210209
pipeline.run()

backends/arm/test/test_arm_ootb.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2025 Arm Limited and/or its affiliates.
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 -e
9+
10+
run_ootb_tests_ethos_u() {
11+
echo "$FUNCNAME: Running out-of-the-box tests for Arm Ethos-U"
12+
jupyter nbconvert \
13+
--to notebook \
14+
--execute examples/arm/ethos_u_minimal_example.ipynb
15+
echo "${FUNCNAME}: PASS"
16+
}
17+
18+
run_ootb_tests_ethos_u

backends/arm/test/tester/arm_tester.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
EthosUQuantizer,
4444
get_symmetric_quantization_config,
4545
TOSAQuantizer,
46+
VgfQuantizer,
4647
)
4748
from executorch.backends.arm.test.runner_utils import (
4849
dbg_tosa_fb_to_json,
@@ -332,6 +333,8 @@ def quantize(
332333
quantizer = TOSAQuantizer(tosa_spec)
333334
elif is_ethosu(self.compile_spec):
334335
quantizer = EthosUQuantizer(self.compile_spec)
336+
elif is_vgf(self.compile_spec):
337+
quantizer = VgfQuantizer(self.compile_spec)
335338
quantize_stage = tester.Quantize(
336339
quantizer,
337340
get_symmetric_quantization_config(),

backends/arm/test/tester/test_pipeline.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -861,18 +861,15 @@ def __init__(
861861
rtol: float = 1e-03,
862862
qtol: int = 1,
863863
dynamic_shapes: Optional[Tuple[Any]] = None,
864+
transform_passes: Optional[
865+
Union[Sequence[PassType], Dict[str, Sequence[PassType]]]
866+
] = None,
864867
):
865868

866869
if (
867870
symmetric_io_quantization or per_channel_quantization
868871
) and tosa_version == "TOSA-1.0+FP":
869872
raise ValueError("Dont configure quantization with FP TOSA profile.")
870-
if (
871-
symmetric_io_quantization is False
872-
and per_channel_quantization is False
873-
and tosa_version == "TOSA-1.0+INT"
874-
):
875-
raise ValueError("Missing quantization options for INT TOSA profile.")
876873

877874
tosa_profile = TosaSpecification.create_from_string(tosa_version)
878875
compile_spec = common.get_vgf_compile_spec(
@@ -887,6 +884,7 @@ def __init__(
887884
exir_op,
888885
use_to_edge_transform_and_lower,
889886
dynamic_shapes,
887+
transform_passes=transform_passes,
890888
)
891889

892890
if symmetric_io_quantization or per_channel_quantization:
@@ -900,7 +898,7 @@ def __init__(
900898
else:
901899
quant_stage = None
902900

903-
if quant_stage:
901+
if "INT" in tosa_version:
904902
self.add_stage(self.tester.quantize, quant_stage, pos=0)
905903

906904
self.add_stage_after(

backends/cadence/aot/TARGETS

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,19 @@ python_library(
199199
],
200200
)
201201

202+
python_unittest(
203+
name = "test_program_builder",
204+
srcs = [
205+
"tests/test_program_builder.py",
206+
],
207+
typing = True,
208+
deps = [
209+
":program_builder",
210+
"//caffe2:torch",
211+
"//later:lib",
212+
],
213+
)
214+
202215
python_library(
203216
name = "fuse_ops",
204217
srcs = [
@@ -539,8 +552,10 @@ python_unittest(
539552
],
540553
typing = True,
541554
deps = [
555+
":program_builder",
542556
"//executorch/backends/cadence/aot:graph_builder",
543557
"//executorch/backends/cadence/aot:ops_registrations",
558+
"//executorch/runtime:runtime",
544559
"//later:lib",
545560
],
546561
)

backends/cadence/aot/compiler.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
)
3535
from executorch.exir.passes import ToOutVarPass
3636
from executorch.exir.passes.sym_shape_eval_pass import HintBasedSymShapeEvalPass
37-
from executorch.exir.program._program import to_edge_with_preserved_ops
37+
from executorch.exir.program._program import to_edge
3838
from torch._inductor.decomposition import remove_decompositions
3939

4040
from torch.export.exported_program import ExportedProgram
@@ -219,9 +219,9 @@ def quantize_pt2(
219219
torch.ops.aten.angle.default,
220220
torch.ops.aten.rms_norm.default,
221221
]
222-
TO_EDGE_PRESERVE_OPS: tuple[torch._ops.OpOverload, ...] = (
222+
TO_EDGE_PRESERVE_OPS: list[torch._ops.OpOverload, ...] = [
223223
torch.ops.aten.rms_norm.default,
224-
)
224+
]
225225

226226

227227
def _lower_ep_to_edge(
@@ -233,18 +233,18 @@ def _lower_ep_to_edge(
233233
"""
234234
Lower an ExportedProgram to an EdgeProgramManager (in edge IR).
235235
"""
236-
# Call to_edge_with_preserved_ops to convert the graph to edge IR.
236+
# Call to_edge to convert the graph to edge IR.
237237
# Note: dim_order is skipped (https://github.com/pytorch/executorch/issues/3704)
238-
edge_prog_manager = to_edge_with_preserved_ops(
238+
edge_prog_manager = to_edge(
239239
expo_program,
240240
compile_config=EdgeCompileConfig(
241241
_skip_dim_order=True,
242242
# Allow specific non-core aten ops in the IR.
243243
_core_aten_ops_exception_list=TO_EDGE_OP_EXCEPTION_LIST
244244
+ (core_aten_exceptions or []),
245+
preserve_ops=TO_EDGE_PRESERVE_OPS,
245246
),
246247
constant_methods=constant_methods,
247-
preserve_ops=TO_EDGE_PRESERVE_OPS,
248248
)
249249

250250
if dump_graphs:

0 commit comments

Comments
 (0)