BUILD 11.7 KB
Newer Older
Terry Koo's avatar
Terry Koo committed
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
package(default_visibility = ["//visibility:public"])

# TODO(googleuser): Move XLA libs to dragnn/runtime when stable. Probably there
# should be a refactor with the Myelin libs since they are so similar.

load(
    "//dragnn/runtime/xla:xla_build_defs.bzl",
    "dragnn_xla_aot_components",
)
load(
    "//dragnn/runtime:multiarch.bzl",
    "dragnn_cc_multiarch_library",
    "dragnn_cc_multiarch_test",
)

filegroup(
    name = "test_xla_compilation_output",
    srcs = glob(["testdata/xla_compilation_output/**"]),
)

cc_binary(
    name = "xla_extract_config",
    srcs = ["xla_extract_config.cc"],
    deps = [
        ":xla_graph_utils",
        "//dragnn/protos:export_proto_cc",
        "@org_tensorflow//tensorflow/compiler/tf2xla:tf2xla_proto",
        "@org_tensorflow//tensorflow/core:framework",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:protos_all_cc",
    ],
)

cc_binary(
    name = "xla_extract_names_from_specs",
    srcs = ["xla_extract_names_from_specs.cc"],
    deps = [
        ":xla_spec_build_utils",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/core:lib",
    ],
)

cc_library(
    name = "xla_cell_converter",
    srcs = ["xla_cell_converter.cc"],
    hdrs = ["xla_cell_converter.h"],
    deps = [
        ":xla_graph_utils",
        "//dragnn/protos:export_proto_cc",
        "//dragnn/runtime:trained_model",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/core:framework_headers_lib",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:protos_all_cc",
    ],
)

cc_test(
    name = "xla_cell_converter_test",
    size = "small",
    timeout = "moderate",
    srcs = ["xla_cell_converter_test.cc"],
    data = ["//dragnn/runtime:test_rnn_tagger"],
    deps = [
        ":xla_cell_converter",
        ":xla_graph_utils",
        ":xla_spec_utils",
        "//dragnn/components/syntaxnet:syntaxnet_component",
        "//dragnn/core/test:generic",
        "//dragnn/protos:export_proto_cc",
        "//dragnn/runtime:alignment",
        "//dragnn/runtime:trained_model",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/compiler/tf2xla:tf2xla_proto",
        "@org_tensorflow//tensorflow/compiler/tf2xla:xla_jit_compiled_cpu_function",
        "@org_tensorflow//tensorflow/compiler/xla:shape_util",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:protos_all_cc",
        "@org_tensorflow//tensorflow/core:test",
    ],
)

cc_library(
    name = "xla_compilation",
    srcs = ["xla_compilation.cc"],
    hdrs = ["xla_compilation.h"],
    deps = [
        ":xla_cell_converter",
        ":xla_graph_utils",
        ":xla_spec_utils",
        "//dragnn/protos:export_proto_cc",
        "//dragnn/protos:spec_proto_cc",
        "//dragnn/runtime:component",
        "//dragnn/runtime:trained_model",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:protos_all_cc",
    ],
)

cc_test(
    name = "xla_compilation_test",
    size = "small",
    timeout = "moderate",
    srcs = ["xla_compilation_test.cc"],
    data = [
        ":test_xla_compilation_output",
        "//dragnn/runtime:test_rnn_tagger",
    ],
    deps = [
        ":xla_compilation",
        ":xla_spec_utils",
        "//dragnn/components/syntaxnet:syntaxnet_component",
        "//dragnn/core/test:generic",
        "//dragnn/protos:spec_proto_cc",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:test",
    ],
)

