xref: /aosp_15_r20/external/executorch/exir/backend/TARGETS (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1# Any targets that should be shared between fbcode and xplat must be defined in
2# targets.bzl. This file can contain fbcode-only targets.
3
4load("@fbsource//xplat/executorch/backends:backends.bzl", "get_all_cpu_aot_and_backend_targets")
5load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
6load(":targets.bzl", "define_common_targets")
7
8oncall("executorch")
9
10define_common_targets()
11
12# Use runtime.python_library instead of the one defined in python_library.bzl,
13# so we can have access to EXECUTORCH_CLIENTS list.
14runtime.python_library(
15    name = "backend_api",
16    srcs = [
17        "backend_api.py",
18    ],
19    visibility = [
20        "//executorch/...",
21        "//executorch/test/...",
22        "@EXECUTORCH_CLIENTS",
23    ],
24    deps = [
25        ":backend_details",
26        ":compile_spec_schema",
27        "//caffe2:torch",
28        "//executorch/exir/backend:utils",
29        "//executorch/exir/backend/canonical_partitioners:duplicate_constant_node_pass",
30    ],
31)
32
33runtime.python_library(
34    name = "compile_spec_schema",
35    srcs = [
36        "compile_spec_schema.py",
37    ],
38    visibility = [
39        "//executorch/...",
40        "//executorch/test/...",
41        "@EXECUTORCH_CLIENTS",
42    ],
43)
44
45runtime.python_library(
46    name = "partitioner",
47    srcs = [
48        "partitioner.py",
49    ],
50    visibility = [
51        "//executorch/...",
52        "//executorch/test/...",
53        "@EXECUTORCH_CLIENTS",
54    ],
55    deps = [
56        ":compile_spec_schema",
57        "//caffe2:torch",
58    ],
59)
60
61runtime.python_library(
62    name = "backend_details",
63    srcs = [
64        "backend_details.py",
65    ],
66    visibility = [
67        "//executorch/...",
68        "//executorch/test/...",
69        "@EXECUTORCH_CLIENTS",
70    ],
71    deps = [
72        ":compile_spec_schema",
73        ":partitioner",
74        "//caffe2:torch",
75        "//executorch/exir:delegate",
76        "//executorch/exir:graph_module",
77    ],
78)
79
80# backend_lib includes all ahead of time apis and supported backends,
81# it's supposed to be only used on server side and not for production on device.
82runtime.python_library(
83    name = "backend_lib",
84    visibility = [
85        "//executorch/...",
86        "//executorch/test/...",
87        "@EXECUTORCH_CLIENTS",
88    ],
89    deps = [
90        ":backend_api",
91        ":backend_details",
92        ":utils",
93        "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib",
94    ] + get_all_cpu_aot_and_backend_targets(),
95)
96
97runtime.python_library(
98    name = "utils",
99    srcs = [
100        "utils.py",
101    ],
102    visibility = [
103        "//executorch/...",
104        "//executorch/exir/backend/...",
105        "//executorch/test/...",
106        "@EXECUTORCH_CLIENTS",
107    ],
108    deps = [
109        "fbsource//third-party/pypi/pandas:pandas",
110        "//caffe2:torch",
111        "//executorch/exir:lowered_backend_module",
112        "//executorch/exir/backend/canonical_partitioners:duplicate_constant_node_pass",
113    ],
114)
115