Skip to content

Commit 60732a0

Browse files
committed
Update on "[ExecuTorch] Arm Ethos: Buckify Linear operator tests"
As title. Differential Revision: [D70018299](https://our.internmc.facebook.com/intern/diff/D70018299/) [ghstack-poisoned]
2 parents 0b83772 + 101b949 commit 60732a0

File tree

120 files changed

+1510
-1145
lines changed

Some content is hidden

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

120 files changed

+1510
-1145
lines changed

.Package.swift/backend_coreml/dummy.swift

Whitespace-only changes.

.Package.swift/backend_coreml_debug/dummy.swift

Whitespace-only changes.

.Package.swift/backend_mps/dummy.swift

Whitespace-only changes.

.Package.swift/backend_mps_debug/dummy.swift

Whitespace-only changes.

.Package.swift/backend_xnnpack/dummy.swift

Whitespace-only changes.

.Package.swift/backend_xnnpack_debug/dummy.swift

Whitespace-only changes.

.Package.swift/executorch/dummy.swift

Whitespace-only changes.

.Package.swift/executorch_debug/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_custom/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_custom_debug/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_optimized/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_optimized_debug/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_portable/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_portable_debug/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_quantized/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_quantized_debug/dummy.swift

Whitespace-only changes.

.github/workflows/_android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
3030
3131
# Build LLM Demo for Android
32-
bash build/build_android_llm_demo.sh ${ARTIFACTS_DIR_NAME}
32+
bash build/build_android_library.sh ${ARTIFACTS_DIR_NAME}
3333
3434
# Running Android emulator directly on the runner and not using Docker
3535
run-emulator:

.github/workflows/android-perf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ jobs:
363363
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
364364
365365
export ANDROID_ABIS="arm64-v8a"
366-
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}
366+
PYTHON_EXECUTABLE=python EXECUTORCH_BUILD_QNN=ON QNN_SDK_ROOT=/tmp/qnn/2.28.0.241029 bash build/build_android_library.sh ${ARTIFACTS_DIR_NAME}
367367
368368
# Let's see how expensive this job is, we might want to tone it down by running it periodically
369369
benchmark-on-device:

.github/workflows/android-release-artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
5454
5555
# Build LLM Demo for Android
56-
bash build/build_android_llm_demo.sh ${ARTIFACTS_DIR_NAME}
56+
bash build/build_android_library.sh ${ARTIFACTS_DIR_NAME}
5757
5858
shasum -a 256 "${ARTIFACTS_DIR_NAME}/llm_demo/executorch.aar"
5959

.github/workflows/apple.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,24 +170,14 @@ jobs:
170170
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
171171
backends/apple/mps/install_requirements.sh
172172
173-
# Build Release iOS Frameworks
173+
# Build iOS Frameworks
174174
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
175-
build/build_apple_frameworks.sh --coreml --custom --mps --optimized --portable --quantized --xnnpack
175+
build/build_apple_frameworks.sh --Release --Debug --coreml --custom --mps --optimized --portable --quantized --xnnpack
176176
177-
# Bundle Release iOS Frameworks
177+
# Bundle iOS Frameworks
178178
for FRAMEWORK in "${FRAMEWORKS[@]}"; do (
179179
cd cmake-out && \
180180
zip -r "${RUNNER_TEMP}/artifacts/${FRAMEWORK}-${VERSION}.zip" "${FRAMEWORK}.xcframework"
181-
) done
182-
183-
# Build Debug iOS Frameworks
184-
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
185-
build/build_apple_frameworks.sh --coreml --custom --mps --optimized --portable --quantized --xnnpack --Debug
186-
187-
# Bundle Debug iOS Frameworks
188-
for FRAMEWORK in "${FRAMEWORKS[@]}"; do (
189-
cd cmake-out && \
190-
mv "${FRAMEWORK}.xcframework" "${FRAMEWORK}_debug.xcframework" && \
191181
zip -r "${RUNNER_TEMP}/artifacts/${FRAMEWORK}_debug-${VERSION}.zip" "${FRAMEWORK}_debug.xcframework"
192182
) done
193183

.gitignore

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,38 @@
1+
# System files
2+
.DS_Store
3+
4+
# Python environment and cache
15
.hypothesis
2-
buck-out/
36
.mypy_cache/
7+
.venv/
8+
__pycache__/
9+
10+
# Build and tool-generated files
11+
buck-out/
412
buck2-bin/
5-
cmake-out*
6-
.DS_Store
713
cmake-android-out/
8-
cmake-out-android/
914
cmake-ios-out/
15+
cmake-out*
16+
cmake-out-android/
1017
ethos-u-scratch/
1118
executorch.egg-info
1219
pip-out/
13-
__pycache__/
1420

