forked from pytorch/executorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtargets.bzl
More file actions
94 lines (82 loc) · 2.94 KB
/
targets.bzl
File metadata and controls
94 lines (82 loc) · 2.94 KB
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
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")
load("@fbsource//xplat/executorch/codegen:codegen.bzl", "et_operator_library", "executorch_generated_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.cxx_library(
name = "operators",
srcs = [],
visibility = ["PUBLIC"],
exported_deps = [
"//executorch/kernels/portable/cpu:cpu",
],
)
if True in get_aten_mode_options():
runtime.cxx_library(
name = "operators_aten",
srcs = [],
visibility = ["PUBLIC"],
exported_deps = [
"//executorch/kernels/portable/cpu:cpu_aten",
],
)
runtime.export_file(
name = "functions.yaml",
visibility = ["PUBLIC"],
)
runtime.export_file(
name = "custom_ops.yaml",
visibility = ["PUBLIC"],
)
et_operator_library(
name = "executorch_all_ops",
include_all_operators = True,
define_static_targets = True,
visibility = ["PUBLIC"],
)
et_operator_library(
name = "executorch_aten_ops",
ops_schema_yaml_target = "//executorch/kernels/portable:functions.yaml",
define_static_targets = True,
visibility = ["PUBLIC"],
)
et_operator_library(
name = "executorch_custom_ops",
ops_schema_yaml_target = "//executorch/kernels/portable:custom_ops.yaml",
define_static_targets = True,
visibility = ["PUBLIC"],
)
generated_lib_common_args = {
"custom_ops_yaml_target": "//executorch/kernels/portable:custom_ops.yaml",
# size_test expects _static targets to be available for these libraries.
"define_static_targets": True,
"functions_yaml_target": "//executorch/kernels/portable:functions.yaml",
"visibility": ["PUBLIC"],
}
executorch_generated_lib(
name = "generated_lib",
deps = [
":executorch_aten_ops",
":executorch_custom_ops",
],
kernel_deps = ["//executorch/kernels/portable:operators"],
**generated_lib_common_args
)
if True in get_aten_mode_options():
executorch_generated_lib(
name = "generated_lib_aten",
deps = [
":executorch_aten_ops",
":executorch_custom_ops",
"//executorch/kernels/portable:operators_aten",
],
custom_ops_aten_kernel_deps = [
"//executorch/kernels/portable:operators_aten",
],
custom_ops_yaml_target = "//executorch/kernels/portable:custom_ops.yaml",
aten_mode = True,
visibility = ["PUBLIC"],
define_static_targets = True,
)