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
157 lines (140 loc) · 4.83 KB
/
targets.bzl
File metadata and controls
157 lines (140 loc) · 4.83 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")
def event_tracer_enabled():
return native.read_config("executorch", "event_tracer_enabled", "false") == "true"
def get_event_tracer_flags():
event_tracer_flags = []
if event_tracer_enabled():
event_tracer_flags += ["-DET_EVENT_TRACER_ENABLED"]
elif not runtime.is_oss:
event_tracer_flags += select ({
"DEFAULT": [],
"fbsource//xplat/executorch/tools/buck/constraints:event-tracer-enabled" : ["-DET_EVENT_TRACER_ENABLED"]
})
return event_tracer_flags
def build_sdk():
return native.read_config("executorch", "build_sdk", "false") == "true"
def get_sdk_flags():
sdk_flags = []
if build_sdk():
sdk_flags += ["-DEXECUTORCH_BUILD_DEVTOOLS"]
return sdk_flags
def enable_enum_strings():
return native.read_config("executorch", "enable_enum_strings", "true") == "true"
def get_core_flags():
core_flags = []
core_flags += ["-DET_ENABLE_ENUM_STRINGS=" + ("1" if enable_enum_strings() else "0")]
return core_flags
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 = "core",
exported_headers = [
"array_ref.h", # TODO(T157717874): Migrate all users to span and then move this to portable_type
"data_loader.h",
"defines.h",
"error.h",
"freeable_buffer.h",
"function_ref.h",
"result.h",
"span.h",
],
visibility = ["PUBLIC"],
exported_preprocessor_flags = get_core_flags(),
exported_deps = [
"//executorch/runtime/core/portable_type/c10/c10:c10",
"//executorch/runtime/platform:platform",
],
)
runtime.cxx_library(
name = "tensor_shape_dynamism",
exported_headers = [
"tensor_shape_dynamism.h",
],
visibility = [
"//executorch/runtime/core/exec_aten/...",
"//executorch/runtime/core/portable_type/...",
],
)
runtime.cxx_library(
name = "memory_allocator",
exported_headers = [
"hierarchical_allocator.h",
"memory_allocator.h",
],
exported_deps = [
":core",
"//executorch/runtime/core/portable_type/c10/c10:c10",
],
visibility = ["PUBLIC"],
)
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")
runtime.cxx_library(
name = "evalue" + aten_suffix,
exported_headers = [
"evalue.h",
],
srcs = ["evalue.cpp"],
visibility = ["PUBLIC"],
exported_deps = [
":core",
":tag",
"//executorch/runtime/core/exec_aten:lib" + aten_suffix,
],
)
runtime.cxx_library(
name = "event_tracer" + aten_suffix,
exported_headers = [
"event_tracer.h",
"event_tracer_hooks.h",
"event_tracer_hooks_delegate.h",
],
visibility = ["PUBLIC"],
exported_preprocessor_flags = get_event_tracer_flags() + get_sdk_flags(),
exported_deps = [
"//executorch/runtime/platform:platform",
"//executorch/runtime/core:evalue" + aten_suffix,
],
)
runtime.cxx_library(
name = "named_data_map" + aten_suffix,
exported_headers = [
"named_data_map.h",
],
visibility = ["PUBLIC"],
exported_deps = [
":tensor_layout" + aten_suffix,
"//executorch/runtime/core/exec_aten:lib" + aten_suffix,
],
)
runtime.cxx_library(
name = "tensor_layout" + aten_suffix,
srcs = ["tensor_layout.cpp"],
exported_headers = ["tensor_layout.h"],
deps = [
"//executorch/runtime/core/portable_type/c10/c10:c10",
],
exported_deps = [
":core",
"//executorch/runtime/core/exec_aten:lib" + aten_suffix,
"//executorch/runtime/core/exec_aten/util:scalar_type_util" + aten_suffix,
],
visibility = ["//executorch/..."],
)
runtime.cxx_library(
name = "tag",
srcs = ["tag.cpp"],
exported_headers = [
"tag.h",
],
exported_deps = [
":core",
"//executorch/runtime/platform:compiler",
],
visibility = [
"//executorch/...",
],
)