1521
# Any exported models and profiling outputs
16-
*.pte
17-
*.model
18-
!test_tiktoken_tokenizer.model
1922
*.bin
23+
*.model
24+
*.pte
2025
!test_bpe_tokenizer.bin
26+
!test_tiktoken_tokenizer.model
2127

2228
# Editor temporaries
23-
*.swa
24-
*.swb
25-
*.swc
26-
*.swd
27-
*.swe
28-
*.swf
29-
*.swg
30-
*.swh
31-
*.swi
32-
*.swj
33-
*.swk
34-
*.swl
35-
*.swm
36-
*.swn
37-
*.swo
38-
*.swp
29+
*.idea
30+
*.sw[a-z]
3931
*~
4032
.~lock.*
41-
*.idea
33+
34+
# Xcode
35+
xcuserdata/
36+
.swiftpm/
37+
*.xcworkspace/
38+
*.xcframework/

Package.swift

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// swift-tools-version:5.9
2+
/*
3+
* Copyright (c) Meta Platforms, Inc. and affiliates.
4+
* All rights reserved.
5+
*
6+
* This source code is licensed under the BSD-style license found in the
7+
* LICENSE file in the root directory of this source tree.
8+
*/
9+
10+
// NOTE: This package manifest is for frameworks built locally with CMake.
11+
// It defines dependencies and linker settings for Executorch components.
12+
//
13+
// To use prebuilt binaries instead, switch to one of the "swiftpm" branches,
14+
// which fetch the precompiled `.xcframeworks`.
15+
//
16+
// For details on building frameworks locally or using prebuilt binaries,
17+
// see the documentation:
18+
// https://pytorch.org/executorch/main/using-executorch-ios.html
19+
20+
import PackageDescription
21+
22+
let debug = "_debug"
23+
let deliverables = [
24+
"backend_coreml": [
25+
"frameworks": [
26+
"Accelerate",
27+
"CoreML",
28+
],
29+
"libraries": [
30+
"sqlite3",
31+
],
32+
],
33+
"backend_mps": [
34+
"frameworks": [
35+
"Metal",
36+
"MetalPerformanceShaders",
37+
"MetalPerformanceShadersGraph",
38+
],
39+
],
40+
"backend_xnnpack": [:],
41+
"executorch": [:],
42+
"kernels_custom": [:],
43+
"kernels_optimized": [:],
44+
"kernels_portable": [:],
45+
"kernels_quantized": [:],
46+
].reduce(into: [String: [String: Any]]()) {
47+
$0[$1.key] = $1.value
48+
$0[$1.key + debug] = $1.value
49+
}.reduce(into: [String: [String: Any]]()) {
50+
var newValue = $1.value
51+
if $1.key.hasSuffix(debug) {
52+
$1.value.forEach { key, value in
53+
if key.hasSuffix(debug) {
54+
newValue[String(key.dropLast(debug.count))] = value
55+
}
56+
}
57+
}
58+
$0[$1.key] = newValue.filter { key, _ in !key.hasSuffix(debug) }
59+
}
60+
61+
let package = Package(
62+
name: "executorch",
63+
platforms: [
64+
.iOS(.v17),
65+
.macOS(.v10_15),
66+
],
67+
products: deliverables.keys.map { key in
68+
.library(name: key, targets: ["\(key)_dependencies"])
69+
}.sorted { $0.name < $1.name },
70+
targets: deliverables.flatMap { key, value -> [Target] in
71+
[
72+
.binaryTarget(
73+
name: key,
74+
path: "cmake-out/\(key).xcframework"
75+
),
76+
.target(
77+
name: "\(key)_dependencies",
78+
dependencies: [.target(name: key)],
79+
path: ".Package.swift/\(key)",
80+
linkerSettings:
81+
(value["frameworks"] as? [String] ?? []).map { .linkedFramework($0) } +
82+
(value["libraries"] as? [String] ?? []).map { .linkedLibrary($0) }
83+
),
84+
]
85+
}
86+
)

