Skip to content

Commit b3ac2df

Browse files
authored
gate fbcode-only TARGETS dirs with is_fbcode() and rename to BUCK
Differential Revision: D109082044 Pull Request resolved: #21049
1 parent 4a95dff commit b3ac2df

56 files changed

Lines changed: 1163 additions & 763 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
78
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
89

910
oncall("executorch")
1011

11-
python_library(
12+
fbcode_target(
13+
_kind = python_library,
1214
name = "quantizer_reporter",
1315
srcs = [
1416
"quantizer_reporter.py",
@@ -20,7 +22,8 @@ python_library(
2022
],
2123
)
2224

23-
python_library(
25+
fbcode_target(
26+
_kind = python_library,
2427
name = "cmsis_nn",
2528
srcs = [
2629
"library/__init__.py",
@@ -31,7 +34,8 @@ python_library(
3134
],
3235
)
3336

34-
python_library(
37+
fbcode_target(
38+
_kind = python_library,
3539
name = "target_config",
3640
srcs = [
3741
"target_config.py",

backends/cortex_m/quantizer/BUCK

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Any targets that should be shared between fbcode and xplat must be defined in
2+
# targets.bzl.
3+
4+
load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode")
5+
load(":targets.bzl", "define_common_targets")
6+
7+
oncall("executorch")
8+
9+
define_common_targets(is_fbcode = is_fbcode())

backends/cortex_m/quantizer/TARGETS

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
2+
3+
def define_common_targets(is_fbcode = False):
4+
if not is_fbcode:
5+
return
6+
7+
# Copyright (c) Meta Platforms, Inc. and affiliates.
8+
# All rights reserved.
9+
#
10+
# This source code is licensed under the BSD-style license found in the
11+
# LICENSE file in the root directory of this source tree.
12+
13+
14+
15+
python_library(
16+
name = "quantizer",
17+
srcs = [
18+
"__init__.py",
19+
"node_finders.py",
20+
"pattern_checkers.py",
21+
"pattern_matcher.py",
22+
"quantization_configs.py",
23+
"quantizer.py",
24+
"quantizer_support.py",
25+
],
26+
deps = [
27+
"//caffe2:torch",
28+
"//executorch/backends/arm:common",
29+
"//executorch/backends/arm:constants",
30+
"//executorch/backends/arm/quantizer:arm_quantizer_utils",
31+
"//executorch/backends/arm/quantizer:quantization_annotator",
32+
"//executorch/backends/arm/quantizer:quantization_config",
33+
"//executorch/backends/cortex_m:quantizer_reporter",
34+
"//executorch/backends/cortex_m/passes:cortex_passes",
35+
"//pytorch/ao:torchao",
36+
"fbsource//third-party/pypi/tabulate:tabulate",
37+
],
38+
)
39+
40+
41+
python_library(
42+
name = "quantization_configs",
43+
srcs = [
44+
"quantization_configs.py",
45+
],
46+
deps = [
47+
"//caffe2:torch",
48+
"//executorch/backends/arm/quantizer:arm_quantizer_utils",
49+
"//executorch/backends/arm/quantizer:quantization_config",
50+
"//executorch/backends/cortex_m:quantizer_reporter",
51+
"//pytorch/ao:torchao",
52+
],
53+
)

backends/cortex_m/targets.bzl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
2+
3+
def define_common_targets(is_fbcode = False):
4+
if not is_fbcode:
5+
return
6+
7+
# Copyright 2026 Arm Limited and/or its affiliates.
8+
# All rights reserved.
9+
#
10+
# This source code is licensed under the BSD-style license found in the
11+
# LICENSE file in the root directory of this source tree.
12+
13+
14+
15+
python_library(
16+
name = "quantizer_reporter",
17+
srcs = [
18+
"quantizer_reporter.py",
19+
],
20+
deps = [
21+
"//caffe2:torch",
22+
"//pytorch/ao:torchao",
23+
"fbsource//third-party/pypi/tabulate:tabulate",
24+
],
25+
)
26+
27+
python_library(
28+
name = "target_config",
29+
srcs = [
30+
"target_config.py",
31+
],
32+
deps = [
33+
"fbsource//third-party/cmsis-nn:cmsis_nn_py",
34+
],
35+
)

backends/example/BUCK

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Any targets that should be shared between fbcode and xplat must be defined in
2+
# targets.bzl.
3+
4+
load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode")
5+
load(":targets.bzl", "define_common_targets")
6+
7+
oncall("executorch")
8+
9+
define_common_targets(is_fbcode = is_fbcode())

backends/example/TARGETS

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

backends/example/targets.bzl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2+
load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest")
3+
4+
def define_common_targets(is_fbcode = False):
5+
if not is_fbcode:
6+
return
7+
8+
runtime.python_library(
9+
name = "example_quantizer",
10+
srcs = [
11+
"example_quantizer.py",
12+
],
13+
deps = [
14+
"//caffe2:torch",
15+
"//executorch/backends/example/example_operators:example_operators_lib",
16+
"//executorch/backends/xnnpack/quantizer:xnnpack_quantizer",
17+
],
18+
)
19+
20+
runtime.python_library(
21+
name = "example_backend",
22+
srcs = [
23+
"example_backend.py",
24+
],
25+
deps = [
26+
"//executorch/backends/example/example_backend_delegate_passes:lib",
27+
"//executorch/exir/backend:backend_details",
28+
"//executorch/exir/backend:compile_spec_schema",
29+
],
30+
)
31+
32+
runtime.python_library(
33+
name = "example_partitioner",
34+
srcs = [
35+
"example_partitioner.py",
36+
],
37+
deps = [
38+
":example_backend",
39+
"//caffe2:torch",
40+
"//executorch/backends/example/example_operators:example_operators_lib",
41+
"//executorch/exir:graph_module",
42+
"//executorch/exir/backend:partitioner",
43+
"//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib",
44+
"//executorch/exir/dialects:lib",
45+
],
46+
)
47+
48+
python_unittest(
49+
name = "test_example_delegate",
50+
srcs = [
51+
"test_example_delegate.py",
52+
],
53+
deps = [
54+
":example_partitioner",
55+
":example_quantizer",
56+
"//caffe2:torch",
57+
"//executorch/exir:delegate",
58+
"//executorch/exir:lib",
59+
"//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib",
60+
"//pytorch/vision:torchvision",
61+
],
62+
)

backends/vulkan/_passes/BUCK

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Any targets that should be shared between fbcode and xplat must be defined in
2+
# targets.bzl.
3+
4+
load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode")
5+
load(":targets.bzl", "define_common_targets")
6+
7+
oncall("executorch")
8+
9+
define_common_targets(is_fbcode = is_fbcode())

0 commit comments

Comments
 (0)