Skip to content

Commit b30721d

Browse files
bigfootjonfacebook-github-bot
authored andcommitted
promote TARGETS content into placeholder BUCK files (#20407)
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. Reviewed By: mzlee Differential Revision: D109082058
1 parent 3801496 commit b30721d

16 files changed

Lines changed: 308 additions & 340 deletions

File tree

backends/apple/mps/BUCK

Lines changed: 94 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,105 @@
33
# Provided subject to the LICENSE file in the top level directory.
44
#
55

6-
# Any targets that should be shared between fbcode and xplat must be defined in
7-
# targets.bzl. This file can contain xplat-only targets.
8-
6+
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
97
load("@fbsource//tools/build_defs:default_platform_defs.bzl", "APPLE")
8+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
109
load(":targets.bzl", "define_common_targets")
10+
load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_xplat")
1111

1212
oncall("executorch")
1313

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

backends/apple/mps/TARGETS

Lines changed: 0 additions & 98 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
2+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
13
load(":targets.bzl", "define_common_targets")
24

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

backends/xnnpack/serialization/TARGETS

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

devtools/bundled_program/BUCK

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,48 @@
1+
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
2+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
13
load(":targets.bzl", "define_common_targets")
24

35
oncall("executorch")
46

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

devtools/bundled_program/TARGETS

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
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("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
5+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
46
load(":targets.bzl", "define_common_targets")
57

68
oncall("executorch")
79

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

0 commit comments

Comments
 (0)