dragnn_cc_multiarch_library(
    name = "xla_dynamic_component_base",
    srcs = ["xla_dynamic_component_base.cc"],
    hdrs = ["xla_dynamic_component_base.h"],
    deps = [
        ":xla_spec_utils",
        "//dragnn/protos:export_proto_cc",
        "//dragnn/protos:spec_proto_cc",
        "//dragnn/protos:trace_proto_cc",
        "//dragnn/runtime:alignment",
        "//dragnn/runtime:component",
        "//dragnn/runtime:extensions",
        "//dragnn/runtime:fixed_embeddings",
        "//dragnn/runtime:linked_embeddings",
        "//dragnn/runtime:network_states",
        "//dragnn/runtime:session_state",
        "//dragnn/runtime:transition_system_traits",
        "//dragnn/runtime:type_keyed_set",
        "//dragnn/runtime:variable_store",
        "//dragnn/runtime/math:types",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/compiler/tf2xla:xla_compiled_cpu_function",
        "@org_tensorflow//tensorflow/compiler/xla:shape_util",
        "@org_tensorflow//tensorflow/compiler/xla:xla_data_proto",
        "@org_tensorflow//tensorflow/core:framework_headers_lib",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:protos_all_cc",
    ],
)

dragnn_cc_multiarch_library(
    name = "sequence_xla_dynamic_component_mixin",
    hdrs = ["sequence_xla_dynamic_component_mixin.h"],
    deps = [
        ":xla_dynamic_component_base",
        "//dragnn/core:compute_session",
        "//dragnn/protos:spec_proto_cc",
        "//dragnn/protos:trace_proto_cc",
        "//dragnn/runtime:extensions",
        "//dragnn/runtime:network_states",
        "//dragnn/runtime:sequence_features",
        "//dragnn/runtime:sequence_links",
        "//dragnn/runtime:sequence_model",
        "//dragnn/runtime:session_state",
        "//dragnn/runtime:variable_store",
        "//dragnn/runtime/math:types",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/compiler/tf2xla:xla_compiled_cpu_function",
        "@org_tensorflow//tensorflow/core:lib",
    ],
)

dragnn_cc_multiarch_test(
    name = "sequence_xla_dynamic_component_mixin_test",
    size = "small",
    srcs = ["sequence_xla_dynamic_component_mixin_test.cc"],
    deps = [
        ":xla_dynamic_component",
        ":xla_graph_utils",
        ":xla_spec_utils",
        "//dragnn/core:input_batch_cache",
        "//dragnn/core/test:generic",
        "//dragnn/protos:cell_trace_proto_cc",
        "//dragnn/protos:export_proto_cc",
        "//dragnn/protos:spec_proto_cc",
        "//dragnn/protos:trace_proto_cc",
        "//dragnn/runtime:component",
        "//dragnn/runtime:extensions",
        "//dragnn/runtime:network_states",
        "//dragnn/runtime:sequence_backend",
        "//dragnn/runtime:sequence_extractor",
        "//dragnn/runtime:sequence_predictor",
        "//dragnn/runtime/math:types",
        "//dragnn/runtime/test:network_test_base",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/compiler/xla:xla_data_proto",
        "@org_tensorflow//tensorflow/core:framework_headers_lib",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:protos_all_cc",
        "@org_tensorflow//tensorflow/core:test",
    ],
)

dragnn_cc_multiarch_library(
    name = "xla_aot_dynamic_component",
    hdrs = ["xla_aot_dynamic_component.h"],
    deps = [
        ":sequence_xla_dynamic_component_mixin",
        ":xla_dynamic_component_base",
        ":xla_graph_utils",
        ":xla_spec_utils",
        "//dragnn/protos:export_proto_cc",
        "//dragnn/protos:spec_proto_cc",
        "//dragnn/runtime:component",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/compiler/tf2xla:tf2xla_proto",
        "@org_tensorflow//tensorflow/compiler/tf2xla:xla_compiled_cpu_function",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:protos_all_cc",
    ],
)

