Skip to content

Commit 6d8583d

Browse files
authored
Migrate from cpp_python_extension to runtime.cxx_python_extension (#14154)
We should be going through the runtime_wrapper for everything IIUC. Differential Revision: [D82127664](https://our.internmc.facebook.com/intern/diff/D82127664)
1 parent 0e3d6d3 commit 6d8583d

File tree

16 files changed

+75
-30
lines changed

16 files changed

+75
-30
lines changed

.ci/scripts/unittest-buck2.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ set -eux
99
# TODO: expand this to //...
1010
# TODO: can't query cadence & vulkan backends
1111
# TODO: can't query //kernels/prim_ops because of non-buckified stuff in OSS.
12-
buck2 query "//backends/apple/... + //backends/example/... + \
12+
# TODO: Make //backends/arm tests use runtime wrapper so we can just query //backends/arm/...
13+
buck2 query "//backends/apple/... + //backends/arm: + //backends/arm/debug/... + \
14+
//backends/arm/operator_support/... + //backends/arm/operators/... + \
15+
//backends/arm/_passes/... + //backends/arm/runtime/... + //backends/arm/tosa/... \
16+
+ //backends/example/... + \
1317
//backends/mediatek/... + //backends/transforms/... + \
1418
//backends/xnnpack/... + //configurations/... + //extension/flat_tensor: + \
1519
//extension/llm/runner: + //kernels/aten/... + //kernels/optimized/... + \

backends/arm/TARGETS

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ runtime.python_library(
1414
"ethosu/partitioner.py"
1515
],
1616
deps = [
17-
":arm_partitioner",
17+
":arm_vela",
18+
"//executorch/backends/arm/tosa:arm_partitioner",
1819
]
1920
)
2021
runtime.python_library(
@@ -25,7 +26,7 @@ runtime.python_library(
2526
"vgf/partitioner.py"
2627
],
2728
deps = [
28-
":arm_partitioner",
29+
"//executorch/backends/arm/tosa:arm_partitioner",
2930
]
3031
)
3132
runtime.python_library(
@@ -50,21 +51,6 @@ runtime.python_library(
5051
"//executorch/exir:lib",
5152
],
5253
)
53-
runtime.python_library(
54-
name = "arm_partitioner",
55-
srcs = [
56-
"tosa/backend.py",
57-
"tosa/partitioner.py",
58-
],
59-
deps = [
60-
":arm_backend",
61-
":constants",
62-
"//executorch/backends/arm/debug:schema",
63-
"//executorch/backends/arm/operator_support:operator_support",
64-
"//executorch/backends/arm/_passes:passes",
65-
"//executorch/exir:lib",
66-
],
67-
)
6854
runtime.python_library(
6955
name = "arm_backend",
7056
srcs = [
@@ -77,7 +63,6 @@ runtime.python_library(
7763
"fbsource//third-party/tosa_tools/v1.00/serialization_lib/python/serializer:serializer",
7864
"fbsource//third-party/tosa_tools/v0.80/serialization_lib/python/tosa:tosa",
7965
"fbsource//third-party/tosa_tools/v1.00/serialization_lib/python/tosa:tosa",
80-
":arm_vela",
8166
":process_node",
8267
"//executorch/backends/arm/operators:lib",
8368
"//executorch/backends/arm/operators:node_visitor",

backends/arm/tosa/TARGETS

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,20 @@ runtime.python_library(
5959
":specification",
6060
],
6161
)
62+
63+
runtime.python_library(
64+
name = "arm_partitioner",
65+
srcs = [
66+
"backend.py",
67+
"partitioner.py",
68+
],
69+
deps = [
70+
"//executorch/backends/arm:arm_backend",
71+
"//executorch/backends/arm:constants",
72+
"//executorch/backends/arm:process_node",
73+
"//executorch/backends/arm/debug:schema",
74+
"//executorch/backends/arm/operator_support:operator_support",
75+
"//executorch/backends/arm/_passes:passes",
76+
"//executorch/exir:lib",
77+
],
78+
)

backends/cadence/aot/TARGETS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ load(
1212
"CXX",
1313
)
1414
load("@fbsource//xplat/executorch/codegen:codegen.bzl", "executorch_generated_lib")
15-
load("@fbcode_macros//build_defs:cpp_python_extension.bzl", "cpp_python_extension")
1615

1716
oncall("odai_jarvis")
1817

codegen/tools/targets.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ def define_common_targets(is_fbcode = False):
1717
],
1818
deps = [
1919
"//executorch/codegen:gen_lib",
20-
] + select({
20+
] + ([] if runtime.is_oss else select({
2121
"DEFAULT": [],
22-
"ovr_config//os:linux": [] if runtime.is_oss else ["//executorch/codegen/tools:selective_build"], # TODO(larryliu0820) :selective_build doesn't build in OSS yet
23-
}),
22+
"ovr_config//os:linux": ["//executorch/codegen/tools:selective_build"], # TODO(larryliu0820) :selective_build doesn't build in OSS yet
23+
})),
2424
)
2525

