forked from pytorch/executorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
targets.bzl
128 lines (117 loc) · 3.59 KB
/
targets.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/codegen:codegen.bzl", "et_operator_library", "executorch_generated_lib", "exir_custom_ops_aot_lib")
def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""
runtime.export_file(
name = "custom_ops.yaml",
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)
# ~~~ START of custom ops 1 `my_ops::mul3` library definitions ~~~
et_operator_library(
name = "select_custom_ops_1",
ops = [
"my_ops::mul3.out",
],
define_static_targets = True,
visibility = [
"//executorch/codegen/...",
"@EXECUTORCH_CLIENTS",
],
)
runtime.cxx_library(
name = "custom_ops_1",
srcs = ["custom_ops_1_out.cpp"],
deps = [
"//executorch/runtime/kernel:kernel_includes",
],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)
executorch_generated_lib(
name = "lib_1",
deps = [
":select_custom_ops_1",
":custom_ops_1",
],
custom_ops_yaml_target = ":custom_ops.yaml",
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)
# ~~~ END of custom ops 1 `my_ops::mul3` library definitions ~~~
# ~~~ START of custom ops 2 `my_ops::mul4` library definitions ~~~
et_operator_library(
name = "select_custom_ops_2",
ops = [
"my_ops::mul4.out",
],
define_static_targets = True,
visibility = [
"//executorch/codegen/...",
"@EXECUTORCH_CLIENTS",
],
)
runtime.cxx_library(
name = "custom_ops_2",
srcs = ["custom_ops_2_out.cpp"],
deps = [
"//executorch/runtime/kernel:kernel_includes",
],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)
runtime.cxx_library(
name = "custom_ops_2_aten",
srcs = [
"custom_ops_2.cpp",
"custom_ops_2_out.cpp",
],
deps = [
"//executorch/runtime/kernel:kernel_includes_aten",
],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
external_deps = ["libtorch"],
# @lint-ignore BUCKLINT link_whole
link_whole = True,
# WARNING: using a deprecated API to avoid being built into a shared
# library. In the case of dynamically loading so library we don't want
# it to depend on other so libraries because that way we have to
# specify library directory path.
force_static = True,
)
exir_custom_ops_aot_lib(
name = "custom_ops_aot_lib_2",
yaml_target = ":custom_ops.yaml",
visibility = ["//executorch/..."],
kernels = [":custom_ops_2_aten"],
deps = [
":select_custom_ops_2",
],
)
executorch_generated_lib(
name = "lib_2",
deps = [
":select_custom_ops_2",
":custom_ops_2",
],
custom_ops_yaml_target = ":custom_ops.yaml",
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)
# ~~~ END of custom ops 2 `my_ops::mul4` library definitions ~~~