Skip to content

Commit 6655b42

Browse files
bigfootjonmeta-codesync[bot]
authored andcommitted
promote TARGETS content into placeholder BUCK files
Summary: Chunk 4 of fbcode/executorch TARGETS->BUCK migration. 9 directories where TARGETS contained the real fbcode-side build rules and BUCK was a tiny placeholder (most were 4-8 lines like 'empty BUCK file to unblock landing'). Each TARGETS was scanned for fbcode-only constructs (`fbcode_macros`, `fbcode_target(`, `cpp_unittest(`, `cpp_library(`, `cpp_binary(`, `re_test_utils`, `keep_gpu_sections`, `buck_genrule`, `//tools/build/buck/`) and only those without any of those flags are migrated here. The TARGETS content is copied into BUCK (overwriting the placeholder) and the TARGETS file is deleted. fbcode now resolves these dirs via BUCK instead of TARGETS; the rules also become visible to xplat for the first time via dirsync. Directories migrated: - backends/apple/mps - backends/xnnpack/serialization - devtools/bundled_program - devtools/bundled_program/schema - devtools/etdump/fb - exir/emit - extension/pytree - extension/training - kernels/portable/test 8 PROMOTE candidates remain on TARGETS for follow-up: backends/cortex_m/test, examples/models/llama/fb, examples/qualcomm/oss_scripts/{llama,whisper}, exir/dialects/edge/test, exir/tests, kernels/fb/custom_ops, test/end2end. They have fbcode-only loads (`fbcode_macros`) or kwargs and need `is_fbcode()` gating. Differential Revision: D109082058
1 parent 6af83be commit 6655b42

16 files changed

Lines changed: 280 additions & 341 deletions

File tree

backends/apple/mps/BUCK

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,95 @@
44
#
55

66
# Any targets that should be shared between fbcode and xplat must be defined in
7-
# targets.bzl. This file can contain xplat-only targets.
7+
# targets.bzl. This file can contain fbcode-only targets.
88

9-
load("@fbsource//tools/build_defs:default_platform_defs.bzl", "APPLE")
9+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
1010
load(":targets.bzl", "define_common_targets")
1111

1212
oncall("executorch")
1313

14-
define_common_targets(
15-
is_xplat = True,
16-
platforms = [APPLE],
14+
define_common_targets()
15+
16+
runtime.python_library(
17+
name = "backend",
18+
srcs = [
19+
"__init__.py",
20+
"mps_preprocess.py",
21+
],
22+
visibility = ["PUBLIC"],
23+
deps = [
24+
":operators",
25+
":serialization",
26+
":utils",
27+
"//caffe2:torch",
28+
"//executorch/exir/backend:backend_details",
29+
"//executorch/exir/backend:compile_spec_schema",
30+
],
31+
)
32+
33+
runtime.python_library(
34+
name = "operators",
35+
srcs = glob([
36+
"operators/*.py",
37+
]),
38+
deps = [
39+
":serialization",
40+
":utils",
41+
"//executorch/backends/transforms:lib",
42+
],
43+
)
44+
45+
runtime.python_library(
46+
name = "partitioner",
47+
srcs = glob([
48+
"partition/*.py",
49+
]),
50+
visibility = ["PUBLIC"],
51+
deps = [
52+
":backend",
53+
"//caffe2:torch",
54+
"//executorch/exir/backend:compile_spec_schema",
55+
"//executorch/exir/backend:partitioner",
56+
"//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib",
57+
],
58+
)
59+
60+
runtime.python_library(
61+
name = "serialization",
62+
srcs = glob([
63+
"serialization/*.py",
64+
]),
65+
resources = [
66+
"serialization/schema.fbs",
67+
],
68+
)
69+
70+
runtime.python_library(
71+
name = "utils",
72+
srcs = glob([
73+
"utils/*.py",
74+
]),
75+
deps = [
76+
":serialization",
77+
"//caffe2:torch",
78+
"//executorch/exir:lib",
79+
],
80+
)
81+
82+
runtime.python_test(
83+
name = "test",
84+
srcs = glob([
85+
"test/*.py",
86+
]),
87+
deps = [
88+
":backend",
89+
":partitioner",
90+
"//caffe2:torch",
91+
"//executorch/examples/models:models",
92+
"//executorch/exir/tests:models",
93+
"//executorch/extension/export_util:export_util",
94+
"//executorch/devtools:lib",
95+
"//executorch/devtools/bundled_program/serialize:lib",
96+
"fbsource//third-party/pypi/pytest:pytest",
97+
],
1798
)

backends/apple/mps/TARGETS

Lines changed: 0 additions & 98 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
12
load(":targets.bzl", "define_common_targets")
23

4+
oncall("executorch")
5+
36
define_common_targets()
7+
8+
runtime.python_library(
9+
name = "xnnpack_schema",
10+
srcs = [
11+
"xnnpack_graph_schema.py",
12+
],
13+
visibility = ["PUBLIC"],
14+
)
15+
16+
runtime.python_library(
17+
name = "xnnpack_serializer",
18+
srcs = [
19+
"xnnpack_graph_serialize.py",
20+
],
21+
resources = [
22+
"schema.fbs",
23+
],
24+
visibility = ["PUBLIC"],
25+
deps = [
26+
":xnnpack_schema",
27+
"//executorch/exir/_serialize:lib",
28+
],
29+
)

backends/xnnpack/serialization/TARGETS

Lines changed: 0 additions & 29 deletions
This file was deleted.

devtools/bundled_program/BUCK

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
12
load(":targets.bzl", "define_common_targets")
23

34
oncall("executorch")
45

56
define_common_targets()
7+
8+
runtime.python_library(
9+
name = "core",
10+
srcs = [
11+
"core.py",
12+
],
13+
visibility = ["PUBLIC"],
14+
deps = [
15+
":config",
16+
":version",
17+
"//caffe2:torch",
18+
"//executorch/devtools/bundled_program/schema:bundled_program_schema_py",
19+
"//executorch/exir:schema",
20+
"//executorch/exir:tensor",
21+
],
22+
)
23+
24+
runtime.python_library(
25+
name = "config",
26+
srcs = [
27+
"config.py",
28+
],
29+
visibility = ["PUBLIC"],
30+
deps = [
31+
"fbsource//third-party/pypi/typing-extensions:typing-extensions",
32+
"//caffe2:torch",
33+
],
34+
)
35+
36+
runtime.python_library(
37+
name = "version",
38+
srcs = [
39+
"version.py",
40+
],
41+
visibility = [
42+
"//executorch/devtools/...",
43+
],
44+
)

devtools/bundled_program/TARGETS

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
# Any targets that should be shared between fbcode and xplat must be defined in
2-
# targets.bzl. This file can contain xplat-only targets.
2+
# targets.bzl. This file can contain fbcode-only targets.
33

4+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
45
load(":targets.bzl", "define_common_targets")
56

67
oncall("executorch")
78

89
define_common_targets()
10+
11+
runtime.python_library(
12+
name = "bundled_program_schema_py",
13+
srcs = [
14+
"__init__.py",
15+
"bundled_program_schema.py",
16+
],
17+
visibility = [
18+
"//executorch/devtools/bundled_program/...",
19+
"//executorch/devtools/etrecord/...",
20+
],
21+
deps = [
22+
"//executorch/exir:scalar_type",
23+
],
24+
)

0 commit comments

Comments
 (0)