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
127 lines (116 loc) · 4.74 KB
/
targets.bzl
File metadata and controls
127 lines (116 loc) · 4.74 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
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
load("@fbsource//xplat/executorch/build:build_variables.bzl", "PROGRAM_NO_PRIM_OPS_SRCS")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")
def _program_preprocessor_flags():
"""Returns the preprocessor_flags to use when building Program.cpp"""
# The code for flatbuffer verification can add ~30k of .text to the binary.
# It's a valuable feature, but make it optional for space-constrained
# systems.
enable_verification = native.read_config(
"executorch",
"enable_program_verification",
# Default value
"true",
)
if enable_verification == "false":
return ["-DET_ENABLE_PROGRAM_VERIFICATION=0"]
elif enable_verification == "true":
# Enabled by default.
return []
else:
fail("executorch.enable_program_verification must be one of 'true' or 'false'; saw '" +
enable_verification + "'")
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 = "memory_manager",
exported_headers = [
"memory_manager.h",
],
exported_deps = [
"//executorch/runtime/core:memory_allocator",
],
visibility = ["PUBLIC"],
)
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""
runtime.cxx_library(
name = "pte_data_map" + aten_suffix,
srcs = [
"pte_data_map.cpp",
],
exported_headers = [
"pte_data_map.h",
],
visibility = ["PUBLIC"],
exported_deps = [
"//executorch/runtime/core:core",
"//executorch/runtime/core:named_data_map" + aten_suffix,
"//executorch/runtime/core/exec_aten/util:scalar_type_util" + aten_suffix,
],
deps = [
"//executorch/schema:program",
],
exported_preprocessor_flags = [] if runtime.is_oss else ["-DEXECUTORCH_INTERNAL_FLATBUFFERS=1"],
)
runtime.cxx_library(
name = "merged_data_map" + aten_suffix,
exported_headers = [
"merged_data_map.h",
],
exported_deps = [
"//executorch/runtime/core:named_data_map" + aten_suffix,
],
)
runtime.cxx_library(
name = "program" + aten_suffix,
exported_deps = [
":program_no_prim_ops" + aten_suffix,
"//executorch/kernels/prim_ops:prim_ops_registry" + aten_suffix,
],
visibility = ["PUBLIC"],
)
runtime.cxx_library(
name = "program_no_prim_ops" + aten_suffix,
srcs = PROGRAM_NO_PRIM_OPS_SRCS + [
"tensor_parser{}.cpp".format(aten_suffix if aten_mode else "_portable"),
],
headers = [
"platform_memory_allocator.h",
],
exported_headers = [
"method.h",
"method_meta.h",
"program.h",
"tensor_parser.h",
],
compiler_flags = select({
"ovr_config//os:windows": [],
"DEFAULT" :["-Wno-error=deprecated-declarations"]
}),
preprocessor_flags = _program_preprocessor_flags(),
exported_deps = [
":memory_manager",
":pte_data_map" + aten_suffix,
":merged_data_map" + aten_suffix,
"//executorch/runtime/backend:interface" + aten_suffix,
"//executorch/runtime/core:core",
"//executorch/runtime/core:named_data_map" + aten_suffix,
"//executorch/runtime/core:evalue" + aten_suffix,
"//executorch/runtime/core:event_tracer" + aten_suffix,
"//executorch/runtime/core/exec_aten:lib" + aten_suffix,
"//executorch/runtime/core/exec_aten/util:scalar_type_util" + aten_suffix,
"//executorch/runtime/core/exec_aten/util:tensor_util" + aten_suffix,
"//executorch/runtime/kernel:kernel_runtime_context" + aten_suffix,
"//executorch/runtime/kernel:operator_registry" + aten_suffix,
"//executorch/runtime/platform:platform",
"//executorch/schema:extended_header",
],
deps = [
"//executorch/schema:program",
"//executorch/runtime/core/exec_aten/util:tensor_dimension_limit"
],
visibility = ["PUBLIC"],
)