dragnn_cc_multiarch_library(
    name = "xla_dynamic_component",
    srcs = ["xla_dynamic_component.cc"],
    deps = [
        ":sequence_xla_dynamic_component_mixin",
        ":xla_dynamic_component_base",
        ":xla_graph_utils",
        ":xla_spec_utils",
        "//dragnn/core:compute_session",
        "//dragnn/protos:export_proto_cc",
        "//dragnn/protos:spec_proto_cc",
        "//dragnn/protos:trace_proto_cc",
        "//dragnn/runtime:component",
        "//dragnn/runtime:fixed_embeddings",
        "//dragnn/runtime:linked_embeddings",
        "//dragnn/runtime:network_states",
        "//dragnn/runtime:session_state",
        "//dragnn/runtime/math:types",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/compiler/tf2xla:tf2xla_proto",
        "@org_tensorflow//tensorflow/compiler/tf2xla:xla_compiled_cpu_function",
        "@org_tensorflow//tensorflow/compiler/tf2xla:xla_jit_compiled_cpu_function",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:protos_all_cc",
    ],
    alwayslink = 1,
)

dragnn_cc_multiarch_test(
    name = "xla_dynamic_component_test",
    size = "small",
    srcs = ["xla_dynamic_component_test.cc"],
    deps = [
        ":xla_dynamic_component",
        ":xla_graph_utils",
        ":xla_spec_utils",
        "//dragnn/core/test:generic",
        "//dragnn/protos:cell_trace_proto_cc",
        "//dragnn/protos:export_proto_cc",
        "//dragnn/protos:spec_proto_cc",
        "//dragnn/protos:trace_proto_cc",
        "//dragnn/runtime:component",
        "//dragnn/runtime:extensions",
        "//dragnn/runtime:network_states",
        "//dragnn/runtime:session_state",
        "//dragnn/runtime:type_keyed_set",
        "//dragnn/runtime/math:types",
        "//dragnn/runtime/test:fake_variable_store",
        "//dragnn/runtime/test:network_test_base",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/compiler/xla:xla_data_proto",
        "@org_tensorflow//tensorflow/core:framework_headers_lib",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:protos_all_cc",
        "@org_tensorflow//tensorflow/core:test",
    ],
)

cc_library(
    name = "xla_graph_utils",
    srcs = ["xla_graph_utils.cc"],
    hdrs = ["xla_graph_utils.h"],
    deps = [
        ":xla_spec_utils",
        "//dragnn/protos:export_proto_cc",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/compiler/tf2xla:tf2xla_proto",
        "@org_tensorflow//tensorflow/core:framework_headers_lib",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:protos_all_cc",
    ],
)

cc_test(
    name = "xla_graph_utils_test",
    srcs = ["xla_graph_utils_test.cc"],
    deps = [
        ":xla_graph_utils",
        "//dragnn/core/test:generic",
        "//dragnn/protos:export_proto_cc",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/compiler/tf2xla:tf2xla_proto",
        "@org_tensorflow//tensorflow/core:framework_headers_lib",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:protos_all_cc",
        "@org_tensorflow//tensorflow/core:test",
    ],
)

cc_library(
    name = "xla_spec_build_utils",
    srcs = ["xla_spec_build_utils.cc"],
    hdrs = ["xla_spec_build_utils.h"],
    deps = [
        ":xla_spec_utils",
        "//dragnn/protos:spec_proto_cc",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/core:lib",
    ],
)

cc_test(
    name = "xla_spec_build_utils_test",
    srcs = ["xla_spec_build_utils_test.cc"],
    deps = [
        ":xla_spec_build_utils",
        "//dragnn/core/test:generic",
        "//dragnn/protos:export_proto_cc",
        "//dragnn/protos:spec_proto_cc",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:test",
    ],
)

cc_library(
    name = "xla_spec_utils",
    srcs = ["xla_spec_utils.cc"],
    hdrs = ["xla_spec_utils.h"],
    deps = [
        "//dragnn/protos:export_proto_cc",
        "//dragnn/protos:spec_proto_cc",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/core:lib",
    ],
)

cc_test(
    name = "xla_spec_utils_test",
    srcs = ["xla_spec_utils_test.cc"],
    deps = [
        ":xla_spec_utils",
        "//dragnn/core/test:generic",
        "//dragnn/protos:spec_proto_cc",
        "//syntaxnet:base",
        "@org_tensorflow//tensorflow/core:lib",
        "@org_tensorflow//tensorflow/core:test",
    ],
)