2626
runtime.python_binary(

devtools/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ oncall("executorch")
55
runtime.python_library(
66
name = "lib",
77
srcs = ["__init__.py"],
8+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
89
deps = [
910
"//executorch/devtools/bundled_program:core",
1011
"//executorch/devtools/etrecord:etrecord",

exir/TARGETS

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ runtime.python_library(
77
srcs = [
88
"tracer.py",
99
],
10+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
1011
deps = [
1112
"fbsource//third-party/pypi/typing-extensions:typing-extensions",
1213
":common",
@@ -46,13 +47,15 @@ runtime.python_library(
4647
srcs = [
4748
"scalar_type.py",
4849
],
50+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
4951
)
5052

5153
runtime.python_library(
5254
name = "schema",
5355
srcs = [
5456
"schema.py",
5557
],
58+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
5659
deps = [
5760
":scalar_type",
5861
"//executorch/exir/backend:compile_spec_schema",
@@ -71,6 +74,7 @@ runtime.python_library(
7174
srcs = [
7275
"tensor.py",
7376
],
77+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
7478
deps = [
7579
":error",
7680
":schema",
@@ -84,6 +88,7 @@ runtime.python_library(
8488
srcs = [
8589
"memory.py",
8690
],
91+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
8792
deps = [
8893
"fbsource//third-party/pypi/typing-extensions:typing-extensions",
8994
":tensor",
@@ -111,6 +116,7 @@ runtime.python_library(
111116
"delegate.py",
112117
"delegate.pyi",
113118
],
119+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
114120
deps = [
115121
"//caffe2:torch",
116122
],
@@ -140,6 +146,7 @@ runtime.python_library(
140146
srcs = [
141147
"__init__.py",
142148
],
149+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
143150
deps = [
144151
":tracer",
145152
"//caffe2:torch",
@@ -155,6 +162,7 @@ runtime.python_library(
155162
srcs = [
156163
"memory_planning.py",
157164
],
165+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
158166
deps = [
159167
":control_flow",
160168
":delegate",
@@ -213,6 +221,7 @@ runtime.python_library(
213221
srcs = [
214222
"print_program.py",
215223
],
224+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
216225
deps = [
217226
":error",
218227
":schema",
@@ -225,13 +234,15 @@ runtime.python_library(
225234
srcs = [
226235
"dynamic_shape.py",
227236
],
237+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
228238
)
229239

230240
runtime.python_library(
231241
name = "pass_base",
232242
srcs = [
233243
"pass_base.py",
234244
],
245+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
235246
deps = [
236247
":delegate",
237248
":error",
@@ -246,6 +257,7 @@ runtime.python_library(
246257
srcs = [
247258
"pass_manager.py",
248259
],
260+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
249261
deps = [
250262
"fbsource//third-party/pypi/typing-extensions:typing-extensions",
251263
":error",

exir/_serialize/TARGETS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
load("@fbcode_macros//build_defs:cpp_python_extension.bzl", "cpp_python_extension")
21
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
32

43
oncall("executorch")
54

65
# TODO(T157145817): Update other flatbuffer serializers to use flatc like
76
# _flatbuffer.py does, and remove this.
8-
cpp_python_extension(
7+
runtime.cxx_python_extension(
98
name = "_bindings",
109
srcs = [
1110
"bindings.cpp",

exir/dialects/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ runtime.python_library(
1010
resources = {
1111
"//executorch/exir/dialects/edge:edge_yaml": "edge.yaml",
1212
},
13+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
1314
deps = [
1415
"//caffe2:torch",
1516
"//caffe2/torchgen:torchgen",

exir/dialects/edge/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ runtime.python_library(
1111
resources = {
1212
":edge_yaml": "edge.yaml",
1313
},
14+
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"]
1415
deps = [
1516
"fbsource//third-party/pypi/ruamel-yaml:ruamel-yaml",
1617
"fbsource//third-party/pypi/setuptools:setuptools",

0 commit comments

Comments
 (0)