backends/arm/TARGETS

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# @noautodeps
22
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
3-
43
python_library(
54
name = "arm_partitioner",
65
srcs = [
@@ -9,21 +8,18 @@ python_library(
98
"tosa_backend.py",
109
"tosa_partitioner.py",
1110
],
12-
typing = True,
1311
deps = [
1412
":arm_backend",
1513
"//executorch/backends/arm/operator_support:operator_support",
1614
"//executorch/backends/arm/_passes:passes",
1715
"//executorch/exir:lib",
1816
],
1917
)
20-
2118
python_library(
2219
name = "arm_backend",
2320
srcs = [
2421
"arm_backend.py",
2522
],
26-
typing = True,
2723
deps = [
2824
"fbsource//third-party/pypi/flatbuffers:flatbuffers",
2925
"fbsource//third-party/pypi/ml-dtypes:ml-dtypes",
@@ -36,11 +32,9 @@ python_library(
3632
"//executorch/backends/arm/_passes:passes",
3733
],
3834
)
39-
4035
python_library(
4136
name = "process_node",
4237
srcs = ["process_node.py"],
43-
typing = True,
4438
deps = [
4539
"fbsource//third-party/serialization_lib/python/tosa:tosa",
4640
"//executorch/backends/arm/operators:node_visitor",
@@ -50,36 +44,30 @@ python_library(
5044
"//executorch/exir:lib",
5145
],
5246
)
53-
5447
python_library(
5548
name = "arm_vela",
5649
srcs = [
5750
"arm_vela.py",
5851
],
59-
typing = True,
6052
deps = [
6153
"fbsource//third-party/pypi/ethos-u-vela:ethos-u-vela",
6254
],
6355
)
64-
6556
python_library(
6657
name = "tosa_mapping",
6758
srcs = [
6859
"tosa_mapping.py",
6960
],
70-
typing = True,
7161
deps = [
7262
"fbsource//third-party/serialization_lib/python/serializer:serializer",
7363
"//caffe2:torch",
7464
],
7565
)
76-
7766
python_library(
7867
name = "tosa_quant_utils",
7968
srcs = [
8069
"tosa_quant_utils.py",
8170
],
82-
typing = True,
8371
deps = [
8472
"fbsource//third-party/pypi/numpy:numpy",
8573
"fbsource//third-party/serialization_lib/python/serializer:serializer",
@@ -88,38 +76,32 @@ python_library(
8876
"//executorch/exir/dialects:lib",
8977
],
9078
)
91-
9279
python_library(
9380
name = "tosa_specification",
9481
srcs = [
9582
"tosa_specification.py",
9683
],
97-
typing = True,
9884
deps = [
9985
"fbsource//third-party/pypi/packaging:packaging",
10086
"//executorch/exir/backend:compile_spec_schema",
10187
],
10288
)
103-
10489
python_library(
10590
name = "tosa_utils",
10691
srcs = [
10792
"tosa_utils.py",
10893
],
109-
typing = True,
11094
deps = [
11195
"fbsource//third-party/serialization_lib/python/serializer:serializer",
11296
":tosa_quant_utils",
11397
"//executorch/backends/arm/operators:node_visitor",
11498
],
11599
)
116-
117100
python_library(
118101
name = "arm_model_evaluator",
119102
srcs = [
120103
"util/arm_model_evaluator.py",
121104
],
122-
typing = True,
123105
deps = [
124106
"//caffe2:torch",
125107
]

backends/arm/_passes/TARGETS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
33
python_library(
44
name = "passes",
55
srcs = glob(["*.py"]),
6-
typing = True,
76
deps = [
87
"//executorch/backends/arm:tosa_quant_utils",
98
"//executorch/backends/arm:tosa_utils",

backends/arm/operator_support/TARGETS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
33
python_library(
44
name = "operator_support",
55
srcs = glob(["*.py"]),
6-
typing = True,
76
deps = [
87
"//executorch/backends/arm/_passes:passes",
98
"//executorch/backends/arm:tosa_specification",

backends/arm/operator_support/pool_2d_support.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def stride_check(strides: tuple[int, int]) -> bool:
2626

2727

2828
def dim_check(shape=torch.Size) -> bool:
29-
check = shape[0] == 1
30-
for dim in shape:
29+
check = True
30+
for dim in shape[1:]:
3131
check &= 1 <= dim <= 65536
3232
return check
3333

@@ -59,7 +59,7 @@ def is_node_tosa_supported(self, node: fx.Node, tosa_spec: TosaSpecification):
5959
if not kernel_check(kernel):
6060
return False
6161

62-
return dim_check(shape) and stride_check(stride)
62+
return dim_check(shape) and shape[0] == 1 and stride_check(stride)
6363

6464

6565
@register_tosa_support_check

backends/arm/operators/TARGETS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
44
python_library(
55
name = "node_visitor",
66
srcs = ["node_visitor.py"],
7-
typing = True,
87
deps = [
98
"//executorch/backends/arm:tosa_mapping",
109
"//executorch/backends/arm:tosa_specification",
@@ -14,7 +13,6 @@ python_library(
1413
python_library(
1514
name = "ops",
1615
srcs = glob(["op_*.py", "ops_*.py"]),
17-
typing = True,
1816
deps = [
1917
"fbsource//third-party/serialization_lib/python/tosa:tosa",
2018
":node_visitor",
@@ -29,7 +27,6 @@ python_library(
2927
python_library(
3028
name = "lib",
3129
srcs = ["__init__.py"],
32-
typing = True,
3330
deps = [
3431
":node_visitor",
3532
":ops",

0 commit comments

Comments
 (0)