xref: /aosp_15_r20/external/executorch/backends/apple/mps/TARGETS (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1#
2#  Copyright (c) 2023 Apple Inc. All rights reserved.
3#  Provided subject to the LICENSE file in the top level directory.
4#
5
6# Any targets that should be shared between fbcode and xplat must be defined in
7# targets.bzl. This file can contain fbcode-only targets.
8
9load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
10load(":targets.bzl", "define_common_targets")
11
12oncall("executorch")
13
14define_common_targets()
15
16runtime.python_library(
17    name = "backend",
18    srcs = [
19        "__init__.py",
20        "mps_preprocess.py",
21    ],
22    visibility = [
23        "@EXECUTORCH_CLIENTS",
24    ],
25    deps = [
26        ":operators",
27        ":serialization",
28        ":utils",
29        "//caffe2:torch",
30        "//executorch/exir/backend:backend_details",
31        "//executorch/exir/backend:compile_spec_schema",
32    ],
33)
34
35runtime.python_library(
36    name = "operators",
37    srcs = glob([
38        "operators/*.py",
39    ]),
40    deps = [
41        ":serialization",
42        ":utils",
43        "//executorch/backends/transforms:lib",
44    ],
45)
46
47runtime.python_library(
48    name = "partitioner",
49    srcs = glob([
50        "partition/*.py",
51    ]),
52    visibility = [
53        "@EXECUTORCH_CLIENTS",
54    ],
55    deps = [
56        ":backend",
57        "//caffe2:torch",
58        "//executorch/exir/backend:compile_spec_schema",
59        "//executorch/exir/backend:partitioner",
60        "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib",
61    ],
62)
63
64runtime.python_library(
65    name = "serialization",
66    srcs = glob([
67        "serialization/*.py",
68    ]),
69    resources = [
70        "serialization/schema.fbs",
71    ],
72)
73
74runtime.python_library(
75    name = "utils",
76    srcs = glob([
77        "utils/*.py",
78    ]),
79    deps = [
80        ":serialization",
81        "//caffe2:torch",
82        "//executorch/exir:lib",
83    ],
84)
85
86runtime.python_test(
87    name = "test",
88    srcs = glob([
89        "test/*.py",
90    ]),
91    deps = [
92        ":backend",
93        ":partitioner",
94        "//caffe2:torch",
95        "//executorch/examples/models:models",
96        "//executorch/exir/tests:models",
97        "//executorch/extension/export_util:export_util",
98        "//executorch/devtools:lib",
99        "//executorch/devtools/bundled_program/serialize:lib",
100        "fbsource//third-party/pypi/pytest:pytest",
101    ],
102)
103