1# Description:
2#   XLA service implementation.
3
4load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
5load("//tensorflow/compiler/xla/tests:build_defs.bzl", "xla_test")
6load(
7    "//tensorflow/core/platform:build_config.bzl",
8    "tf_proto_library",
9)
10load("//tensorflow:tensorflow.bzl", "if_libtpu", "tf_cc_test")
11
12# buildifier: disable=same-origin-load
13load("//tensorflow:tensorflow.bzl", "filegroup")
14
15# buildifier: disable=same-origin-load
16load("//tensorflow:tensorflow.bzl", "internal_hlo_deps")
17
18# buildifier: disable=same-origin-load
19load("//tensorflow:tensorflow.bzl", "internal_cuda_deps")
20load(
21    "//tensorflow/core/platform/default:cuda_build_defs.bzl",
22    "if_cuda_is_configured",
23)
24load(
25    "@local_config_rocm//rocm:build_defs.bzl",
26    "if_rocm_is_configured",
27)
28
29package(
30    default_visibility = [":friends"],
31    licenses = ["notice"],  # Apache 2.0
32)
33
34package_group(
35    name = "friends",
36    includes = [
37        "//tensorflow/compiler/xla:friends",
38    ],
39    packages = ["//learning/brain/experimental/tf_runtime/..."],
40)
41
42tf_proto_library(
43    name = "hlo_proto",
44    srcs = ["hlo.proto"],
45    cc_api_version = 2,
46    protodeps = ["//tensorflow/compiler/xla:xla_data_proto"],
47    visibility = ["//visibility:public"],
48)
49
50tf_proto_library(
51    name = "hlo_profile_printer_data",
52    srcs = ["hlo_profile_printer_data.proto"],
53    cc_api_version = 2,
54)
55
56tf_proto_library(
57    name = "hlo_execution_profile_data",
58    srcs = ["hlo_execution_profile_data.proto"],
59    cc_api_version = 2,
60    protodeps = [":hlo_profile_printer_data"],
61)
62
63# Filegroup used to collect source files for dependency checking.
64filegroup(
65    name = "c_srcs",
66    data = glob([
67        "**/*.cc",
68        "**/*.h",
69    ]),
70)
71
72cc_library(
73    name = "bfloat16_support",
74    srcs = ["bfloat16_support.cc"],
75    hdrs = ["bfloat16_support.h"],
76    deps = [
77        ":hlo",
78    ],
79)
80
81cc_library(
82    name = "bfloat16_conversion_folding",
83    srcs = ["bfloat16_conversion_folding.cc"],
84    hdrs = ["bfloat16_conversion_folding.h"],
85    deps = [
86        ":bfloat16_support",
87        ":hlo",
88        ":hlo_dataflow_analysis",
89        ":hlo_pass",
90        "//tensorflow/compiler/xla:status_macros",
91        "//tensorflow/compiler/xla:xla_data_proto_cc",
92        "//tensorflow/core:lib",
93        "@com_google_absl//absl/types:span",
94    ],
95)
96
97tf_cc_test(
98    name = "bfloat16_conversion_folding_test",
99    srcs = ["bfloat16_conversion_folding_test.cc"],
100    deps = [
101        ":bfloat16_conversion_folding",
102        ":bfloat16_support",
103        ":hlo",
104        "//tensorflow/compiler/xla:shape_util",
105        "//tensorflow/compiler/xla:status_macros",
106        "//tensorflow/compiler/xla:test",
107        "//tensorflow/compiler/xla:test_helpers",
108        "//tensorflow/compiler/xla:types",
109        "//tensorflow/compiler/xla:xla_data_proto_cc",
110        "//tensorflow/compiler/xla/tests:hlo_test_base",
111        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
112        "//tensorflow/core:lib",
113    ],
114)
115
116cc_library(
117    name = "bfloat16_normalization",
118    srcs = ["bfloat16_normalization.cc"],
119    hdrs = ["bfloat16_normalization.h"],
120    deps = [
121        ":bfloat16_support",
122        ":hlo",
123        ":hlo_dce",
124        ":hlo_pass",
125        ":tuple_simplifier",
126        "//tensorflow/compiler/xla:shape_util",
127        "//tensorflow/compiler/xla:status_macros",
128        "//tensorflow/compiler/xla:xla_data_proto_cc",
129        "//tensorflow/core:lib",
130        "@com_google_absl//absl/types:span",
131    ],
132)
133
134tf_cc_test(
135    name = "bfloat16_normalization_test",
136    srcs = ["bfloat16_normalization_test.cc"],
137    deps = [
138        ":bfloat16_normalization",
139        ":bfloat16_support",
140        ":hlo",
141        ":hlo_creation_utils",
142        ":hlo_verifier",
143        "//tensorflow/compiler/xla:shape_util",
144        "//tensorflow/compiler/xla:status_macros",
145        "//tensorflow/compiler/xla:test",
146        "//tensorflow/compiler/xla:test_helpers",
147        "//tensorflow/compiler/xla:types",
148        "//tensorflow/compiler/xla:xla_data_proto_cc",
149        "//tensorflow/compiler/xla/tests:hlo_test_base",
150        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
151        "//tensorflow/core:lib",
152    ],
153)
154
155cc_library(
156    name = "bfloat16_propagation",
157    srcs = ["bfloat16_propagation.cc"],
158    hdrs = ["bfloat16_propagation.h"],
159    deps = [
160        ":bfloat16_support",
161        ":hlo",
162        ":hlo_dataflow_analysis",
163        ":hlo_dce",
164        ":hlo_pass",
165        ":tuple_simplifier",
166        "//tensorflow/compiler/xla:literal",
167        "//tensorflow/compiler/xla:shape_tree",
168        "//tensorflow/compiler/xla:shape_util",
169        "//tensorflow/compiler/xla:util",
170        "//tensorflow/core:lib",
171        "@com_google_absl//absl/algorithm:container",
172        "@com_google_absl//absl/container:flat_hash_map",
173        "@com_google_absl//absl/container:flat_hash_set",
174    ],
175)
176
177tf_cc_test(
178    name = "bfloat16_propagation_test",
179    srcs = ["bfloat16_propagation_test.cc"],
180    deps = [
181        ":bfloat16_propagation",
182        ":bfloat16_support",
183        ":hlo",
184        "//tensorflow/compiler/xla:literal_util",
185        "//tensorflow/compiler/xla:shape_util",
186        "//tensorflow/compiler/xla:test",
187        "//tensorflow/compiler/xla:test_helpers",
188        "//tensorflow/compiler/xla:xla_data_proto_cc",
189        "//tensorflow/compiler/xla/tests:hlo_test_base",
190        "//tensorflow/compiler/xla/tests:literal_test_util",
191        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
192    ],
193)
194
195cc_library(
196    name = "dump",
197    srcs = ["dump.cc"],
198    hdrs = ["dump.h"],
199    deps = [
200        ":hlo",
201        ":hlo_graph_dumper",
202        ":hlo_proto_util",
203        "//tensorflow/compiler/xla:status",
204        "//tensorflow/compiler/xla:util",
205        "//tensorflow/compiler/xla:xla_proto_cc",
206        "//tensorflow/core:lib",
207        "//tensorflow/core/platform:regexp",
208        "@com_google_absl//absl/strings",
209    ],
210)
211
212cc_library(
213    name = "shape_inference",
214    srcs = ["shape_inference.cc"],
215    hdrs = ["shape_inference.h"],
216    deps = [
217        ":hlo",
218        "//tensorflow/compiler/xla:permutation_util",
219        "//tensorflow/compiler/xla:shape_util",
220        "//tensorflow/compiler/xla:status_macros",
221        "//tensorflow/compiler/xla:statusor",
222        "//tensorflow/compiler/xla:types",
223        "//tensorflow/compiler/xla:util",
224        "//tensorflow/compiler/xla:window_util",
225        "//tensorflow/compiler/xla:xla_data_proto_cc",
226        "//tensorflow/core:lib",
227        "@com_google_absl//absl/algorithm:container",
228        "@com_google_absl//absl/container:flat_hash_set",
229        "@com_google_absl//absl/strings",
230        "@com_google_absl//absl/strings:str_format",
231        "@com_google_absl//absl/types:span",
232    ],
233)
234
235tf_cc_test(
236    name = "shape_inference_test",
237    srcs = ["shape_inference_test.cc"],
238    deps = [
239        ":hlo",
240        ":shape_inference",
241        "//tensorflow/compiler/xla:shape_util",
242        "//tensorflow/compiler/xla:test",
243        "//tensorflow/compiler/xla:test_helpers",
244        "//tensorflow/compiler/xla:types",
245        "//tensorflow/compiler/xla:util",
246        "//tensorflow/compiler/xla:window_util",
247        "//tensorflow/compiler/xla:xla_data_proto_cc",
248        "//tensorflow/compiler/xla/client:padding",
249        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
250        "//tensorflow/core:lib",
251        "@com_google_absl//absl/strings",
252        "@com_google_absl//absl/types:span",
253    ],
254)
255
256tf_cc_test(
257    name = "hlo_opcode_test",
258    srcs = ["hlo_opcode_test.cc"],
259    deps = [
260        ":hlo",
261        "//tensorflow/compiler/xla:test",
262        "//tensorflow/compiler/xla:types",
263        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
264    ],
265)
266
267cc_library(
268    name = "hlo_evaluator",
269    srcs = [
270        "hlo_evaluator.cc",
271        "hlo_evaluator_typed_visitor.h",
272        "hlo_evaluator_typed_visitor_bfloat16.cc",
273        "hlo_evaluator_typed_visitor_bool.cc",
274        "hlo_evaluator_typed_visitor_complex128.cc",
275        "hlo_evaluator_typed_visitor_complex64.cc",
276        "hlo_evaluator_typed_visitor_double.cc",
277        "hlo_evaluator_typed_visitor_float.cc",
278        "hlo_evaluator_typed_visitor_half.cc",
279        "hlo_evaluator_typed_visitor_int16.cc",
280        "hlo_evaluator_typed_visitor_int32.cc",
281        "hlo_evaluator_typed_visitor_int64.cc",
282        "hlo_evaluator_typed_visitor_int8.cc",
283        "hlo_evaluator_typed_visitor_uint16.cc",
284        "hlo_evaluator_typed_visitor_uint32.cc",
285        "hlo_evaluator_typed_visitor_uint64.cc",
286        "hlo_evaluator_typed_visitor_uint8.cc",
287    ],
288    hdrs = ["hlo_evaluator.h"],
289    deps = [
290        ":dynamic_dimension_inference",
291        ":hlo",
292        ":hlo_casting_utils",
293        ":hlo_query",
294        ":shape_inference",
295        "//tensorflow/compiler/xla:array2d",
296        "//tensorflow/compiler/xla:literal",
297        "//tensorflow/compiler/xla:literal_util",
298        "//tensorflow/compiler/xla:shape_util",
299        "//tensorflow/compiler/xla:statusor",
300        "//tensorflow/compiler/xla:types",
301        "//tensorflow/compiler/xla:util",
302        "//tensorflow/compiler/xla:window_util",
303        "//tensorflow/compiler/xla:xla_data_proto_cc",
304        "//tensorflow/compiler/xla/service/cpu:runtime_single_threaded_matmul",
305        "//tensorflow/core:lib",
306        "//third_party/eigen3",
307        "@com_google_absl//absl/algorithm:container",
308        "@com_google_absl//absl/base",
309        "@com_google_absl//absl/container:inlined_vector",
310        "@com_google_absl//absl/container:node_hash_map",
311        "@com_google_absl//absl/memory",
312        "@com_google_absl//absl/meta:type_traits",
313        "@com_google_absl//absl/strings",
314        "@com_google_absl//absl/types:optional",
315        "@com_google_absl//absl/types:span",
316    ],
317)
318
319cc_library(
320    name = "hlo_live_range",
321    srcs = [
322        "hlo_live_range.cc",
323    ],
324    hdrs = [
325        "hlo_live_range.h",
326    ],
327    deps = [
328        ":hlo",
329        ":hlo_alias_analysis",
330        ":hlo_buffer",
331        ":hlo_dataflow_analysis",
332        ":hlo_ordering",
333        ":logical_buffer",
334        "//tensorflow/compiler/xla:shape_util",
335        "//tensorflow/compiler/xla:status_macros",
336        "//tensorflow/compiler/xla:statusor",
337        "//tensorflow/compiler/xla:types",
338        "//tensorflow/compiler/xla:util",
339        "//tensorflow/core:lib",
340        "@com_google_absl//absl/container:flat_hash_set",
341        "@com_google_absl//absl/strings",
342        "@com_google_absl//absl/strings:str_format",
343    ],
344)
345
346tf_cc_test(
347    name = "hlo_live_range_test",
348    srcs = ["hlo_live_range_test.cc"],
349    deps = [
350        ":call_graph",
351        ":hlo",
352        ":hlo_alias_analysis",
353        ":hlo_live_range",
354        ":hlo_memory_scheduler",
355        ":hlo_ordering",
356        ":hlo_parser",
357        ":hlo_value",
358        "//tensorflow/compiler/xla:literal",
359        "//tensorflow/compiler/xla:shape_util",
360        "//tensorflow/compiler/xla:status_macros",
361        "//tensorflow/compiler/xla:statusor",
362        "//tensorflow/compiler/xla:test",
363        "//tensorflow/compiler/xla:test_helpers",
364        "//tensorflow/compiler/xla:types",
365        "//tensorflow/compiler/xla:util",
366        "//tensorflow/compiler/xla:xla_data_proto_cc",
367        "//tensorflow/compiler/xla/tests:hlo_test_base",
368        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
369        "//tensorflow/core:lib",
370        "//tensorflow/core:test",
371        "@com_google_absl//absl/container:flat_hash_set",
372        "@com_google_absl//absl/memory",
373        "@com_google_absl//absl/strings:str_format",
374    ],
375)
376
377tf_cc_test(
378    name = "hlo_evaluator_test",
379    srcs = ["hlo_evaluator_test.cc"],
380    deps = [
381        ":hlo",
382        ":hlo_element_type_converter",
383        ":hlo_evaluator",
384        "//tensorflow/compiler/xla:literal",
385        "//tensorflow/compiler/xla:permutation_util",
386        "//tensorflow/compiler/xla:reference_util",
387        "//tensorflow/compiler/xla:shape_util",
388        "//tensorflow/compiler/xla:status",
389        "//tensorflow/compiler/xla:status_macros",
390        "//tensorflow/compiler/xla:statusor",
391        "//tensorflow/compiler/xla:test",
392        "//tensorflow/compiler/xla:types",
393        "//tensorflow/compiler/xla:util",
394        "//tensorflow/compiler/xla:xla_data_proto_cc",
395        "//tensorflow/compiler/xla/client:xla_builder",
396        "//tensorflow/compiler/xla/tests:hlo_test_base",
397        "//tensorflow/compiler/xla/tests:literal_test_util",
398        "//tensorflow/compiler/xla/tests:test_utils",
399        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
400        "//tensorflow/core:lib",
401        "//tensorflow/core:test",
402        "@com_google_absl//absl/memory",
403        "@com_google_absl//absl/strings:str_format",
404    ],
405)
406
407cc_library(
408    name = "hlo",
409    srcs = [
410        "dfs_hlo_visitor.cc",
411        "dynamic_parameter_binding.cc",
412        "hlo_computation.cc",
413        "hlo_input_output_alias_config.cc",
414        "hlo_instruction.cc",
415        "hlo_instructions.cc",
416        "hlo_module.cc",
417        "hlo_module_metadata.cc",
418        "hlo_op_metadata.cc",
419        "hlo_opcode.cc",
420        "hlo_schedule.cc",
421        "hlo_sharding.cc",
422        "hlo_sharding_metadata.cc",
423    ],
424    hdrs = [
425        "dfs_hlo_visitor.h",
426        "dfs_hlo_visitor_with_default.h",
427        "dynamic_parameter_binding.h",
428        "hlo_clone_context.h",
429        "hlo_computation.h",
430        "hlo_domain_metadata.h",
431        "hlo_input_output_alias_config.h",
432        "hlo_instruction.h",
433        "hlo_instructions.h",
434        "hlo_module.h",
435        "hlo_module_metadata.h",
436        "hlo_op_metadata.h",
437        "hlo_opcode.h",
438        "hlo_schedule.h",
439        "hlo_sharding.h",
440        "hlo_sharding_metadata.h",
441    ],
442    deps = [
443        ":hlo_casting_utils",
444        ":hlo_module_config",
445        ":hlo_proto_cc",
446        ":name_uniquer",
447        "//tensorflow/compiler/xla:array",
448        "//tensorflow/compiler/xla:comparison_util",
449        "//tensorflow/compiler/xla:literal",
450        "//tensorflow/compiler/xla:literal_util",
451        "//tensorflow/compiler/xla:protobuf_util",
452        "//tensorflow/compiler/xla:shape_tree",
453        "//tensorflow/compiler/xla:shape_util",
454        "//tensorflow/compiler/xla:status",
455        "//tensorflow/compiler/xla:status_macros",
456        "//tensorflow/compiler/xla:statusor",
457        "//tensorflow/compiler/xla:types",
458        "//tensorflow/compiler/xla:util",
459        "//tensorflow/compiler/xla:window_util",
460        "//tensorflow/compiler/xla:xla_data_proto_cc",
461        "//tensorflow/core:lib",
462        "//tensorflow/core:lib_internal",
463        "//tensorflow/core/platform:human_readable_json",
464        "@com_google_absl//absl/algorithm:container",
465        "@com_google_absl//absl/container:flat_hash_map",
466        "@com_google_absl//absl/container:flat_hash_set",
467        "@com_google_absl//absl/container:inlined_vector",
468        "@com_google_absl//absl/memory",
469        "@com_google_absl//absl/strings",
470        "@com_google_absl//absl/strings:str_format",
471        "@com_google_absl//absl/types:optional",
472        "@com_google_absl//absl/types:span",
473    ],
474)
475
476cc_library(
477    name = "hlo_sharding_util",
478    srcs = [
479        "hlo_sharding_util.cc",
480    ],
481    hdrs = [
482        "hlo_sharding_util.h",
483    ],
484    deps = [
485        ":hlo",
486        ":hlo_casting_utils",
487        "//tensorflow/compiler/xla:array",
488        "//tensorflow/compiler/xla:literal_util",
489        "//tensorflow/compiler/xla:shape_util",
490        "//tensorflow/compiler/xla:util",
491        "//tensorflow/compiler/xla:xla_data_proto_cc",
492        "@com_google_absl//absl/algorithm:container",
493        "@com_google_absl//absl/container:flat_hash_set",
494        "@com_google_absl//absl/container:inlined_vector",
495        "@com_google_absl//absl/types:optional",
496    ],
497)
498
499tf_cc_test(
500    name = "hlo_sharding_util_test",
501    srcs = [
502        "hlo_sharding_util_test.cc",
503    ],
504    deps = [
505        ":hlo_sharding_util",
506        "//tensorflow/compiler/xla:test",
507        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
508    ],
509)
510
511cc_library(
512    name = "sharding_propagation",
513    srcs = [
514        "sharding_propagation.cc",
515    ],
516    hdrs = [
517        "sharding_propagation.h",
518    ],
519    deps = [
520        ":dot_as_convolution_util",
521        ":hlo",
522        ":hlo_graph_dumper",
523        ":hlo_pass",
524        ":hlo_sharding_util",
525        "//tensorflow/compiler/xla:protobuf_util",
526        "//tensorflow/compiler/xla:shape_util",
527        "//tensorflow/compiler/xla:status_macros",
528        "//tensorflow/compiler/xla:statusor",
529        "//tensorflow/compiler/xla:util",
530        "//tensorflow/compiler/xla:xla_data_proto_cc",
531        "//tensorflow/core:lib",
532        "@com_google_absl//absl/algorithm:container",
533        "@com_google_absl//absl/container:flat_hash_map",
534        "@com_google_absl//absl/container:flat_hash_set",
535        "@com_google_absl//absl/status",
536        "@com_google_absl//absl/strings",
537        "@com_google_absl//absl/types:optional",
538        "@com_google_absl//absl/types:span",
539    ],
540)
541
542tf_cc_test(
543    name = "sharding_propagation_test",
544    srcs = [
545        "sharding_propagation_test.cc",
546    ],
547    deps = [
548        ":hlo",
549        ":hlo_matchers",
550        ":hlo_parser",
551        ":sharding_propagation",
552        "//tensorflow/compiler/xla:protobuf_util",
553        "//tensorflow/compiler/xla:status_macros",
554        "//tensorflow/compiler/xla:xla_data_proto_cc",
555        "//tensorflow/compiler/xla/tests:hlo_test_base",
556        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
557        "@com_google_absl//absl/strings",
558    ],
559)
560
561cc_library(
562    name = "dot_as_convolution_util",
563    srcs = [
564        "dot_as_convolution_util.cc",
565    ],
566    hdrs = [
567        "dot_as_convolution_util.h",
568    ],
569    deps = [
570        ":hlo",
571        ":shape_inference",
572        "//tensorflow/compiler/xla:status_macros",
573        "//tensorflow/compiler/xla:xla_data_proto_cc",
574        "@com_google_absl//absl/types:optional",
575    ],
576)
577
578tf_cc_test(
579    name = "dynamic_parameter_binding_test",
580    srcs = ["dynamic_parameter_binding_test.cc"],
581    deps = [
582        ":hlo",
583        ":hlo_dce",
584        ":hlo_memory_scheduler",
585        ":hlo_ordering",
586        "//tensorflow/compiler/xla:shape_util",
587        "//tensorflow/compiler/xla:types",
588        "//tensorflow/compiler/xla:xla_data_proto_cc",
589        "//tensorflow/compiler/xla/tests:hlo_test_base",
590        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
591        "//tensorflow/core:test",
592        "@com_google_absl//absl/algorithm:container",
593    ],
594)
595
596xla_test(
597    name = "dynamic_update_slice_test",
598    srcs = ["dynamic_update_slice_test.cc"],
599    backends = [
600        "cpu",
601        "gpu",
602    ],
603    deps = [
604        ":hlo_parser",
605        "//tensorflow/compiler/xla:execution_options_util",
606        "//tensorflow/compiler/xla:status_macros",
607        "//tensorflow/compiler/xla:test",
608        "//tensorflow/compiler/xla/service/cpu:cpu_executable",
609        "//tensorflow/compiler/xla/service/cpu:parallel_task_assignment",
610        "//tensorflow/compiler/xla/service/cpu:target_machine_features",
611        "//tensorflow/compiler/xla/tests:client_library_test_base",
612        "//tensorflow/compiler/xla/tests:hlo_test_base",
613        "//tensorflow/compiler/xla/tests:test_macros_header",
614        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
615    ],
616)
617
618tf_cc_test(
619    name = "dfs_hlo_visitor_with_default_test",
620    srcs = ["dfs_hlo_visitor_with_default_test.cc"],
621    deps = [
622        ":hlo",
623        ":hlo_runner",
624        "//tensorflow/compiler/xla:shape_util",
625        "//tensorflow/compiler/xla:test",
626        "//tensorflow/compiler/xla:test_helpers",
627        "//tensorflow/compiler/xla:util",
628        "//tensorflow/compiler/xla:xla_data_proto_cc",
629        "//tensorflow/compiler/xla/tests:hlo_test_base",
630        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
631        "//tensorflow/core:test",
632    ],
633)
634
635cc_library(
636    name = "pattern_matcher",
637    hdrs = ["pattern_matcher.h"],
638    deps = [
639        ":hlo",
640        ":hlo_casting_utils",
641        "//tensorflow/compiler/xla:literal_util",
642        "//tensorflow/compiler/xla:shape_util",
643        "@com_google_absl//absl/strings",
644        "@com_google_absl//absl/utility",
645    ],
646)
647
648tf_cc_test(
649    name = "pattern_matcher_test",
650    srcs = ["pattern_matcher_test.cc"],
651    deps = [
652        ":hlo",
653        ":pattern_matcher",
654        "//tensorflow/compiler/xla:shape_util",
655        "//tensorflow/compiler/xla:test",
656        "//tensorflow/compiler/xla/tests:hlo_test_base",
657        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
658        "//tensorflow/core:test",
659        "@com_google_absl//absl/strings",
660    ],
661)
662
663cc_library(
664    name = "pattern_matcher_gmock",
665    testonly = 1,
666    hdrs = ["pattern_matcher_gmock.h"],
667    deps = [
668        ":pattern_matcher",
669        "//tensorflow/compiler/xla:test",
670        "//tensorflow/core:test",
671    ],
672)
673
674tf_cc_test(
675    name = "pattern_matcher_gmock_test",
676    srcs = ["pattern_matcher_gmock_test.cc"],
677    deps = [
678        ":hlo",
679        ":pattern_matcher",
680        ":pattern_matcher_gmock",
681        "//tensorflow/compiler/xla:shape_util",
682        "//tensorflow/compiler/xla:test",
683        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
684        "//tensorflow/core:test",
685    ],
686)
687
688cc_library(
689    name = "hlo_reachability",
690    srcs = ["hlo_reachability.cc"],
691    hdrs = ["hlo_reachability.h"],
692    deps = [
693        ":hlo",
694        "//tensorflow/compiler/xla:types",
695        "//tensorflow/compiler/xla:util",
696        "//tensorflow/core:lib",
697        "//tensorflow/core:lib_internal",
698        "@com_google_absl//absl/base",
699        "@com_google_absl//absl/container:flat_hash_map",
700        "@com_google_absl//absl/types:span",
701    ],
702)
703
704tf_cc_test(
705    name = "hlo_reachability_test",
706    srcs = ["hlo_reachability_test.cc"],
707    deps = [
708        ":hlo",
709        ":hlo_reachability",
710        "//tensorflow/compiler/xla:test",
711        "//tensorflow/compiler/xla:test_helpers",
712        "//tensorflow/compiler/xla/tests:hlo_test_base",
713        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
714    ],
715)
716
717cc_library(
718    name = "hlo_matchers",
719    testonly = 1,
720    srcs = ["hlo_matchers.cc"],
721    hdrs = ["hlo_matchers.h"],
722    deps = [
723        ":hlo",
724        ":hlo_parser",
725        "//tensorflow/compiler/xla:test",
726        "@com_google_absl//absl/strings",
727        "@com_google_absl//absl/types:optional",
728    ],
729)
730
731tf_cc_test(
732    name = "hlo_matchers_test",
733    srcs = ["hlo_matchers_test.cc"],
734    deps = [
735        ":hlo_matchers",
736        "//tensorflow/compiler/xla:literal_util",
737        "//tensorflow/compiler/xla:shape_util",
738        "//tensorflow/compiler/xla/tests:hlo_test_base",
739        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
740    ],
741)
742
743tf_cc_test(
744    name = "hlo_instruction_test",
745    srcs = ["hlo_instruction_test.cc"],
746    deps = [
747        ":hlo",
748        ":hlo_casting_utils",
749        "//tensorflow/compiler/xla:literal",
750        "//tensorflow/compiler/xla:protobuf_util",
751        "//tensorflow/compiler/xla:shape_util",
752        "//tensorflow/compiler/xla:test",
753        "//tensorflow/compiler/xla:test_helpers",
754        "//tensorflow/compiler/xla:util",
755        "//tensorflow/compiler/xla:window_util",
756        "//tensorflow/compiler/xla/service/gpu:backend_configs_cc",
757        "//tensorflow/compiler/xla/tests:hlo_test_base",
758        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
759        "//tensorflow/core:test",
760        "@com_google_absl//absl/container:flat_hash_map",
761    ],
762)
763
764tf_cc_test(
765    name = "hlo_sharding_test",
766    srcs = ["hlo_sharding_test.cc"],
767    deps = [
768        ":hlo",
769        ":hlo_parser",
770        "//tensorflow/compiler/xla:literal",
771        "//tensorflow/compiler/xla:protobuf_util",
772        "//tensorflow/compiler/xla:shape_util",
773        "//tensorflow/compiler/xla:test",
774        "//tensorflow/compiler/xla:test_helpers",
775        "//tensorflow/compiler/xla:util",
776        "//tensorflow/compiler/xla:xla_data_proto_cc",
777        "//tensorflow/compiler/xla/tests:hlo_test_base",
778        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
779    ],
780)
781
782cc_library(
783    name = "call_graph",
784    srcs = ["call_graph.cc"],
785    hdrs = ["call_graph.h"],
786    deps = [
787        ":hlo",
788        "//tensorflow/compiler/xla:status_macros",
789        "//tensorflow/compiler/xla:util",
790        "//tensorflow/core:lib",
791        "@com_google_absl//absl/container:flat_hash_map",
792        "@com_google_absl//absl/container:flat_hash_set",
793        "@com_google_absl//absl/memory",
794        "@com_google_absl//absl/strings",
795        "@com_google_absl//absl/strings:str_format",
796    ],
797)
798
799tf_cc_test(
800    name = "call_graph_test",
801    srcs = ["call_graph_test.cc"],
802    deps = [
803        ":call_graph",
804        ":hlo",
805        "//tensorflow/compiler/xla:literal",
806        "//tensorflow/compiler/xla:shape_util",
807        "//tensorflow/compiler/xla:status_macros",
808        "//tensorflow/compiler/xla:test",
809        "//tensorflow/compiler/xla:test_helpers",
810        "//tensorflow/compiler/xla:util",
811        "//tensorflow/compiler/xla:xla_data_proto_cc",
812        "//tensorflow/compiler/xla/tests:hlo_test_base",
813        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
814        "//tensorflow/core:test",
815    ],
816)
817
818cc_library(
819    name = "flatten_call_graph",
820    srcs = ["flatten_call_graph.cc"],
821    hdrs = ["flatten_call_graph.h"],
822    deps = [
823        ":call_graph",
824        ":hlo",
825        ":hlo_pass",
826        "//tensorflow/compiler/xla:statusor",
827        "//tensorflow/compiler/xla:util",
828        "//tensorflow/core:lib",
829    ],
830)
831
832cc_library(
833    name = "call_inliner",
834    srcs = ["call_inliner.cc"],
835    hdrs = ["call_inliner.h"],
836    deps = [
837        ":call_graph",
838        ":hlo",
839        ":hlo_dce",
840        ":hlo_pass",
841        "//tensorflow/compiler/xla:statusor",
842        "//tensorflow/core:lib",
843    ],
844)
845
846tf_cc_test(
847    name = "call_inliner_test",
848    size = "small",
849    srcs = ["call_inliner_test.cc"],
850    deps = [
851        ":call_inliner",
852        ":hlo",
853        ":hlo_matchers",
854        ":hlo_pass",
855        "//tensorflow/compiler/xla:literal",
856        "//tensorflow/compiler/xla:shape_util",
857        "//tensorflow/compiler/xla:test",
858        "//tensorflow/compiler/xla:types",
859        "//tensorflow/compiler/xla:util",
860        "//tensorflow/compiler/xla:xla_data_proto_cc",
861        "//tensorflow/compiler/xla/tests:hlo_test_base",
862        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
863        "//tensorflow/core:lib",
864        "//tensorflow/core:test",
865        "@com_google_absl//absl/memory",
866    ],
867)
868
869tf_cc_test(
870    name = "flatten_call_graph_test",
871    srcs = ["flatten_call_graph_test.cc"],
872    deps = [
873        ":call_graph",
874        ":flatten_call_graph",
875        ":hlo",
876        "//tensorflow/compiler/xla:literal",
877        "//tensorflow/compiler/xla:shape_util",
878        "//tensorflow/compiler/xla:status_macros",
879        "//tensorflow/compiler/xla:test",
880        "//tensorflow/compiler/xla:test_helpers",
881        "//tensorflow/compiler/xla:util",
882        "//tensorflow/compiler/xla:xla_data_proto_cc",
883        "//tensorflow/compiler/xla/tests:hlo_test_base",
884        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
885        "//tensorflow/core:test",
886    ],
887)
888
889cc_library(
890    name = "platform_util",
891    srcs = ["platform_util.cc"],
892    hdrs = ["platform_util.h"],
893    deps = [
894        ":compiler",
895        "//tensorflow/compiler/xla:debug_options_flags",
896        "//tensorflow/compiler/xla:status_macros",
897        "//tensorflow/compiler/xla:statusor",
898        "//tensorflow/compiler/xla:types",
899        "//tensorflow/compiler/xla:util",
900        "//tensorflow/core:lib",
901        "//tensorflow/core/platform:stream_executor_no_cuda",
902        "@com_google_absl//absl/strings",
903    ],
904)
905
906cc_library(
907    name = "backend",
908    srcs = ["backend.cc"],
909    hdrs = ["backend.h"],
910    deps = [
911        ":compiler",
912        ":computation_placer",
913        ":platform_util",
914        ":stream_pool",
915        ":transfer_manager",
916        "//tensorflow/compiler/xla:status_macros",
917        "//tensorflow/compiler/xla:statusor",
918        "//tensorflow/compiler/xla:types",
919        "//tensorflow/compiler/xla:util",
920        "//tensorflow/core:lib",
921        "//tensorflow/core/platform:stream_executor_no_cuda",
922        "//tensorflow/stream_executor:device_memory_allocator",
923        "//third_party/eigen3",
924        "@com_google_absl//absl/container:flat_hash_map",
925        "@com_google_absl//absl/memory",
926        "@com_google_absl//absl/strings",
927        "@com_google_absl//absl/types:span",
928    ],
929)
930
931cc_library(
932    name = "service",
933    srcs = ["service.cc"],
934    hdrs = ["service.h"],
935    deps = [
936        ":allocation_tracker",
937        ":backend",
938        ":channel_tracker",
939        ":compilation_cache",
940        ":compiler",
941        ":computation_layout",
942        ":computation_placer",
943        ":dump",
944        ":dynamic_dimension_inference",
945        ":executable",
946        ":execution_tracker",
947        ":hlo",
948        ":hlo_cost_analysis",
949        ":hlo_evaluator",
950        ":hlo_execution_profile",
951        ":hlo_module_config",
952        ":hlo_module_util",
953        ":hlo_proto_util",
954        ":platform_util",
955        ":source_map_util",
956        ":stream_pool",
957        ":transfer_manager",
958        "//tensorflow/compiler/xla:debug_options_flags",
959        "//tensorflow/compiler/xla:executable_run_options",
960        "//tensorflow/compiler/xla:execution_options_util",
961        "//tensorflow/compiler/xla:service_interface",
962        "//tensorflow/compiler/xla:shape_layout",
963        "//tensorflow/compiler/xla:shape_util",
964        "//tensorflow/compiler/xla:status_macros",
965        "//tensorflow/compiler/xla:statusor",
966        "//tensorflow/compiler/xla:types",
967        "//tensorflow/compiler/xla:util",
968        "//tensorflow/compiler/xla:xla_data_proto_cc",
969        "//tensorflow/compiler/xla:xla_proto_cc",
970        "//tensorflow/core:lib",
971        "//tensorflow/core:ptr_util",
972        "//tensorflow/core/platform:stream_executor_no_cuda",
973        "//tensorflow/stream_executor:device_memory_allocator",
974        "@com_google_absl//absl/memory",
975        "@com_google_absl//absl/strings",
976        "@com_google_absl//absl/strings:str_format",
977        "@com_google_absl//absl/types:span",
978    ],
979    alwayslink = 1,
980)
981
982cc_library(
983    name = "local_service",
984    srcs = ["local_service.cc"],
985    hdrs = ["local_service.h"],
986    deps = [
987        ":backend",
988        ":compiler",
989        ":computation_layout",
990        ":executable",
991        ":hlo",
992        ":hlo_execution_profile",
993        ":hlo_module_config",
994        ":hlo_module_util",
995        ":platform_util",
996        ":service",
997        ":shaped_buffer",
998        "//tensorflow/compiler/xla:execution_options_util",
999        "//tensorflow/compiler/xla:shape_layout",
1000        "//tensorflow/compiler/xla:shape_util",
1001        "//tensorflow/compiler/xla:status_macros",
1002        "//tensorflow/compiler/xla:statusor",
1003        "//tensorflow/compiler/xla:types",
1004        "//tensorflow/compiler/xla:util",
1005        "//tensorflow/compiler/xla:xla_data_proto_cc",
1006        "//tensorflow/compiler/xla/client:executable_build_options",
1007        "//tensorflow/compiler/xla/client:xla_computation",
1008        "//tensorflow/core:lib",
1009        "//tensorflow/core/platform:stream_executor_no_cuda",
1010        "//tensorflow/stream_executor:device_memory_allocator",
1011        "@com_google_absl//absl/memory",
1012        "@com_google_absl//absl/strings",
1013        "@com_google_absl//absl/strings:str_format",
1014        "@com_google_absl//absl/types:span",
1015    ],
1016)
1017
1018cc_library(
1019    name = "compile_only_service",
1020    srcs = ["compile_only_service.cc"],
1021    hdrs = ["compile_only_service.h"],
1022    deps = [
1023        ":backend",
1024        ":compiler",
1025        ":computation_layout",
1026        ":dump",
1027        ":platform_util",
1028        ":service",
1029        "//tensorflow/compiler/xla:debug_options_flags",
1030        "//tensorflow/compiler/xla:status_macros",
1031        "//tensorflow/compiler/xla:statusor",
1032        "//tensorflow/compiler/xla:types",
1033        "//tensorflow/compiler/xla:util",
1034        "//tensorflow/compiler/xla:xla_data_proto_cc",
1035        "//tensorflow/core:lib",
1036        "//tensorflow/core:lib_internal",
1037        "//tensorflow/core/platform:stream_executor_no_cuda",
1038        "@com_google_absl//absl/strings",
1039    ],
1040)
1041
1042cc_library(
1043    name = "cpu_plugin",
1044    deps = [
1045        ":service",
1046        "//tensorflow/compiler/xla/service/cpu:cpu_compiler",
1047        "//tensorflow/compiler/xla/service/cpu:cpu_transfer_manager",
1048        "//tensorflow/core/platform:stream_executor_no_cuda",
1049    ],
1050)
1051
1052cc_library(
1053    name = "gpu_plugin",
1054    deps = [
1055        ":service",
1056        "//tensorflow/compiler/xla/service/gpu:gpu_compiler",
1057        "//tensorflow/compiler/xla/service/gpu:gpu_transfer_manager",
1058        "//tensorflow/core/platform:stream_executor_no_cuda",
1059    ] + if_cuda_is_configured([
1060        "//tensorflow/compiler/xla/service/gpu:nvptx_compiler",
1061        "//tensorflow/core/platform/default/build_config:stream_executor_cuda",
1062    ]) + if_rocm_is_configured([
1063        "//tensorflow/compiler/xla/service/gpu:amdgpu_compiler",
1064        "//tensorflow/core/platform/default/build_config:stream_executor_rocm",
1065    ]) + internal_cuda_deps(),
1066)
1067
1068cc_library(
1069    name = "interpreter_plugin",
1070    deps = [
1071        ":service",
1072        "//tensorflow/compiler/xla/service/interpreter:compiler",
1073        "//tensorflow/compiler/xla/service/interpreter:interpreter_transfer_manager",
1074        "//tensorflow/compiler/xla/service/interpreter:platform",
1075        "//tensorflow/core/platform:stream_executor_no_cuda",
1076    ],
1077)
1078
1079cc_library(
1080    name = "shaped_buffer",
1081    srcs = ["shaped_buffer.cc"],
1082    hdrs = ["shaped_buffer.h"],
1083    visibility = ["//visibility:public"],
1084    deps = [
1085        "//tensorflow/compiler/xla:shape_tree",
1086        "//tensorflow/compiler/xla:shape_util",
1087        "//tensorflow/compiler/xla:status_macros",
1088        "//tensorflow/compiler/xla:statusor",
1089        "//tensorflow/compiler/xla:types",
1090        "//tensorflow/compiler/xla:util",
1091        "//tensorflow/compiler/xla:xla_data_proto_cc",
1092        "//tensorflow/core:lib",
1093        "//tensorflow/core/platform:stream_executor_no_cuda",
1094        "//tensorflow/stream_executor:device_memory_allocator",
1095        "@com_google_absl//absl/container:flat_hash_set",
1096        "@com_google_absl//absl/memory",
1097        "@com_google_absl//absl/strings",
1098        "@com_google_absl//absl/strings:str_format",
1099        "@com_google_absl//absl/types:span",
1100    ],
1101)
1102
1103tf_cc_test(
1104    name = "shaped_buffer_test",
1105    srcs = ["shaped_buffer_test.cc"],
1106    deps = [
1107        ":cpu_plugin",
1108        ":platform_util",
1109        ":shaped_buffer",
1110        "//tensorflow/compiler/xla:shape_util",
1111        "//tensorflow/compiler/xla:test",
1112        "//tensorflow/compiler/xla:test_helpers",
1113        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1114        "//tensorflow/core:ptr_util",
1115        "//tensorflow/core:test",
1116        "//tensorflow/core/platform:stream_executor_no_cuda",
1117        "//tensorflow/stream_executor:device_memory_allocator",
1118        "@com_google_absl//absl/memory",
1119    ],
1120)
1121
1122cc_library(
1123    name = "executable",
1124    srcs = ["executable.cc"],
1125    hdrs = [
1126        "executable.h",
1127        "service_executable_run_options.h",
1128    ],
1129    deps = [
1130        ":computation_layout",
1131        ":dump",
1132        ":hlo",
1133        ":hlo_execution_profile",
1134        ":hlo_graph_dumper",
1135        ":hlo_proto_cc",
1136        ":maybe_owning_device_memory",
1137        ":shaped_buffer",
1138        ":stream_pool",
1139        "@com_google_absl//absl/memory",
1140        "@com_google_absl//absl/strings:str_format",
1141        "@com_google_absl//absl/types:span",
1142        "@com_google_absl//absl/types:variant",
1143        "//tensorflow/compiler/xla:debug_options_flags",
1144        "//tensorflow/compiler/xla:executable_run_options",
1145        "//tensorflow/compiler/xla:shape_tree",
1146        "//tensorflow/compiler/xla:status",
1147        "//tensorflow/compiler/xla:status_macros",
1148        "//tensorflow/compiler/xla:statusor",
1149        "//tensorflow/compiler/xla:util",
1150        "//tensorflow/compiler/xla:xla_data_proto_cc",
1151        "//tensorflow/core:lib",
1152        "//tensorflow/core:lib_internal",
1153        "//tensorflow/core/platform:stream_executor_no_cuda",
1154        "//tensorflow/stream_executor",
1155        "//tensorflow/stream_executor:device_description",
1156        "//tensorflow/stream_executor:device_memory_allocator",
1157    ] + internal_hlo_deps(),
1158)
1159
1160cc_library(
1161    name = "compiler",
1162    srcs = ["compiler.cc"],
1163    hdrs = ["compiler.h"],
1164    deps = [
1165        ":buffer_assignment",
1166        ":buffer_value",
1167        ":computation_placer",
1168        ":executable",
1169        ":hlo",
1170        ":hlo_module_config",
1171        ":hlo_module_group",
1172        ":logical_buffer",
1173        "//tensorflow/compiler/xla:statusor",
1174        "//tensorflow/compiler/xla:types",
1175        "//tensorflow/compiler/xla:util",
1176        "//tensorflow/core:lib",
1177        "//tensorflow/core/platform:stream_executor_no_cuda",
1178        "@com_google_absl//absl/types:span",
1179    ],
1180)
1181
1182cc_library(
1183    name = "llvm_compiler",
1184    srcs = ["llvm_compiler.cc"],
1185    hdrs = ["llvm_compiler.h"],
1186    deps = [
1187        ":compiler",
1188        "//tensorflow/core:lib_internal",
1189        "@llvm-project//llvm:Core",
1190    ],
1191)
1192
1193cc_library(
1194    name = "transfer_manager",
1195    srcs = ["transfer_manager.cc"],
1196    hdrs = ["transfer_manager.h"],
1197    deps = [
1198        ":compiler",
1199        ":executable",
1200        ":maybe_owning_device_memory",
1201        ":shaped_buffer",
1202        "//tensorflow/compiler/xla:literal",
1203        "//tensorflow/compiler/xla:shape_util",
1204        "//tensorflow/compiler/xla:status_macros",
1205        "//tensorflow/compiler/xla:statusor",
1206        "//tensorflow/compiler/xla:types",
1207        "//tensorflow/compiler/xla:util",
1208        "//tensorflow/compiler/xla:xla_data_proto_cc",
1209        "//tensorflow/core:lib",
1210        "//tensorflow/core/platform:stream_executor_no_cuda",
1211        "//tensorflow/stream_executor:device_memory",
1212        "@com_google_absl//absl/memory",
1213        "@com_google_absl//absl/strings",
1214        "@com_google_absl//absl/types:span",
1215    ],
1216)
1217
1218cc_library(
1219    name = "allocation_tracker",
1220    srcs = ["allocation_tracker.cc"],
1221    hdrs = ["allocation_tracker.h"],
1222    deps = [
1223        ":backend",
1224        ":transfer_manager",
1225        "//tensorflow/compiler/xla:shape_util",
1226        "//tensorflow/compiler/xla:status_macros",
1227        "//tensorflow/compiler/xla:statusor",
1228        "//tensorflow/compiler/xla:types",
1229        "//tensorflow/compiler/xla:util",
1230        "//tensorflow/compiler/xla:xla_data_proto_cc",
1231        "//tensorflow/core:lib",
1232        "//tensorflow/stream_executor:device_memory_allocator",
1233        "@com_google_absl//absl/container:flat_hash_map",
1234        "@com_google_absl//absl/memory",
1235        "@com_google_absl//absl/strings",
1236    ],
1237)
1238
1239cc_library(
1240    name = "execution_tracker",
1241    srcs = ["execution_tracker.cc"],
1242    hdrs = ["execution_tracker.h"],
1243    deps = [
1244        ":backend",
1245        ":stream_pool",
1246        "//tensorflow/compiler/xla:executable_run_options",
1247        "//tensorflow/compiler/xla:statusor",
1248        "//tensorflow/compiler/xla:util",
1249        "//tensorflow/compiler/xla:xla_data_proto_cc",
1250        "//tensorflow/core:lib",
1251        "//tensorflow/core/platform:stream_executor_no_cuda",
1252        "@com_google_absl//absl/memory",
1253    ],
1254)
1255
1256cc_library(
1257    name = "channel_tracker",
1258    srcs = ["channel_tracker.cc"],
1259    hdrs = ["channel_tracker.h"],
1260    deps = [
1261        ":hlo",
1262        "//tensorflow/compiler/xla:status",
1263        "//tensorflow/compiler/xla:status_macros",
1264        "//tensorflow/compiler/xla:statusor",
1265        "//tensorflow/compiler/xla:types",
1266        "//tensorflow/compiler/xla:util",
1267        "//tensorflow/compiler/xla:xla_data_proto_cc",
1268        "//tensorflow/core:lib",
1269        "//tensorflow/core:lib_internal",
1270        "@com_google_absl//absl/container:flat_hash_map",
1271        "@com_google_absl//absl/memory",
1272        "@com_google_absl//absl/strings",
1273        "@com_google_absl//absl/types:span",
1274    ],
1275)
1276
1277cc_library(
1278    name = "name_uniquer",
1279    srcs = ["name_uniquer.cc"],
1280    hdrs = ["name_uniquer.h"],
1281    deps = [
1282        "//tensorflow/compiler/xla:shape_util",
1283        "//tensorflow/compiler/xla:types",
1284        "//tensorflow/core:lib",
1285        "@com_google_absl//absl/container:flat_hash_map",
1286        "@com_google_absl//absl/container:flat_hash_set",
1287        "@com_google_absl//absl/strings",
1288    ],
1289)
1290
1291tf_cc_test(
1292    name = "name_uniquer_test",
1293    srcs = ["name_uniquer_test.cc"],
1294    deps = [
1295        ":name_uniquer",
1296        "//tensorflow/compiler/xla:test",
1297        "//tensorflow/compiler/xla:test_helpers",
1298        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1299        "//tensorflow/core:test",
1300    ],
1301)
1302
1303cc_library(
1304    name = "buffer_assignment",
1305    srcs = [
1306        "buffer_assignment.cc",
1307    ],
1308    hdrs = [
1309        "buffer_assignment.h",
1310    ],
1311    deps = [
1312        ":buffer_value_containers",
1313        ":heap_simulator",
1314        ":hlo",
1315        ":hlo_alias_analysis",
1316        ":hlo_buffer",
1317        ":hlo_dataflow_analysis",
1318        ":hlo_live_range",
1319        ":hlo_proto_cc",
1320        ":logical_buffer",
1321        ":memory_space_assignment",
1322        ":tuple_points_to_analysis",
1323        "//tensorflow/compiler/xla:shape_util",
1324        "//tensorflow/compiler/xla:status_macros",
1325        "//tensorflow/compiler/xla:statusor",
1326        "//tensorflow/compiler/xla:types",
1327        "//tensorflow/compiler/xla:util",
1328        "//tensorflow/core:lib",
1329        "//tensorflow/core:lib_internal",
1330        "@com_google_absl//absl/algorithm:container",
1331        "@com_google_absl//absl/container:flat_hash_map",
1332        "@com_google_absl//absl/container:flat_hash_set",
1333        "@com_google_absl//absl/memory",
1334        "@com_google_absl//absl/strings",
1335        "@com_google_absl//absl/strings:str_format",
1336        "@com_google_absl//absl/types:span",
1337    ],
1338)
1339
1340tf_cc_test(
1341    name = "buffer_assignment_test",
1342    srcs = ["buffer_assignment_test.cc"],
1343    deps = [
1344        ":buffer_assignment",
1345        ":buffer_value",
1346        ":call_graph",
1347        ":copy_insertion",
1348        ":cpu_plugin",
1349        ":flatten_call_graph",
1350        ":hlo",
1351        ":hlo_memory_scheduler",
1352        ":hlo_ordering",
1353        ":hlo_parser",
1354        "//tensorflow/compiler/xla:literal",
1355        "//tensorflow/compiler/xla:shape_util",
1356        "//tensorflow/compiler/xla:test",
1357        "//tensorflow/compiler/xla:test_helpers",
1358        "//tensorflow/compiler/xla:types",
1359        "//tensorflow/compiler/xla:util",
1360        "//tensorflow/compiler/xla:xla_data_proto_cc",
1361        "//tensorflow/compiler/xla/tests:hlo_test_base",
1362        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1363        "//tensorflow/core:lib",
1364        "//tensorflow/core:test",
1365        "@com_google_absl//absl/container:flat_hash_set",
1366        "@com_google_absl//absl/memory",
1367        "@com_google_absl//absl/strings",
1368    ],
1369)
1370
1371cc_library(
1372    name = "hlo_ordering",
1373    srcs = ["hlo_ordering.cc"],
1374    hdrs = ["hlo_ordering.h"],
1375    deps = [
1376        ":call_graph",
1377        ":hlo",
1378        ":hlo_dataflow_analysis",
1379        ":hlo_proto_cc",
1380        ":hlo_reachability",
1381        ":hlo_value",
1382        "//tensorflow/compiler/xla:shape_util",
1383        "//tensorflow/compiler/xla:status_macros",
1384        "//tensorflow/compiler/xla:statusor",
1385        "//tensorflow/compiler/xla:types",
1386        "//tensorflow/compiler/xla:util",
1387        "//tensorflow/core:lib",
1388        "@com_google_absl//absl/container:flat_hash_map",
1389        "@com_google_absl//absl/strings",
1390        "@com_google_absl//absl/strings:str_format",
1391    ],
1392)
1393
1394tf_cc_test(
1395    name = "hlo_ordering_test",
1396    size = "small",
1397    srcs = ["hlo_ordering_test.cc"],
1398    deps = [
1399        ":hlo",
1400        ":hlo_dataflow_analysis",
1401        ":hlo_memory_scheduler",
1402        ":hlo_ordering",
1403        "//tensorflow/compiler/xla:shape_util",
1404        "//tensorflow/compiler/xla:types",
1405        "//tensorflow/compiler/xla:xla_data_proto_cc",
1406        "//tensorflow/compiler/xla/tests:hlo_test_base",
1407        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1408        "//tensorflow/core:test",
1409    ],
1410)
1411
1412cc_library(
1413    name = "heap_simulator",
1414    srcs = ["heap_simulator.cc"],
1415    hdrs = ["heap_simulator.h"],
1416    deps = [
1417        ":buffer_value",
1418        ":buffer_value_containers",
1419        ":hlo",
1420        ":hlo_alias_analysis",
1421        ":hlo_buffer",
1422        ":hlo_dataflow_analysis",
1423        ":hlo_live_range",
1424        ":hlo_ordering",
1425        ":hlo_proto_cc",
1426        ":memory_space_assignment_repacking",
1427        ":tuple_points_to_analysis",
1428        "//tensorflow/compiler/xla:statusor",
1429        "//tensorflow/compiler/xla:util",
1430        "@com_google_absl//absl/container:flat_hash_map",
1431        "@com_google_absl//absl/container:flat_hash_set",
1432        "@com_google_absl//absl/memory",
1433    ],
1434)
1435
1436tf_cc_test(
1437    name = "heap_simulator_test",
1438    srcs = ["heap_simulator_test.cc"],
1439    deps = [
1440        ":buffer_value",
1441        ":heap_simulator",
1442        ":hlo",
1443        ":hlo_alias_analysis",
1444        ":hlo_buffer",
1445        ":hlo_dataflow_analysis",
1446        ":hlo_ordering",
1447        ":hlo_value",
1448        ":tuple_points_to_analysis",
1449        "//tensorflow/compiler/xla:literal",
1450        "//tensorflow/compiler/xla:status_macros",
1451        "//tensorflow/compiler/xla/tests:hlo_test_base",
1452        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1453        "//tensorflow/core:lib",
1454        "//tensorflow/core:test",
1455        "@com_google_absl//absl/container:flat_hash_map",
1456        "@com_google_absl//absl/memory",
1457    ],
1458)
1459
1460cc_library(
1461    name = "hlo_module_group",
1462    srcs = ["hlo_module_group.cc"],
1463    hdrs = ["hlo_module_group.h"],
1464    deps = [
1465        ":hlo",
1466        ":hlo_proto_cc",
1467        "//tensorflow/core:lib",
1468        "@com_google_absl//absl/strings",
1469        "@com_google_absl//absl/types:span",
1470    ],
1471)
1472
1473tf_cc_test(
1474    name = "hlo_module_group_test",
1475    srcs = ["hlo_module_group_test.cc"],
1476    # TODO(b/148211710) Test fails in OSS.
1477    tags = ["no_oss"],
1478    deps = [
1479        ":hlo",
1480        ":hlo_matchers",
1481        ":hlo_module_group",
1482        ":hlo_module_group_metadata",
1483        ":hlo_proto_cc",
1484        "//tensorflow/compiler/xla:test",
1485        "//tensorflow/compiler/xla:util",
1486        "//tensorflow/compiler/xla/tests:hlo_test_base",
1487        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1488        "//tensorflow/core:lib",
1489        "//tensorflow/core:test",
1490    ],
1491)
1492
1493cc_library(
1494    name = "hlo_module_group_metadata",
1495    srcs = ["hlo_module_group_metadata.cc"],
1496    hdrs = ["hlo_module_group_metadata.h"],
1497    deps = [
1498        ":hlo",
1499        ":hlo_alias_analysis",
1500        ":hlo_casting_utils",
1501        ":tuple_points_to_analysis",
1502        "//tensorflow/compiler/xla:shape_util",
1503        "//tensorflow/compiler/xla:status",
1504        "//tensorflow/compiler/xla:status_macros",
1505        "//tensorflow/compiler/xla:statusor",
1506        "//tensorflow/compiler/xla:util",
1507        "//tensorflow/core:lib",
1508        "@com_google_absl//absl/container:flat_hash_map",
1509        "@com_google_absl//absl/memory",
1510        "@com_google_absl//absl/types:optional",
1511    ],
1512)
1513
1514cc_library(
1515    name = "hlo_module_util",
1516    srcs = ["hlo_module_util.cc"],
1517    hdrs = ["hlo_module_util.h"],
1518    deps = [
1519        ":compiler",
1520        ":hlo_module_config",
1521        "//tensorflow/compiler/xla:shape_util",
1522        "//tensorflow/compiler/xla:status",
1523        "//tensorflow/compiler/xla:statusor",
1524        "@com_google_absl//absl/types:optional",
1525        "@com_google_absl//absl/types:span",
1526    ],
1527)
1528
1529cc_library(
1530    name = "hlo_module_group_util",
1531    srcs = ["hlo_module_group_util.cc"],
1532    hdrs = ["hlo_module_group_util.h"],
1533    deps = [
1534        ":hlo",
1535        ":hlo_casting_utils",
1536        ":hlo_module_group_metadata",
1537        ":hlo_reachability",
1538        "//tensorflow/compiler/xla:status",
1539        "//tensorflow/compiler/xla:status_macros",
1540        "//tensorflow/compiler/xla:statusor",
1541        "//tensorflow/compiler/xla:types",
1542        "//tensorflow/compiler/xla:util",
1543        "//tensorflow/core:lib",
1544        "@com_google_absl//absl/container:flat_hash_map",
1545        "@com_google_absl//absl/container:flat_hash_set",
1546        "@com_google_absl//absl/memory",
1547        "@com_google_absl//absl/strings",
1548        "@com_google_absl//absl/types:span",
1549    ],
1550)
1551
1552tf_cc_test(
1553    name = "hlo_schedule_test",
1554    srcs = ["hlo_schedule_test.cc"],
1555    deps = [
1556        ":heap_simulator",
1557        ":hlo",
1558        ":hlo_dce",
1559        ":hlo_memory_scheduler",
1560        ":hlo_ordering",
1561        "//tensorflow/compiler/xla:shape_util",
1562        "//tensorflow/compiler/xla:types",
1563        "//tensorflow/compiler/xla:xla_data_proto_cc",
1564        "//tensorflow/compiler/xla/tests:hlo_test_base",
1565        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1566        "//tensorflow/core:test",
1567        "@com_google_absl//absl/algorithm:container",
1568    ],
1569)
1570
1571tf_cc_test(
1572    name = "hlo_input_output_alias_config_test",
1573    srcs = ["hlo_input_output_alias_config_test.cc"],
1574    deps = [
1575        ":hlo",
1576        ":hlo_dce",
1577        ":hlo_memory_scheduler",
1578        ":hlo_ordering",
1579        "//tensorflow/compiler/xla:shape_util",
1580        "//tensorflow/compiler/xla:types",
1581        "//tensorflow/compiler/xla:xla_data_proto_cc",
1582        "//tensorflow/compiler/xla/tests:hlo_test_base",
1583        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1584        "//tensorflow/core:test",
1585        "@com_google_absl//absl/algorithm:container",
1586    ],
1587)
1588
1589cc_library(
1590    name = "hlo_memory_scheduler",
1591    srcs = ["hlo_memory_scheduler.cc"],
1592    hdrs = ["hlo_memory_scheduler.h"],
1593    deps = [
1594        ":heap_simulator",
1595        ":hlo",
1596        ":hlo_alias_analysis",
1597        ":hlo_ordering",
1598        ":hlo_pass",
1599        ":logical_buffer",
1600        ":tuple_points_to_analysis",
1601        "//tensorflow/compiler/xla:shape_util",
1602        "//tensorflow/compiler/xla:status_macros",
1603        "//tensorflow/compiler/xla:statusor",
1604        "//tensorflow/compiler/xla:types",
1605        "//tensorflow/compiler/xla:util",
1606        "//tensorflow/core:lib",
1607        "//tensorflow/core:lib_internal",
1608        "@com_google_absl//absl/container:flat_hash_map",
1609        "@com_google_absl//absl/container:flat_hash_set",
1610    ],
1611)
1612
1613tf_cc_test(
1614    name = "hlo_memory_scheduler_test",
1615    srcs = ["hlo_memory_scheduler_test.cc"],
1616    deps = [
1617        ":heap_simulator",
1618        ":hlo",
1619        ":hlo_dce",
1620        ":hlo_memory_scheduler",
1621        ":hlo_ordering",
1622        ":hlo_parser",
1623        "//tensorflow/compiler/xla:shape_util",
1624        "//tensorflow/compiler/xla:types",
1625        "//tensorflow/compiler/xla:xla_data_proto_cc",
1626        "//tensorflow/compiler/xla/tests:hlo_test_base",
1627        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1628        "//tensorflow/core:test",
1629        "@com_google_absl//absl/algorithm:container",
1630        "@com_google_absl//absl/container:flat_hash_map",
1631    ],
1632)
1633
1634cc_library(
1635    name = "hlo_query",
1636    srcs = ["hlo_query.cc"],
1637    hdrs = ["hlo_query.h"],
1638    deps = [
1639        ":hlo",
1640        ":hlo_casting_utils",
1641        "//tensorflow/compiler/xla:literal",
1642        "//tensorflow/compiler/xla:shape_util",
1643        "@com_google_absl//absl/container:flat_hash_set",
1644    ],
1645)
1646
1647cc_library(
1648    name = "fusion_queue",
1649    hdrs = ["fusion_queue.h"],
1650    deps = [
1651        ":hlo",
1652        "@com_google_absl//absl/strings",
1653    ],
1654)
1655
1656cc_library(
1657    name = "instruction_fusion",
1658    srcs = ["instruction_fusion.cc"],
1659    hdrs = ["instruction_fusion.h"],
1660    deps = [
1661        ":fusion_queue",
1662        ":hlo",
1663        ":hlo_graph_dumper",
1664        ":hlo_pass",
1665        ":hlo_reachability",
1666        ":pattern_matcher",
1667        "//tensorflow/compiler/xla:debug_options_flags",
1668        "//tensorflow/compiler/xla:util",
1669        "//tensorflow/core:lib",
1670        "@com_google_absl//absl/algorithm:container",
1671        "@com_google_absl//absl/container:flat_hash_map",
1672        "@com_google_absl//absl/container:flat_hash_set",
1673        "@com_google_absl//absl/memory",
1674    ],
1675)
1676
1677tf_cc_test(
1678    name = "instruction_fusion_test",
1679    srcs = ["instruction_fusion_test.cc"],
1680    deps = [
1681        ":hlo_matchers",
1682        ":hlo_parser",
1683        ":instruction_fusion",
1684        "//tensorflow/compiler/xla/tests:hlo_test_base",
1685        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1686    ],
1687)
1688
1689cc_library(
1690    name = "multi_output_fusion",
1691    srcs = ["multi_output_fusion.cc"],
1692    hdrs = ["multi_output_fusion.h"],
1693    deps = [
1694        ":hlo",
1695        ":hlo_dataflow_analysis",
1696        ":hlo_dce",
1697        ":hlo_pass",
1698        ":hlo_reachability",
1699        "//tensorflow/compiler/xla:debug_options_flags",
1700        "//tensorflow/compiler/xla:shape_util",
1701        "//tensorflow/compiler/xla:statusor",
1702        "//tensorflow/compiler/xla:util",
1703        "//tensorflow/core:lib",
1704        "@com_google_absl//absl/container:flat_hash_map",
1705        "@com_google_absl//absl/container:flat_hash_set",
1706        "@com_google_absl//absl/strings",
1707    ],
1708)
1709
1710cc_library(
1711    name = "hlo_creation_utils",
1712    srcs = ["hlo_creation_utils.cc"],
1713    hdrs = [
1714        "hlo_creation_utils.h",
1715    ],
1716    deps = [
1717        ":hlo",
1718        ":hlo_module_config",
1719        ":shape_inference",
1720        "//tensorflow/compiler/xla:comparison_util",
1721        "//tensorflow/compiler/xla:literal",
1722        "//tensorflow/compiler/xla:literal_util",
1723        "//tensorflow/compiler/xla:statusor",
1724        "//tensorflow/compiler/xla:util",
1725        "//tensorflow/compiler/xla/client:xla_builder",
1726        "//tensorflow/compiler/xla/client:xla_computation",
1727        "//tensorflow/compiler/xla/client/lib:comparators",
1728        "@com_google_absl//absl/algorithm:container",
1729        "@com_google_absl//absl/memory",
1730        "@com_google_absl//absl/strings",
1731    ],
1732)
1733
1734cc_library(
1735    name = "fusion_node_indexing_evaluation",
1736    srcs = ["fusion_node_indexing_evaluation.cc"],
1737    hdrs = ["fusion_node_indexing_evaluation.h"],
1738    deps = [
1739        ":hlo",
1740        "//tensorflow/compiler/xla:types",
1741        "//tensorflow/core:lib",
1742        "@com_google_absl//absl/container:flat_hash_map",
1743        "@com_google_absl//absl/container:flat_hash_set",
1744    ],
1745)
1746
1747tf_cc_test(
1748    name = "fusion_node_indexing_evaluation_test",
1749    srcs = ["fusion_node_indexing_evaluation_test.cc"],
1750    deps = [
1751        ":fusion_node_indexing_evaluation",
1752        ":hlo",
1753        ":hlo_parser",
1754        ":instruction_fusion",
1755        "//tensorflow/compiler/xla/tests:hlo_test_base",
1756        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1757        "//tensorflow/core:test",
1758        "@com_google_absl//absl/container:flat_hash_map",
1759    ],
1760)
1761
1762tf_cc_test(
1763    name = "hlo_creation_utils_test",
1764    srcs = ["hlo_creation_utils_test.cc"],
1765    deps = [
1766        ":hlo",
1767        ":hlo_creation_utils",
1768        ":hlo_evaluator",
1769        ":hlo_matchers",
1770        "//tensorflow/compiler/xla:shape_util",
1771        "//tensorflow/compiler/xla:test",
1772        "//tensorflow/compiler/xla:util",
1773        "//tensorflow/compiler/xla/tests:hlo_test_base",
1774        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1775        "//tensorflow/core:test",
1776        "@com_google_absl//absl/memory",
1777    ],
1778)
1779
1780cc_library(
1781    name = "batchnorm_expander",
1782    srcs = ["batchnorm_expander.cc"],
1783    hdrs = ["batchnorm_expander.h"],
1784    deps = [
1785        ":hlo",
1786        ":hlo_pass",
1787        "//tensorflow/compiler/xla:literal",
1788        "//tensorflow/compiler/xla:literal_util",
1789        "//tensorflow/compiler/xla:shape_util",
1790        "//tensorflow/compiler/xla:status_macros",
1791        "//tensorflow/compiler/xla:types",
1792        "//tensorflow/compiler/xla:util",
1793        "//tensorflow/compiler/xla:xla_data_proto_cc",
1794        "//tensorflow/core:lib",
1795        "@com_google_absl//absl/types:optional",
1796        "@com_google_absl//absl/types:span",
1797    ],
1798)
1799
1800cc_library(
1801    name = "op_expander_pass",
1802    srcs = ["op_expander_pass.cc"],
1803    hdrs = ["op_expander_pass.h"],
1804    deps = [
1805        ":hlo",
1806        ":hlo_creation_utils",
1807        ":hlo_pass",
1808        "//tensorflow/compiler/xla:statusor",
1809        "//tensorflow/compiler/xla:util",
1810        "@com_google_absl//absl/algorithm:container",
1811    ],
1812)
1813
1814cc_library(
1815    name = "gather_expander",
1816    srcs = ["gather_expander.cc"],
1817    hdrs = ["gather_expander.h"],
1818    deps = [
1819        ":hlo",
1820        ":hlo_creation_utils",
1821        ":hlo_pass",
1822        ":op_expander_pass",
1823        ":while_util",
1824        "//tensorflow/compiler/xla:literal_util",
1825        "//tensorflow/compiler/xla:statusor",
1826        "//tensorflow/compiler/xla:util",
1827        "@com_google_absl//absl/algorithm:container",
1828    ],
1829)
1830
1831cc_library(
1832    name = "comparison_expander",
1833    srcs = ["comparison_expander.cc"],
1834    hdrs = ["comparison_expander.h"],
1835    deps = [
1836        ":hlo",
1837        ":hlo_creation_utils",
1838        ":hlo_pass",
1839        ":op_expander_pass",
1840        "//tensorflow/compiler/xla:statusor",
1841        "//tensorflow/compiler/xla:util",
1842        "//tensorflow/compiler/xla/client/lib:comparators",
1843    ],
1844)
1845
1846cc_library(
1847    name = "scatter_expander",
1848    srcs = ["scatter_expander.cc"],
1849    hdrs = ["scatter_expander.h"],
1850    deps = [
1851        ":hlo",
1852        ":hlo_creation_utils",
1853        ":hlo_pass",
1854        ":op_expander_pass",
1855        ":while_util",
1856        "//tensorflow/compiler/xla:literal_util",
1857        "//tensorflow/compiler/xla:statusor",
1858        "@com_google_absl//absl/algorithm:container",
1859    ],
1860)
1861
1862tf_cc_test(
1863    name = "scatter_expander_test",
1864    srcs = ["scatter_expander_test.cc"],
1865    deps = [
1866        ":hlo",
1867        ":hlo_matchers",
1868        ":hlo_parser",
1869        ":scatter_expander",
1870        "//tensorflow/compiler/xla:literal",
1871        "//tensorflow/compiler/xla:shape_util",
1872        "//tensorflow/compiler/xla:test",
1873        "//tensorflow/compiler/xla:types",
1874        "//tensorflow/compiler/xla:util",
1875        "//tensorflow/compiler/xla/tests:hlo_test_base",
1876        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1877        "//tensorflow/core:test",
1878        "@com_google_absl//absl/algorithm:container",
1879        "@com_google_absl//absl/memory",
1880    ],
1881)
1882
1883cc_library(
1884    name = "triangular_solve_expander",
1885    srcs = ["triangular_solve_expander.cc"],
1886    hdrs = ["triangular_solve_expander.h"],
1887    deps = [
1888        ":op_expander_pass",
1889        "//tensorflow/compiler/xla:literal",
1890        "//tensorflow/compiler/xla:shape_util",
1891        "//tensorflow/compiler/xla:status_macros",
1892        "//tensorflow/compiler/xla:statusor",
1893        "//tensorflow/compiler/xla:util",
1894        "//tensorflow/compiler/xla/client:xla_builder",
1895        "//tensorflow/compiler/xla/client:xla_computation",
1896        "//tensorflow/compiler/xla/client/lib:constants",
1897        "//tensorflow/compiler/xla/client/lib:math",
1898        "//tensorflow/compiler/xla/client/lib:matrix",
1899        "//tensorflow/compiler/xla/client/lib:slicing",
1900        "//tensorflow/core:lib",
1901        "@com_google_absl//absl/container:flat_hash_map",
1902        "@com_google_absl//absl/types:span",
1903    ],
1904)
1905
1906tf_cc_test(
1907    name = "triangular_solve_expander_test",
1908    size = "medium",
1909    srcs = ["triangular_solve_expander_test.cc"],
1910    shard_count = 3,
1911    deps = [
1912        ":hlo",
1913        ":triangular_solve_expander",
1914        "//tensorflow/compiler/xla:literal",
1915        "//tensorflow/compiler/xla:reference_util",
1916        "//tensorflow/compiler/xla:test",
1917        "//tensorflow/compiler/xla:types",
1918        "//tensorflow/compiler/xla/tests:hlo_test_base",
1919        "//tensorflow/compiler/xla/tests:verified_hlo_module",
1920        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
1921        "//tensorflow/core:test",
1922        "@com_google_absl//absl/algorithm:container",
1923        "@com_google_absl//absl/memory",
1924    ],
1925)
1926
1927cc_library(
1928    name = "cholesky_expander",
1929    srcs = ["cholesky_expander.cc"],
1930    hdrs = ["cholesky_expander.h"],
1931    deps = [
1932        ":op_expander_pass",
1933        "//tensorflow/compiler/xla:literal",
1934        "//tensorflow/compiler/xla:shape_util",
1935        "//tensorflow/compiler/xla:status_macros",
1936        "//tensorflow/compiler/xla:statusor",
1937        "//tensorflow/compiler/xla:util",
1938        "//tensorflow/compiler/xla/client:xla_builder",
1939        "//tensorflow/compiler/xla/client/lib:arithmetic",
1940        "//tensorflow/compiler/xla/client/lib:constants",
1941        "//tensorflow/compiler/xla/client/lib:loops",
1942        "//tensorflow/compiler/xla/client/lib:math",
1943        "//tensorflow/compiler/xla/client/lib:matrix",
1944        "//tensorflow/compiler/xla/client/lib:slicing",
1945        "//tensorflow/core:lib",
1946        "@com_google_absl//absl/container:flat_hash_map",
1947    ],
1948)
1949
1950cc_library(
1951    name = "qr_expander",
1952    srcs = ["qr_expander.cc"],
1953    hdrs = ["qr_expander.h"],
1954    deps = [
1955        ":op_expander_pass",
1956        "//tensorflow/compiler/xla:literal",
1957        "//tensorflow/compiler/xla:shape_util",
1958        "//tensorflow/compiler/xla:status_macros",
1959        "//tensorflow/compiler/xla:statusor",
1960        "//tensorflow/compiler/xla:util",
1961        "//tensorflow/compiler/xla/client:xla_builder",
1962        "//tensorflow/compiler/xla/client/lib:arithmetic",
1963        "//tensorflow/compiler/xla/client/lib:constants",
1964        "//tensorflow/compiler/xla/client/lib:loops",
1965        "//tensorflow/compiler/xla/client/lib:math",
1966        "//tensorflow/compiler/xla/client/lib:matrix",
1967        "//tensorflow/compiler/xla/client/lib:slicing",
1968        "//tensorflow/core:lib",
1969        "@com_google_absl//absl/container:flat_hash_map",
1970    ],
1971)
1972
1973cc_library(
1974    name = "convolution_4d_expander",
1975    srcs = ["convolution_4d_expander.cc"],
1976    hdrs = ["convolution_4d_expander.h"],
1977    deps = [
1978        ":hlo",
1979        ":op_expander_pass",
1980        "//tensorflow/compiler/xla:shape_util",
1981        "//tensorflow/compiler/xla:status_macros",
1982        "//tensorflow/compiler/xla:statusor",
1983        "//tensorflow/compiler/xla:xla_data_proto_cc",
1984        "@com_google_absl//absl/algorithm:container",
1985        "@com_google_absl//absl/strings",
1986    ],
1987)
1988
1989tf_cc_test(
1990    name = "convolution_4d_expander_test",
1991    srcs = ["convolution_4d_expander_test.cc"],
1992    deps = [
1993        "convolution_4d_expander",
1994        ":hlo",
1995        ":hlo_matchers",
1996        "//tensorflow/compiler/xla:test",
1997        "//tensorflow/compiler/xla:types",
1998        "//tensorflow/compiler/xla/tests:hlo_test_base",
1999        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
2000    ],
2001)
2002
2003tf_cc_test(
2004    name = "batchnorm_expander_test",
2005    size = "small",
2006    srcs = ["batchnorm_expander_test.cc"],
2007    deps = [
2008        ":batchnorm_expander",
2009        ":hlo",
2010        ":hlo_matchers",
2011        ":hlo_parser",
2012        ":hlo_pass",
2013        "//tensorflow/compiler/xla:literal",
2014        "//tensorflow/compiler/xla:shape_util",
2015        "//tensorflow/compiler/xla:test",
2016        "//tensorflow/compiler/xla:types",
2017        "//tensorflow/compiler/xla:util",
2018        "//tensorflow/compiler/xla:xla_data_proto_cc",
2019        "//tensorflow/compiler/xla/tests:hlo_test_base",
2020        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
2021        "//tensorflow/core:lib",
2022        "@com_google_absl//absl/memory",
2023    ],
2024)
2025
2026cc_library(
2027    name = "algebraic_simplifier",
2028    srcs = ["algebraic_simplifier.cc"],
2029    hdrs = ["algebraic_simplifier.h"],
2030    deps = [
2031        ":hlo",
2032        ":hlo_casting_utils",
2033        ":hlo_creation_utils",
2034        ":hlo_evaluator",
2035        ":hlo_pass",
2036        ":hlo_query",
2037        ":pattern_matcher",
2038        "//tensorflow/compiler/xla:comparison_util",
2039        "//tensorflow/compiler/xla:literal",
2040        "//tensorflow/compiler/xla:literal_util",
2041        "//tensorflow/compiler/xla:permutation_util",
2042        "//tensorflow/compiler/xla:shape_util",
2043        "//tensorflow/compiler/xla:status_macros",
2044        "//tensorflow/compiler/xla:types",
2045        "//tensorflow/compiler/xla:util",
2046        "//tensorflow/compiler/xla:window_util",
2047        "//tensorflow/compiler/xla:xla_data_proto_cc",
2048        "//tensorflow/core:lib",
2049        "//tensorflow/core/platform:logging",
2050        "//tensorflow/core/platform:types",
2051        "//tensorflow/stream_executor/lib",
2052        "@com_google_absl//absl/algorithm:container",
2053        "@com_google_absl//absl/container:flat_hash_map",
2054        "@com_google_absl//absl/container:flat_hash_set",
2055        "@com_google_absl//absl/container:inlined_vector",
2056        "@com_google_absl//absl/memory",
2057        "@com_google_absl//absl/strings",
2058        "@com_google_absl//absl/types:optional",
2059        "@com_google_absl//absl/types:span",
2060    ],
2061)
2062
2063cc_library(
2064    name = "tree_reduction_rewriter",
2065    srcs = ["tree_reduction_rewriter.cc"],
2066    hdrs = ["tree_reduction_rewriter.h"],
2067    deps = [
2068        ":hlo",
2069        ":hlo_casting_utils",
2070        ":hlo_creation_utils",
2071        ":hlo_evaluator",
2072        ":hlo_pass",
2073        ":shape_inference",
2074        "//tensorflow/compiler/xla:shape_util",
2075        "//tensorflow/compiler/xla:status_macros",
2076        "//tensorflow/compiler/xla:statusor",
2077        "//tensorflow/compiler/xla:types",
2078        "//tensorflow/compiler/xla:util",
2079        "//tensorflow/compiler/xla:window_util",
2080        "//tensorflow/compiler/xla:xla_data_proto_cc",
2081        "//tensorflow/compiler/xla/client:padding",
2082        "//tensorflow/core:lib",
2083        "//tensorflow/stream_executor/lib",
2084        "@com_google_absl//absl/algorithm:container",
2085        "@com_google_absl//absl/container:flat_hash_map",
2086        "@com_google_absl//absl/container:flat_hash_set",
2087        "@com_google_absl//absl/container:inlined_vector",
2088        "@com_google_absl//absl/memory",
2089        "@com_google_absl//absl/strings",
2090        "@com_google_absl//absl/types:optional",
2091        "@com_google_absl//absl/types:span",
2092    ],
2093)
2094
2095tf_cc_test(
2096    name = "algebraic_simplifier_test",
2097    srcs = ["algebraic_simplifier_test.cc"],
2098    deps = [
2099        ":algebraic_simplifier",
2100        ":hlo",
2101        ":hlo_casting_utils",
2102        ":hlo_creation_utils",
2103        ":hlo_parser",
2104        ":hlo_pass",
2105        ":hlo_pass_pipeline",
2106        ":pattern_matcher",
2107        ":pattern_matcher_gmock",
2108        ":shape_inference",
2109        "//tensorflow/compiler/xla:literal",
2110        "//tensorflow/compiler/xla:shape_util",
2111        "//tensorflow/compiler/xla:test",
2112        "//tensorflow/compiler/xla:types",
2113        "//tensorflow/compiler/xla:util",
2114        "//tensorflow/compiler/xla:window_util",
2115        "//tensorflow/compiler/xla:xla_data_proto_cc",
2116        "//tensorflow/compiler/xla/tests:hlo_test_base",
2117        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
2118        "//tensorflow/core:lib",
2119        "//tensorflow/core:test",
2120        "@com_google_absl//absl/memory",
2121        "@com_google_absl//absl/strings",
2122    ],
2123)
2124
2125cc_library(
2126    name = "logistic_expander",
2127    srcs = ["logistic_expander.cc"],
2128    hdrs = ["logistic_expander.h"],
2129    deps = [
2130        ":hlo",
2131        ":hlo_casting_utils",
2132        ":hlo_creation_utils",
2133        ":hlo_evaluator",
2134        ":hlo_pass",
2135        ":hlo_query",
2136        ":op_expander_pass",
2137        ":pattern_matcher",
2138        "//tensorflow/compiler/xla:comparison_util",
2139        "//tensorflow/compiler/xla:literal",
2140        "//tensorflow/compiler/xla:literal_util",
2141        "//tensorflow/compiler/xla:shape_util",
2142        "//tensorflow/compiler/xla:status_macros",
2143        "//tensorflow/compiler/xla:types",
2144        "//tensorflow/compiler/xla:util",
2145        "//tensorflow/compiler/xla:window_util",
2146        "//tensorflow/compiler/xla:xla_data_proto_cc",
2147        "//tensorflow/core:lib",
2148        "//tensorflow/core/platform:logging",
2149        "//tensorflow/core/platform:types",
2150        "//tensorflow/stream_executor/lib",
2151        "@com_google_absl//absl/algorithm:container",
2152        "@com_google_absl//absl/container:flat_hash_map",
2153        "@com_google_absl//absl/container:flat_hash_set",
2154        "@com_google_absl//absl/container:inlined_vector",
2155        "@com_google_absl//absl/memory",
2156        "@com_google_absl//absl/strings",
2157        "@com_google_absl//absl/types:optional",
2158        "@com_google_absl//absl/types:span",
2159    ],
2160)
2161
2162tf_cc_test(
2163    name = "logistic_expander_test",
2164    srcs = ["logistic_expander_test.cc"],
2165    deps = [
2166        ":hlo",
2167        ":hlo_casting_utils",
2168        ":hlo_creation_utils",
2169        ":hlo_parser",
2170        ":hlo_pass",
2171        ":hlo_pass_pipeline",
2172        ":logistic_expander",
2173        ":pattern_matcher",
2174        ":pattern_matcher_gmock",
2175        ":shape_inference",
2176        "//tensorflow/compiler/xla:literal",
2177        "//tensorflow/compiler/xla:shape_util",
2178        "//tensorflow/compiler/xla:test",
2179        "//tensorflow/compiler/xla:types",
2180        "//tensorflow/compiler/xla:util",
2181        "//tensorflow/compiler/xla:window_util",
2182        "//tensorflow/compiler/xla:xla_data_proto_cc",
2183        "//tensorflow/compiler/xla/tests:hlo_test_base",
2184        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
2185        "//tensorflow/core:lib",
2186        "//tensorflow/core:test",
2187        "@com_google_absl//absl/memory",
2188        "@com_google_absl//absl/strings",
2189    ],
2190)
2191
2192cc_library(
2193    name = "all_reduce_combiner",
2194    srcs = ["all_reduce_combiner.cc"],
2195    hdrs = ["all_reduce_combiner.h"],
2196    deps = [
2197        ":hlo",
2198        ":hlo_casting_utils",
2199        ":hlo_domain_map",
2200        ":hlo_pass",
2201        ":hlo_query",
2202        ":hlo_reachability",
2203        ":shape_inference",
2204        "//tensorflow/compiler/xla:array2d",
2205        "//tensorflow/compiler/xla:literal",
2206        "//tensorflow/compiler/xla:shape_util",
2207        "//tensorflow/compiler/xla:status_macros",
2208        "//tensorflow/compiler/xla:statusor",
2209        "//tensorflow/compiler/xla:xla_data_proto_cc",
2210        "//tensorflow/core:lib",
2211        "@com_google_absl//absl/container:flat_hash_map",
2212        "@com_google_absl//absl/container:flat_hash_set",
2213        "@com_google_absl//absl/strings",
2214    ],
2215)
2216
2217tf_cc_test(
2218    name = "all_reduce_combiner_test",
2219    srcs = ["all_reduce_combiner_test.cc"],
2220    deps = [
2221        ":all_reduce_combiner",
2222        ":hlo",
2223        ":hlo_matchers",
2224        "//tensorflow/compiler/xla:literal",
2225        "//tensorflow/compiler/xla:literal_util",
2226        "//tensorflow/compiler/xla:shape_util",
2227        "//tensorflow/compiler/xla:types",
2228        "//tensorflow/compiler/xla:xla_data_proto_cc",
2229        "//tensorflow/compiler/xla/tests:hlo_test_base",
2230        "//tensorflow/compiler/xla/tests:test_utils",
2231        "//tensorflow/core:lib",
2232        "//tensorflow/core:test",
2233        "//tensorflow/core:test_main",
2234        "@com_google_absl//absl/memory",
2235    ],
2236)
2237
2238cc_library(
2239    name = "all_reduce_simplifier",
2240    srcs = ["all_reduce_simplifier.cc"],
2241    hdrs = ["all_reduce_simplifier.h"],
2242    deps = [
2243        ":hlo",
2244        ":hlo_pass",
2245        ":hlo_replication_analysis",
2246        "//tensorflow/compiler/xla:literal_util",
2247        "//tensorflow/compiler/xla:shape_util",
2248        "//tensorflow/compiler/xla:statusor",
2249    ],
2250)
2251
2252tf_cc_test(
2253    name = "all_reduce_simplifier_test",
2254    srcs = ["all_reduce_simplifier_test.cc"],
2255    deps = [
2256        ":all_reduce_simplifier",
2257        ":hlo",
2258        ":hlo_parser",
2259        ":hlo_pass",
2260        ":pattern_matcher",
2261        ":pattern_matcher_gmock",
2262        "//tensorflow/compiler/xla:literal",
2263        "//tensorflow/compiler/xla:shape_util",
2264        "//tensorflow/compiler/xla:test",
2265        "//tensorflow/compiler/xla:types",
2266        "//tensorflow/compiler/xla:window_util",
2267        "//tensorflow/compiler/xla/tests:hlo_test_base",
2268        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
2269        "//tensorflow/core:lib",
2270        "//tensorflow/core:test",
2271        "@com_google_absl//absl/memory",
2272        "@com_google_absl//absl/strings",
2273    ],
2274)
2275
2276cc_library(
2277    name = "batch_dot_simplification",
2278    srcs = ["batch_dot_simplification.cc"],
2279    hdrs = ["batch_dot_simplification.h"],
2280    deps = [
2281        ":hlo",
2282        ":hlo_creation_utils",
2283        ":hlo_pass",
2284        "@com_google_absl//absl/algorithm:container",
2285    ],
2286)
2287
2288tf_cc_test(
2289    name = "batch_dot_simplification_test",
2290    srcs = ["batch_dot_simplification_test.cc"],
2291    deps = [
2292        ":batch_dot_simplification",
2293        ":hlo",
2294        ":hlo_matchers",
2295        ":hlo_pass",
2296        "//tensorflow/compiler/xla:literal",
2297        "//tensorflow/compiler/xla:shape_util",
2298        "//tensorflow/compiler/xla:test",
2299        "//tensorflow/compiler/xla:types",
2300        "//tensorflow/compiler/xla:util",
2301        "//tensorflow/compiler/xla:window_util",
2302        "//tensorflow/compiler/xla:xla_data_proto_cc",
2303        "//tensorflow/compiler/xla/tests:hlo_test_base",
2304        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
2305        "//tensorflow/core:lib",
2306        "//tensorflow/core:test",
2307    ],
2308)
2309
2310tf_cc_test(
2311    name = "gather_expander_test",
2312    srcs = ["gather_expander_test.cc"],
2313    deps = [
2314        ":gather_expander",
2315        ":hlo_query",
2316        "//tensorflow/compiler/xla:test",
2317        "//tensorflow/compiler/xla/tests:hlo_test_base",
2318        "//tensorflow/compiler/xla/tests:test_macros_header",
2319        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
2320    ],
2321)
2322
2323cc_library(
2324    name = "conditional_simplifier",
2325    srcs = ["conditional_simplifier.cc"],
2326    hdrs = ["conditional_simplifier.h"],
2327    deps = [
2328        ":call_graph",
2329        ":call_inliner",
2330        ":hlo",
2331        ":hlo_pass",
2332        "//tensorflow/compiler/xla:literal",
2333        "//tensorflow/compiler/xla:shape_util",
2334        "//tensorflow/compiler/xla:status_macros",
2335        "//tensorflow/compiler/xla:statusor",
2336        "//tensorflow/compiler/xla:types",
2337        "//tensorflow/compiler/xla:util",
2338        "//tensorflow/core:lib",
2339        "@com_google_absl//absl/algorithm:container",
2340        "@com_google_absl//absl/container:flat_hash_map",
2341        "@com_google_absl//absl/container:flat_hash_set",
2342        "@com_google_absl//absl/strings",
2343    ],
2344)
2345
2346tf_cc_test(
2347    name = "conditional_simplifier_test",
2348    srcs = ["conditional_simplifier_test.cc"],
2349    deps = [
2350        ":conditional_simplifier",
2351        ":hlo",
2352        ":hlo_matchers",
2353        "//tensorflow/compiler/xla:literal",
2354        "//tensorflow/compiler/xla:literal_util",
2355        "//tensorflow/compiler/xla:shape_util",
2356        "//tensorflow/compiler/xla:test",
2357        "//tensorflow/compiler/xla:types",
2358        "//tensorflow/compiler/xla:xla_data_proto_cc",
2359        "//tensorflow/compiler/xla/tests:hlo_test_base",
2360        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
2361        "//tensorflow/core:lib",
2362        "//tensorflow/core:test",
2363        "//tensorflow/stream_executor/lib",
2364    ],
2365)
2366
2367cc_library(
2368    name = "conditional_code_motion",
2369    srcs = ["conditional_code_motion.cc"],
2370    hdrs = ["conditional_code_motion.h"],
2371    deps = [
2372        ":call_graph",
2373        ":call_inliner",
2374        ":hlo",
2375        ":hlo_casting_utils",
2376        ":hlo_cse",
2377        ":hlo_dce",
2378        ":hlo_pass",
2379        ":hlo_pass_pipeline",
2380        ":hlo_verifier",
2381        ":tuple_simplifier",
2382        "//tensorflow/compiler/xla:debug_options_flags",
2383        "//tensorflow/compiler/xla:literal",
2384        "//tensorflow/compiler/xla:shape_util",
2385        "//tensorflow/compiler/xla:status_macros",
2386        "//tensorflow/compiler/xla:statusor",
2387        "//tensorflow/compiler/xla:types",
2388        "//tensorflow/compiler/xla:util",
2389        "//tensorflow/core:lib",
2390        "@com_google_absl//absl/algorithm:container",
2391        "@com_google_absl//absl/strings",
2392    ],
2393)
2394
2395tf_cc_test(
2396    name = "conditional_code_motion_test",
2397    srcs = ["conditional_code_motion_test.cc"],
2398    deps = [
2399        ":conditional_code_motion",
2400        ":hlo",
2401        ":hlo_matchers",
2402        "//tensorflow/compiler/xla:literal",
2403        "//tensorflow/compiler/xla:literal_util",
2404        "//tensorflow/compiler/xla:shape_util",
2405        "//tensorflow/compiler/xla:test",
2406        "//tensorflow/compiler/xla:types",
2407        "//tensorflow/compiler/xla:xla_data_proto_cc",
2408        "//tensorflow/compiler/xla/tests:hlo_test_base",
2409        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
2410        "//tensorflow/core:lib",
2411        "//tensorflow/core:test",
2412        "@com_google_absl//absl/flags:flag",
2413    ],
2414)
2415
2416cc_library(
2417    name = "convolution_group_converter",
2418    srcs = ["convolution_group_converter.cc"],
2419    hdrs = ["convolution_group_converter.h"],
2420    deps = [
2421        ":hlo",
2422        ":hlo_creation_utils",
2423        ":hlo_pass",
2424        "//tensorflow/compiler/xla:literal",
2425        "//tensorflow/compiler/xla:literal_util",
2426        "//tensorflow/compiler/xla:shape_util",
2427        "//tensorflow/compiler/xla:status_macros",
2428        "//tensorflow/compiler/xla:types",
2429        "//tensorflow/compiler/xla:util",
2430        "//tensorflow/compiler/xla:xla_data_proto_cc",
2431        "//tensorflow/core:lib",
2432        "@com_google_absl//absl/memory",
2433        "@com_google_absl//absl/strings",
2434    ],
2435)
2436
2437tf_cc_test(
2438    name = "convolution_group_converter_test",
2439    size = "small",
2440    srcs = ["convolution_group_converter_test.cc"],
2441    deps = [
2442        ":convolution_group_converter",
2443        ":hlo",
2444        ":hlo_matchers",
2445        "//tensorflow/compiler/xla:test",
2446        "//tensorflow/compiler/xla:types",
2447        "//tensorflow/compiler/xla/tests:hlo_test_base",
2448        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
2449    ],
2450)
2451
2452cc_library(
2453    name = "space_to_batch_converter",
2454    srcs = ["space_to_batch_converter.cc"],
2455    hdrs = ["space_to_batch_converter.h"],
2456    deps = [
2457        ":hlo",
2458        ":hlo_creation_utils",
2459        ":hlo_pass",
2460        ":pattern_matcher",
2461        ":shape_inference",
2462        "//tensorflow/compiler/xla:literal",
2463        "//tensorflow/compiler/xla:literal_util",
2464        "//tensorflow/compiler/xla:shape_util",
2465        "//tensorflow/compiler/xla:status_macros",
2466        "//tensorflow/compiler/xla:types",
2467        "//tensorflow/compiler/xla:util",
2468        "//tensorflow/compiler/xla:xla_data_proto_cc",
2469        "//tensorflow/core:lib",
2470        "//tensorflow/stream_executor/lib",
2471        "@com_google_absl//absl/algorithm",
2472        "@com_google_absl//absl/algorithm:container",
2473        "@com_google_absl//absl/container:flat_hash_map",
2474        "@com_google_absl//absl/container:flat_hash_set",
2475        "@com_google_absl//absl/memory",
2476        "@com_google_absl//absl/strings",
2477        "@com_google_absl//absl/types:span",
2478    ],
2479)
2480
2481tf_cc_test(
2482    name = "space_to_batch_converter_test",
2483    size = "small",
2484    srcs = ["space_to_batch_converter_test.cc"],
2485    deps = [
2486        ":hlo",
2487        ":hlo_matchers",
2488        ":space_to_batch_converter",
2489        "//tensorflow/compiler/xla:test",
2490        "//tensorflow/compiler/xla:types",
2491        "//tensorflow/compiler/xla/tests:hlo_test_base",
2492        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
2493    ],
2494)
2495
2496cc_library(
2497    name = "while_loop_analysis",
2498    srcs = ["while_loop_analysis.cc"],
2499    hdrs = ["while_loop_analysis.h"],
2500    deps = [
2501        ":hlo",
2502        ":hlo_evaluator",
2503        ":pattern_matcher",
2504        "//tensorflow/compiler/xla/service:hlo_reachability",
2505        "@com_google_absl//absl/base",
2506        "@com_google_absl//absl/types:optional",
2507    ],
2508)
2509
2510tf_cc_test(
2511    name = "while_loop_analysis_test",
2512    srcs = ["while_loop_analysis_test.cc"],
2513    deps = [
2514        ":hlo_parser",
2515        ":while_loop_analysis",
2516        "//tensorflow/compiler/xla:test",
2517        "//tensorflow/compiler/xla/tests:hlo_test_base",
2518        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
2519        "//tensorflow/core:test",
2520    ],
2521)
2522
2523cc_library(
2524    name = "while_loop_simplifier",
2525    srcs = ["while_loop_simplifier.cc"],
2526    hdrs = ["while_loop_simplifier.h"],
2527    deps = [
2528        ":call_inliner",
2529        ":hlo",
2530        ":hlo_pass",
2531        ":hlo_query",
2532        ":pattern_matcher",
2533        ":while_loop_analysis",
2534        "//tensorflow/compiler/xla:shape_util",
2535        "//tensorflow/compiler/xla:statusor",
2536        "@com_google_absl//absl/algorithm:container",
2537        "@com_google_absl//absl/container:flat_hash_map",
2538        "@com_google_absl//absl/container:flat_hash_set",
2539        "@com_google_absl//absl/strings",
2540        "@com_google_absl//absl/types:optional",
2541    ],
2542)
2543
2544tf_cc_test(
2545    name = "while_loop_simplifier_test",
2546    srcs = ["while_loop_simplifier_test.cc"],
2547    deps = [
2548        ":algebraic_simplifier",
2549        ":hlo",
2550        ":hlo_cse",
2551        ":hlo_dce",
2552        ":hlo_matchers",
2553        ":hlo_parser",
2554        ":hlo_pass",
2555        ":hlo_pass_pipeline",
2556        ":tuple_simplifier",
2557        ":while_loop_simplifier",
2558        "//tensorflow/compiler/xla:test",
2559        "//tensorflow/compiler/xla/tests:hlo_test_base",
2560        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
2561        "//tensorflow/core:lib",
2562        "//tensorflow/core:test",
2563        "@com_google_absl//absl/strings",
2564    ],
2565)
2566
2567cc_library(
2568    name = "while_loop_trip_count_annotator",
2569    srcs = ["while_loop_trip_count_annotator.cc"],
2570    hdrs = ["while_loop_trip_count_annotator.h"],
2571    deps = [
2572        ":hlo",
2573        ":hlo_pass",
2574        ":while_loop_analysis",
2575        "//tensorflow/compiler/xla:statusor",
2576        "//tensorflow/compiler/xla:xla_data_proto_cc",
2577    ],
2578)
2579
2580tf_cc_test(
2581    name = "while_loop_trip_count_annotator_test",
2582    srcs = ["while_loop_trip_count_annotator_test.cc"],
2583    deps = [
2584        ":pattern_matcher",
2585        ":while_loop_simplifier",
2586        ":while_loop_trip_count_annotator",
2587        "//tensorflow/compiler/xla:literal",
2588        "//tensorflow/compiler/xla:shape_util",
2589        "//tensorflow/compiler/xla:status_macros",
2590        "//tensorflow/compiler/xla:test",
2591        "//tensorflow/compiler/xla/tests:hlo_test_base",
2592        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
2593        "//tensorflow/core:test",
2594    ],
2595)
2596
2597cc_library(
2598    name = "defuser",
2599    srcs = ["defuser.cc"],
2600    hdrs = ["defuser.h"],
2601    deps = [
2602        ":call_graph",
2603        ":hlo",
2604        ":hlo_pass",
2605        "//tensorflow/compiler/xla:status_macros",
2606        "//tensorflow/compiler/xla:types",
2607        "//tensorflow/compiler/xla:util",
2608        "//tensorflow/core:lib",
2609        "@com_google_absl//absl/container:flat_hash_map",
2610    ],
2611)
2612
2613tf_cc_test(
2614    name = "defuser_test",
2615    srcs = ["defuser_test.cc"],
2616    deps = [
2617        ":defuser",
2618        ":hlo_matchers",
2619        "//tensorflow/compiler/xla:literal",
2620        "//tensorflow/compiler/xla:shape_util",
2621        "//tensorflow/compiler/xla/tests:hlo_test_base",
2622        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
2623    ],
2624)
2625
2626cc_library(
2627    name = "dot_decomposer",
2628    srcs = ["dot_decomposer.cc"],
2629    hdrs = ["dot_decomposer.h"],
2630    deps = [
2631        ":hlo",
2632        ":hlo_pass",
2633        "//tensorflow/compiler/xla:permutation_util",
2634        "//tensorflow/compiler/xla:shape_util",
2635        "//tensorflow/compiler/xla:status_macros",
2636        "//tensorflow/compiler/xla:types",
2637        "//tensorflow/core:lib",
2638        "@com_google_absl//absl/algorithm:container",
2639        "@com_google_absl//absl/strings",
2640    ],
2641)
2642
2643tf_cc_test(
2644    name = "dot_decomposer_test",
2645    srcs = ["dot_decomposer_test.cc"],
2646    deps = [
2647        ":dot_decomposer",
2648        ":hlo_matchers",
2649        ":hlo_parser",
2650        "//tensorflow/compiler/xla/tests:hlo_test_base",
2651        "//tensorflow/compiler/xla/tests:test_utils",
2652        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
2653    ],
2654)
2655
2656cc_library(
2657    name = "all_to_all_decomposer",
2658    srcs = ["all_to_all_decomposer.cc"],
2659    hdrs = ["all_to_all_decomposer.h"],
2660    deps = [
2661        ":hlo",
2662        ":hlo_casting_utils",
2663        ":hlo_pass",
2664        ":op_expander_pass",
2665        "//tensorflow/compiler/xla:literal_util",
2666        "//tensorflow/compiler/xla:shape_util",
2667        "//tensorflow/compiler/xla:status_macros",
2668        "//tensorflow/compiler/xla:types",
2669        "//tensorflow/compiler/xla:util",
2670        "//tensorflow/core:lib",
2671        "@com_google_absl//absl/algorithm:container",
2672        "@com_google_absl//absl/strings",
2673        "@com_google_absl//absl/types:optional",
2674    ],
2675)
2676
2677cc_library(
2678    name = "all_gather_decomposer",
2679    srcs = ["all_gather_decomposer.cc"],
2680    hdrs = ["all_gather_decomposer.h"],
2681    deps = [
2682        ":hlo",
2683        ":hlo_casting_utils",
2684        ":hlo_pass",
2685        "//tensorflow/compiler/xla:literal_util",
2686        "//tensorflow/compiler/xla:shape_util",
2687        "//tensorflow/compiler/xla:status_macros",
2688        "//tensorflow/compiler/xla:types",
2689        "//tensorflow/core:lib",
2690        "@com_google_absl//absl/algorithm:container",
2691        "@com_google_absl//absl/strings",
2692    ],
2693)
2694
2695tf_cc_test(
2696    name = "all_gather_decomposer_test",
2697    srcs = ["all_gather_decomposer_test.cc"],
2698    deps = [
2699        ":all_gather_decomposer",
2700        ":hlo",
2701        ":hlo_matchers",
2702        ":hlo_parser",
2703        "//tensorflow/compiler/xla:status_macros",
2704        "//tensorflow/compiler/xla:types",
2705        "//tensorflow/compiler/xla/tests:hlo_test_base",
2706        "//tensorflow/compiler/xla/tests:test_utils",
2707        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
2708        "//tensorflow/core:lib",
2709        "//tensorflow/core:test",
2710    ],
2711)
2712
2713cc_library(
2714    name = "tuple_simplifier",
2715    srcs = ["tuple_simplifier.cc"],
2716    hdrs = ["tuple_simplifier.h"],
2717    deps = [
2718        ":hlo",
2719        ":hlo_pass",
2720        "//tensorflow/compiler/xla:status_macros",
2721        "//tensorflow/compiler/xla:types",
2722        "//tensorflow/compiler/xla:util",
2723        "//tensorflow/core:lib",
2724    ],
2725)
2726
2727tf_cc_test(
2728    name = "tuple_simplifier_test",
2729    srcs = ["tuple_simplifier_test.cc"],
2730    deps = [
2731        ":hlo",
2732        ":hlo_matchers",
2733        ":tuple_simplifier",
2734        "//tensorflow/compiler/xla:literal",
2735        "//tensorflow/compiler/xla:shape_util",
2736        "//tensorflow/compiler/xla:test",
2737        "//tensorflow/compiler/xla:types",
2738        "//tensorflow/compiler/xla/tests:hlo_test_base",
2739        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
2740        "//tensorflow/core:test",
2741    ],
2742)
2743
2744cc_library(
2745    name = "reshape_mover",
2746    srcs = ["reshape_mover.cc"],
2747    hdrs = ["reshape_mover.h"],
2748    deps = [
2749        ":hlo_pass",
2750        "//tensorflow/compiler/xla:literal",
2751        "//tensorflow/compiler/xla:permutation_util",
2752        "//tensorflow/compiler/xla:shape_util",
2753        "//tensorflow/compiler/xla:status_macros",
2754        "//tensorflow/compiler/xla:util",
2755        "//tensorflow/core:lib",
2756        "@com_google_absl//absl/algorithm:container",
2757    ],
2758)
2759
2760cc_library(
2761    name = "dynamic_window_utils",
2762    srcs = ["dynamic_window_utils.cc"],
2763    hdrs = ["dynamic_window_utils.h"],
2764    deps = [
2765        ":hlo",
2766        ":shape_inference",
2767        "//tensorflow/compiler/xla:literal",
2768        "//tensorflow/compiler/xla:literal_util",
2769        "//tensorflow/compiler/xla:status",
2770        "//tensorflow/compiler/xla:statusor",
2771        "//tensorflow/compiler/xla:types",
2772        "//tensorflow/core/platform:macros",
2773    ],
2774)
2775
2776cc_library(
2777    name = "dynamic_dimension_inference",
2778    srcs = ["dynamic_dimension_inference.cc"],
2779    hdrs = ["dynamic_dimension_inference.h"],
2780    deps = [
2781        ":dynamic_window_utils",
2782        ":hlo",
2783        ":hlo_casting_utils",
2784        ":tuple_util",
2785        ":while_util",
2786        "//tensorflow/compiler/xla:literal_util",
2787        "//tensorflow/compiler/xla:shape_tree",
2788        "//tensorflow/compiler/xla:shape_util",
2789        "//tensorflow/compiler/xla:status",
2790        "//tensorflow/compiler/xla:status_macros",
2791        "//tensorflow/compiler/xla:statusor",
2792        "//tensorflow/compiler/xla:types",
2793        "//tensorflow/compiler/xla:util",
2794        "//tensorflow/compiler/xla:window_util",
2795        "//tensorflow/core/platform:macros",
2796        "@com_google_absl//absl/container:flat_hash_map",
2797        "@com_google_absl//absl/strings",
2798        "@com_google_absl//absl/types:span",
2799    ],
2800)
2801
2802cc_library(
2803    name = "dynamic_padder",
2804    srcs = ["dynamic_padder.cc"],
2805    hdrs = ["dynamic_padder.h"],
2806    deps = [
2807        ":dynamic_dimension_inference",
2808        ":dynamic_window_utils",
2809        ":hlo",
2810        ":hlo_casting_utils",
2811        ":hlo_creation_utils",
2812        ":hlo_dce",
2813        ":hlo_pass",
2814        ":hlo_verifier",
2815        ":pattern_matcher",
2816        ":shape_inference",
2817        "//tensorflow/compiler/xla:comparison_util",
2818        "//tensorflow/compiler/xla:literal",
2819        "//tensorflow/compiler/xla:literal_util",
2820        "//tensorflow/compiler/xla:shape_util",
2821        "//tensorflow/compiler/xla:status_macros",
2822        "//tensorflow/compiler/xla:util",
2823        "//tensorflow/compiler/xla:window_util",
2824        "//tensorflow/compiler/xla:xla_data_proto_cc",
2825        "//tensorflow/compiler/xla/client:xla_builder",
2826        "//tensorflow/core:lib",
2827        "@com_google_absl//absl/algorithm:container",
2828        "@com_google_absl//absl/container:flat_hash_map",
2829        "@com_google_absl//absl/container:flat_hash_set",
2830        "@com_google_absl//absl/strings:str_format",
2831    ],
2832)
2833
2834xla_test(
2835    name = "dynamic_padder_test",
2836    srcs = ["dynamic_padder_test.cc"],
2837    deps = [
2838        ":dynamic_padder",
2839        ":hlo",
2840        ":hlo_dce",
2841        ":hlo_matchers",
2842        ":hlo_parser",
2843        "//tensorflow/compiler/xla:debug_options_flags",
2844        "//tensorflow/compiler/xla:literal",
2845        "//tensorflow/compiler/xla:shape_util",
2846        "//tensorflow/compiler/xla:status_macros",
2847        "//tensorflow/compiler/xla:test",
2848        "//tensorflow/compiler/xla:test_helpers",
2849        "//tensorflow/compiler/xla:util",
2850        "//tensorflow/compiler/xla:xla_data_proto_cc",
2851        "//tensorflow/compiler/xla/client:xla_builder",
2852        "//tensorflow/compiler/xla/tests:client_library_test_base",
2853        "//tensorflow/compiler/xla/tests:hlo_test_base",
2854        "//tensorflow/compiler/xla/tests:literal_test_util",
2855        "//tensorflow/compiler/xla/tests:test_macros_header",
2856        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
2857        "//tensorflow/core:test",
2858        "@com_google_absl//absl/strings",
2859    ],
2860)
2861
2862tf_cc_test(
2863    name = "dynamic_dimension_inference_test",
2864    srcs = ["dynamic_dimension_inference_test.cc"],
2865    deps = [
2866        ":dynamic_dimension_inference",
2867        ":hlo",
2868        ":hlo_casting_utils",
2869        ":hlo_matchers",
2870        ":hlo_runner",
2871        "//tensorflow/compiler/xla:debug_options_flags",
2872        "//tensorflow/compiler/xla:literal",
2873        "//tensorflow/compiler/xla:shape_util",
2874        "//tensorflow/compiler/xla:test",
2875        "//tensorflow/compiler/xla:test_helpers",
2876        "//tensorflow/compiler/xla:xla_data_proto_cc",
2877        "//tensorflow/compiler/xla/client:xla_builder",
2878        "//tensorflow/compiler/xla/tests:hlo_test_base",
2879        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
2880        "//tensorflow/core:test",
2881    ],
2882)
2883
2884tf_cc_test(
2885    name = "reshape_mover_test",
2886    srcs = ["reshape_mover_test.cc"],
2887    deps = [
2888        ":hlo",
2889        ":hlo_matchers",
2890        ":reshape_mover",
2891        "//tensorflow/compiler/xla:literal",
2892        "//tensorflow/compiler/xla:shape_util",
2893        "//tensorflow/compiler/xla:test",
2894        "//tensorflow/compiler/xla:test_helpers",
2895        "//tensorflow/compiler/xla:types",
2896        "//tensorflow/compiler/xla:util",
2897        "//tensorflow/compiler/xla:xla_data_proto_cc",
2898        "//tensorflow/compiler/xla/tests:hlo_test_base",
2899        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
2900        "//tensorflow/core:lib",
2901        "@com_google_absl//absl/memory",
2902    ],
2903)
2904
2905cc_library(
2906    name = "computation_placer",
2907    srcs = ["computation_placer.cc"],
2908    hdrs = ["computation_placer.h"],
2909    deps = [
2910        ":global_device_id",
2911        "@com_google_absl//absl/memory",
2912        "@com_google_absl//absl/strings",
2913        "@com_google_absl//absl/types:optional",
2914        "//tensorflow/compiler/xla:array2d",
2915        "//tensorflow/compiler/xla:literal",
2916        "//tensorflow/compiler/xla:shape_util",
2917        "//tensorflow/compiler/xla:status",
2918        "//tensorflow/compiler/xla:status_macros",
2919        "//tensorflow/compiler/xla:statusor",
2920        "//tensorflow/compiler/xla:types",
2921        "//tensorflow/compiler/xla:util",
2922        "//tensorflow/compiler/xla:xla_data_proto_cc",
2923        "//tensorflow/core:lib",
2924        "//tensorflow/core/platform:stream_executor_no_cuda",
2925        "//tensorflow/stream_executor:platform",
2926        "//tensorflow/stream_executor/cuda:cuda_platform_id",
2927        "//tensorflow/stream_executor/host:host_platform_id",
2928        "//tensorflow/stream_executor/rocm:rocm_platform_id",
2929    ] + if_libtpu([":tpu_computation_placer"]),
2930    alwayslink = True,  # Contains per-platform computation placer registration
2931)
2932
2933cc_library(
2934    name = "computation_placer_hdr",
2935    hdrs = ["computation_placer.h"],
2936    deps = [
2937        ":global_device_id",
2938        "//tensorflow/compiler/xla:array2d",
2939        "//tensorflow/compiler/xla:status",
2940        "//tensorflow/compiler/xla:statusor",
2941        "//tensorflow/compiler/xla:xla_data_proto_cc",
2942        "//tensorflow/core:framework_lite",
2943        "//tensorflow/core:lib_proto_parsing",
2944        "//tensorflow/core:tflite_portable_logging",
2945        "//tensorflow/core/platform:macros",
2946        "//tensorflow/stream_executor:stream_header",
2947    ],
2948)
2949
2950cc_library(
2951    name = "tpu_computation_placer",
2952    srcs = ["tpu_computation_placer.cc"],
2953    hdrs = ["tpu_computation_placer.h"],
2954    visibility = ["//visibility:public"],
2955    deps = [
2956        ":computation_placer_hdr",
2957        "//tensorflow/compiler/xla:statusor",
2958        "//tensorflow/core/tpu:tpu_api",
2959        "//tensorflow/stream_executor/tpu:status_helper",
2960        "//tensorflow/stream_executor/tpu:tpu_executor_c_api_hdrs",
2961        "//tensorflow/stream_executor/tpu:tpu_platform_hdr",
2962        "//tensorflow/stream_executor/tpu:tpu_platform_id",
2963        "//tensorflow/stream_executor/tpu:tpu_topology_external",
2964    ],
2965    alwayslink = True,  # Contains TPU computation placer registration
2966)
2967
2968cc_library(
2969    name = "human_readable_profile_builder",
2970    srcs = ["human_readable_profile_builder.cc"],
2971    hdrs = ["human_readable_profile_builder.h"],
2972    deps = [
2973        "//tensorflow/compiler/xla:metric_table_report",
2974        "//tensorflow/compiler/xla:types",
2975        "//tensorflow/compiler/xla:util",
2976        "//tensorflow/core:lib",
2977        "@com_google_absl//absl/strings",
2978        "@com_google_absl//absl/strings:str_format",
2979    ],
2980)
2981
2982cc_library(
2983    name = "generic_transfer_manager",
2984    srcs = ["generic_transfer_manager.cc"],
2985    hdrs = ["generic_transfer_manager.h"],
2986    deps = [
2987        ":transfer_manager",
2988        "//tensorflow/compiler/xla:literal",
2989        "//tensorflow/compiler/xla:shape_util",
2990        "//tensorflow/compiler/xla:status_macros",
2991        "//tensorflow/compiler/xla:types",
2992        "//tensorflow/compiler/xla:util",
2993        "//tensorflow/compiler/xla:xla_data_proto_cc",
2994        "//tensorflow/core:lib",
2995        "//tensorflow/core/platform:stream_executor_no_cuda",
2996    ],
2997    alwayslink = True,  # Contains per-platform transfer manager registration
2998)
2999
3000cc_library(
3001    name = "hlo_cost_analysis",
3002    srcs = ["hlo_cost_analysis.cc"],
3003    hdrs = ["hlo_cost_analysis.h"],
3004    deps = [
3005        ":hlo",
3006        "//tensorflow/compiler/xla:shape_util",
3007        "//tensorflow/compiler/xla:status_macros",
3008        "//tensorflow/compiler/xla:statusor",
3009        "//tensorflow/compiler/xla:util",
3010        "//tensorflow/compiler/xla:window_util",
3011        "//tensorflow/compiler/xla:xla_data_proto_cc",
3012        "//tensorflow/core:lib",
3013        "//tensorflow/core:lib_internal",
3014        "@com_google_absl//absl/algorithm:container",
3015        "@com_google_absl//absl/memory",
3016        "@com_google_absl//absl/types:span",
3017    ],
3018)
3019
3020tf_cc_test(
3021    name = "hlo_cost_analysis_test",
3022    srcs = ["hlo_cost_analysis_test.cc"],
3023    deps = [
3024        ":cpu_plugin",
3025        ":hlo",
3026        ":hlo_cost_analysis",
3027        ":local_service",
3028        ":service",
3029        "//tensorflow/compiler/xla:shape_util",
3030        "//tensorflow/compiler/xla:statusor",
3031        "//tensorflow/compiler/xla:test_helpers",
3032        "//tensorflow/compiler/xla:xla_data_proto_cc",
3033        "//tensorflow/compiler/xla/client",
3034        "//tensorflow/compiler/xla/client:client_library",
3035        "//tensorflow/compiler/xla/client:local_client",
3036        "//tensorflow/compiler/xla/client:padding",
3037        "//tensorflow/compiler/xla/client:xla_builder",
3038        "//tensorflow/compiler/xla/client:xla_computation",
3039        "//tensorflow/compiler/xla/tests:hlo_test_base",
3040        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3041        "//tensorflow/core:lib",
3042    ],
3043)
3044
3045cc_library(
3046    name = "hlo_execution_profile",
3047    srcs = ["hlo_execution_profile.cc"],
3048    hdrs = ["hlo_execution_profile.h"],
3049    deps = [
3050        ":hlo",
3051        ":hlo_cost_analysis",
3052        ":hlo_execution_profile_data_cc",
3053        ":hlo_profile_printer",
3054        ":human_readable_profile_builder",
3055        "//tensorflow/compiler/xla:types",
3056        "//tensorflow/compiler/xla:util",
3057        "//tensorflow/core:lib",
3058        "@com_google_absl//absl/algorithm:container",
3059        "@com_google_absl//absl/memory",
3060    ],
3061)
3062
3063tf_cc_test(
3064    name = "hlo_execution_profile_test",
3065    srcs = ["hlo_execution_profile_test.cc"],
3066    deps = [
3067        ":cpu_plugin",
3068        ":hlo_cost_analysis",
3069        ":hlo_execution_profile",
3070        "//tensorflow/compiler/xla/tests:hlo_test_base",
3071        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3072        "//tensorflow/core:lib",
3073        "@com_google_absl//absl/strings",
3074    ],
3075)
3076
3077tf_cc_test(
3078    name = "hlo_computation_test",
3079    srcs = ["hlo_computation_test.cc"],
3080    deps = [
3081        ":hlo",
3082        ":hlo_matchers",
3083        ":pattern_matcher",
3084        ":pattern_matcher_gmock",
3085        "//tensorflow/compiler/xla:literal",
3086        "//tensorflow/compiler/xla:shape_util",
3087        "//tensorflow/compiler/xla:test",
3088        "//tensorflow/compiler/xla:test_helpers",
3089        "//tensorflow/compiler/xla/tests:hlo_test_base",
3090        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3091        "@com_google_absl//absl/container:flat_hash_map",
3092        "@com_google_absl//absl/container:flat_hash_set",
3093    ],
3094)
3095
3096tf_cc_test(
3097    name = "hlo_module_test",
3098    srcs = ["hlo_module_test.cc"],
3099    deps = [
3100        ":hlo",
3101        ":hlo_matchers",
3102        ":hlo_memory_scheduler",
3103        "//tensorflow/compiler/xla:literal",
3104        "//tensorflow/compiler/xla:shape_util",
3105        "//tensorflow/compiler/xla:test",
3106        "//tensorflow/compiler/xla:util",
3107        "//tensorflow/compiler/xla:xla_data_proto_cc",
3108        "//tensorflow/compiler/xla/tests:hlo_test_base",
3109        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3110        "//tensorflow/core:lib",
3111        "//tensorflow/core:test",
3112        "@com_google_absl//absl/container:flat_hash_set",
3113        "@com_google_absl//absl/memory",
3114        "@com_google_absl//absl/types:span",
3115    ],
3116)
3117
3118tf_cc_test(
3119    name = "hlo_module_metadata_test",
3120    srcs = ["hlo_module_metadata_test.cc"],
3121    deps = [
3122        ":hlo",
3123        "//tensorflow/compiler/xla:test",
3124        "//tensorflow/compiler/xla:test_helpers",
3125        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3126        "//tensorflow/stream_executor/lib",
3127    ],
3128)
3129
3130cc_library(
3131    name = "buffer_value",
3132    srcs = ["buffer_value.cc"],
3133    hdrs = ["buffer_value.h"],
3134    deps = [
3135        ":hlo",
3136        ":hlo_proto_cc",
3137        "//tensorflow/compiler/xla:shape_util",
3138        "//tensorflow/compiler/xla:types",
3139        "//tensorflow/compiler/xla:xla_data_proto_cc",
3140        "//tensorflow/core:lib",
3141        "//tensorflow/core:lib_internal",
3142        "@com_google_absl//absl/strings",
3143        "@com_google_absl//absl/types:span",
3144    ],
3145)
3146
3147cc_library(
3148    name = "buffer_value_containers",
3149    hdrs = ["buffer_value_containers.h"],
3150    deps = [
3151        ":buffer_value",
3152        ":logical_buffer",
3153        "//tensorflow/core:lib",
3154        "//tensorflow/core:lib_internal",
3155        "@com_google_absl//absl/container:flat_hash_set",
3156    ],
3157)
3158
3159cc_library(
3160    name = "logical_buffer",
3161    srcs = ["logical_buffer.cc"],
3162    hdrs = ["logical_buffer.h"],
3163    deps = [
3164        ":buffer_value",
3165        ":hlo",
3166        ":hlo_proto_cc",
3167        "//tensorflow/compiler/xla:shape_util",
3168        "//tensorflow/compiler/xla:types",
3169        "//tensorflow/compiler/xla:xla_data_proto_cc",
3170        "//tensorflow/core:lib",
3171        "//tensorflow/core:lib_internal",
3172        "@com_google_absl//absl/strings",
3173        "@com_google_absl//absl/types:span",
3174    ],
3175)
3176
3177cc_library(
3178    name = "hlo_value",
3179    srcs = ["hlo_value.cc"],
3180    hdrs = ["hlo_value.h"],
3181    deps = [
3182        ":buffer_value",
3183        ":hlo",
3184        "//tensorflow/compiler/xla:shape_tree",
3185        "//tensorflow/compiler/xla:shape_util",
3186        "//tensorflow/compiler/xla:status",
3187        "//tensorflow/compiler/xla:types",
3188        "//tensorflow/compiler/xla:util",
3189        "//tensorflow/compiler/xla:xla_data_proto_cc",
3190        "//tensorflow/core:lib",
3191        "//tensorflow/core/platform:logging",
3192        "//tensorflow/core/platform:macros",
3193        "//tensorflow/core/platform:types",
3194        "@com_google_absl//absl/container:flat_hash_set",
3195        "@com_google_absl//absl/memory",
3196        "@com_google_absl//absl/strings",
3197        "@com_google_absl//absl/strings:str_format",
3198        "@com_google_absl//absl/types:span",
3199    ],
3200)
3201
3202cc_library(
3203    name = "hlo_dataflow_analysis",
3204    srcs = ["hlo_dataflow_analysis.cc"],
3205    hdrs = ["hlo_dataflow_analysis.h"],
3206    deps = [
3207        ":call_graph",
3208        ":hlo",
3209        ":hlo_casting_utils",
3210        ":hlo_phi_graph",
3211        ":hlo_value",
3212        "//tensorflow/compiler/xla:shape_util",
3213        "//tensorflow/compiler/xla:status",
3214        "//tensorflow/compiler/xla:statusor",
3215        "//tensorflow/compiler/xla:types",
3216        "//tensorflow/compiler/xla:util",
3217        "//tensorflow/compiler/xla:xla_data_proto_cc",
3218        "//tensorflow/core:lib",
3219        "@com_google_absl//absl/algorithm:container",
3220        "@com_google_absl//absl/container:flat_hash_map",
3221        "@com_google_absl//absl/container:flat_hash_set",
3222        "@com_google_absl//absl/container:inlined_vector",
3223        "@com_google_absl//absl/memory",
3224        "@com_google_absl//absl/strings",
3225        "@com_google_absl//absl/types:optional",
3226        "@com_google_absl//absl/types:span",
3227    ],
3228)
3229
3230tf_cc_test(
3231    name = "hlo_dataflow_analysis_test",
3232    srcs = ["hlo_dataflow_analysis_test.cc"],
3233    deps = [
3234        ":flatten_call_graph",
3235        ":hlo",
3236        ":hlo_creation_utils",
3237        ":hlo_dataflow_analysis",
3238        ":hlo_graph_dumper",
3239        ":hlo_matchers",
3240        ":hlo_ordering",
3241        ":instruction_fusion",
3242        "//tensorflow/compiler/xla:literal",
3243        "//tensorflow/compiler/xla:shape_util",
3244        "//tensorflow/compiler/xla:status_macros",
3245        "//tensorflow/compiler/xla:test",
3246        "//tensorflow/compiler/xla:test_helpers",
3247        "//tensorflow/compiler/xla:xla_data_proto_cc",
3248        "//tensorflow/compiler/xla/tests:hlo_test_base",
3249        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3250        "//tensorflow/core:lib",
3251        "//tensorflow/core:test",
3252    ],
3253)
3254
3255cc_library(
3256    name = "hlo_phi_graph",
3257    srcs = ["hlo_phi_graph.cc"],
3258    hdrs = ["hlo_phi_graph.h"],
3259    deps = [
3260        ":call_graph",
3261        ":hlo",
3262        ":hlo_casting_utils",
3263        ":hlo_value",
3264        "//tensorflow/compiler/xla:shape_util",
3265        "//tensorflow/compiler/xla:status",
3266        "//tensorflow/compiler/xla:statusor",
3267        "//tensorflow/compiler/xla:types",
3268        "//tensorflow/compiler/xla:util",
3269        "//tensorflow/core:lib",
3270        "@com_google_absl//absl/algorithm:container",
3271        "@com_google_absl//absl/container:flat_hash_map",
3272        "@com_google_absl//absl/container:flat_hash_set",
3273        "@com_google_absl//absl/container:inlined_vector",
3274        "@com_google_absl//absl/memory",
3275        "@com_google_absl//absl/strings",
3276        "@com_google_absl//absl/types:span",
3277    ],
3278)
3279
3280tf_cc_test(
3281    name = "hlo_phi_graph_test",
3282    srcs = ["hlo_phi_graph_test.cc"],
3283    deps = [
3284        ":hlo",
3285        ":hlo_dataflow_analysis",
3286        ":hlo_graph_dumper",
3287        ":hlo_matchers",
3288        ":hlo_ordering",
3289        ":hlo_phi_graph",
3290        "//tensorflow/compiler/xla:literal",
3291        "//tensorflow/compiler/xla:literal_util",
3292        "//tensorflow/compiler/xla:shape_util",
3293        "//tensorflow/compiler/xla:status_macros",
3294        "//tensorflow/compiler/xla:test",
3295        "//tensorflow/compiler/xla:test_helpers",
3296        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3297        "//tensorflow/core:lib",
3298        "//tensorflow/core:test",
3299    ],
3300)
3301
3302cc_library(
3303    name = "hlo_replication_analysis",
3304    srcs = ["hlo_replication_analysis.cc"],
3305    hdrs = ["hlo_replication_analysis.h"],
3306    deps = [
3307        ":hlo",
3308        ":hlo_casting_utils",
3309        "//tensorflow/compiler/xla:shape_util",
3310        "//tensorflow/compiler/xla:statusor",
3311        "//tensorflow/compiler/xla:util",
3312        "@com_google_absl//absl/algorithm:container",
3313        "@com_google_absl//absl/container:flat_hash_map",
3314        "@com_google_absl//absl/container:flat_hash_set",
3315        "@com_google_absl//absl/memory",
3316    ],
3317)
3318
3319tf_cc_test(
3320    name = "hlo_replication_analysis_test",
3321    srcs = ["hlo_replication_analysis_test.cc"],
3322    deps = [
3323        ":hlo",
3324        ":hlo_replication_analysis",
3325        "//tensorflow/compiler/xla:shape_util",
3326        "//tensorflow/compiler/xla:types",
3327        "//tensorflow/compiler/xla/tests:hlo_test_base",
3328        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3329        "//tensorflow/core:test",
3330        "@com_google_absl//absl/memory",
3331    ],
3332)
3333
3334cc_library(
3335    name = "hlo_liveness_analysis",
3336    srcs = ["hlo_liveness_analysis.cc"],
3337    hdrs = ["hlo_liveness_analysis.h"],
3338    deps = [
3339        ":call_graph",
3340        ":hlo",
3341        ":hlo_value",
3342        "//tensorflow/compiler/xla:shape_tree",
3343        "//tensorflow/compiler/xla:shape_util",
3344        "//tensorflow/compiler/xla:status",
3345        "//tensorflow/compiler/xla:statusor",
3346        "//tensorflow/compiler/xla:types",
3347        "//tensorflow/compiler/xla:util",
3348        "//tensorflow/core:lib",
3349        "@com_google_absl//absl/container:flat_hash_set",
3350        "@com_google_absl//absl/memory",
3351        "@com_google_absl//absl/strings",
3352    ],
3353)
3354
3355tf_cc_test(
3356    name = "hlo_liveness_analysis_test",
3357    srcs = ["hlo_liveness_analysis_test.cc"],
3358    deps = [
3359        ":hlo",
3360        ":hlo_liveness_analysis",
3361        "//tensorflow/compiler/xla:literal",
3362        "//tensorflow/compiler/xla:shape_util",
3363        "//tensorflow/compiler/xla:status_macros",
3364        "//tensorflow/compiler/xla:test",
3365        "//tensorflow/compiler/xla:test_helpers",
3366        "//tensorflow/compiler/xla:xla_data_proto_cc",
3367        "//tensorflow/compiler/xla/tests:hlo_test_base",
3368        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3369        "//tensorflow/core:lib",
3370        "//tensorflow/core:test",
3371    ],
3372)
3373
3374cc_library(
3375    name = "hlo_buffer",
3376    srcs = ["hlo_buffer.cc"],
3377    hdrs = ["hlo_buffer.h"],
3378    deps = [
3379        ":hlo",
3380        ":hlo_value",
3381        "//tensorflow/compiler/xla:shape_tree",
3382        "//tensorflow/compiler/xla:shape_util",
3383        "//tensorflow/compiler/xla:types",
3384        "//tensorflow/compiler/xla:util",
3385        "//tensorflow/compiler/xla:xla_data_proto_cc",
3386        "//tensorflow/core:lib",
3387        "@com_google_absl//absl/container:flat_hash_set",
3388        "@com_google_absl//absl/strings",
3389    ],
3390)
3391
3392cc_library(
3393    name = "hlo_alias_analysis",
3394    srcs = ["hlo_alias_analysis.cc"],
3395    hdrs = ["hlo_alias_analysis.h"],
3396    deps = [
3397        ":hlo",
3398        ":hlo_buffer",
3399        ":hlo_dataflow_analysis",
3400        ":hlo_ordering",
3401        ":hlo_value",
3402        "//tensorflow/compiler/xla:shape_util",
3403        "//tensorflow/compiler/xla:status",
3404        "//tensorflow/compiler/xla:statusor",
3405        "//tensorflow/compiler/xla:types",
3406        "//tensorflow/compiler/xla:util",
3407        "//tensorflow/compiler/xla:xla_data_proto_cc",
3408        "//tensorflow/core:lib",
3409        "@com_google_absl//absl/container:flat_hash_map",
3410        "@com_google_absl//absl/container:flat_hash_set",
3411        "@com_google_absl//absl/strings",
3412        "@com_google_absl//absl/types:span",
3413    ],
3414)
3415
3416tf_cc_test(
3417    name = "hlo_alias_analysis_test",
3418    srcs = ["hlo_alias_analysis_test.cc"],
3419    deps = [
3420        ":flatten_call_graph",
3421        ":hlo",
3422        ":hlo_alias_analysis",
3423        ":hlo_graph_dumper",
3424        ":hlo_matchers",
3425        ":hlo_ordering",
3426        ":instruction_fusion",
3427        "//tensorflow/compiler/xla:literal",
3428        "//tensorflow/compiler/xla:shape_util",
3429        "//tensorflow/compiler/xla:test",
3430        "//tensorflow/compiler/xla:test_helpers",
3431        "//tensorflow/compiler/xla:xla_data_proto_cc",
3432        "//tensorflow/compiler/xla/tests:hlo_test_base",
3433        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3434        "//tensorflow/core:lib",
3435        "//tensorflow/core:test",
3436    ],
3437)
3438
3439cc_library(
3440    name = "logical_buffer_analysis",
3441    srcs = ["logical_buffer_analysis.cc"],
3442    hdrs = ["logical_buffer_analysis.h"],
3443    deps = [
3444        ":hlo",
3445        ":hlo_casting_utils",
3446        ":logical_buffer",
3447        "//tensorflow/compiler/xla:shape_util",
3448        "//tensorflow/compiler/xla:statusor",
3449        "//tensorflow/core:lib",
3450        "//tensorflow/core:lib_internal",
3451        "@com_google_absl//absl/memory",
3452    ],
3453)
3454
3455cc_library(
3456    name = "tuple_points_to_analysis",
3457    srcs = ["tuple_points_to_analysis.cc"],
3458    hdrs = ["tuple_points_to_analysis.h"],
3459    deps = [
3460        ":hlo",
3461        ":hlo_casting_utils",
3462        ":hlo_dataflow_analysis",
3463        ":logical_buffer",
3464        ":logical_buffer_analysis",
3465        "//tensorflow/compiler/xla:shape_tree",
3466        "//tensorflow/compiler/xla:shape_util",
3467        "//tensorflow/compiler/xla:statusor",
3468        "//tensorflow/compiler/xla:types",
3469        "//tensorflow/compiler/xla:util",
3470        "//tensorflow/compiler/xla:xla_data_proto_cc",
3471        "//tensorflow/core:lib",
3472        "@com_google_absl//absl/algorithm:container",
3473        "@com_google_absl//absl/container:flat_hash_map",
3474        "@com_google_absl//absl/container:flat_hash_set",
3475        "@com_google_absl//absl/container:inlined_vector",
3476        "@com_google_absl//absl/memory",
3477        "@com_google_absl//absl/strings",
3478        "@com_google_absl//absl/strings:str_format",
3479        "@com_google_absl//absl/types:span",
3480    ],
3481)
3482
3483tf_cc_test(
3484    name = "tuple_points_to_analysis_test",
3485    srcs = ["tuple_points_to_analysis_test.cc"],
3486    deps = [
3487        ":hlo",
3488        ":hlo_casting_utils",
3489        ":hlo_creation_utils",
3490        ":hlo_matchers",
3491        ":instruction_fusion",
3492        ":tuple_points_to_analysis",
3493        "//tensorflow/compiler/xla:literal",
3494        "//tensorflow/compiler/xla:literal_util",
3495        "//tensorflow/compiler/xla:shape_util",
3496        "//tensorflow/compiler/xla:test",
3497        "//tensorflow/compiler/xla:test_helpers",
3498        "//tensorflow/compiler/xla:xla_data_proto_cc",
3499        "//tensorflow/compiler/xla/tests:hlo_test_base",
3500        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3501        "//tensorflow/core:lib",
3502        "//tensorflow/core:test",
3503    ],
3504)
3505
3506cc_library(
3507    name = "compilation_cache",
3508    srcs = ["compilation_cache.cc"],
3509    hdrs = ["compilation_cache.h"],
3510    deps = [
3511        ":executable",
3512        ":hlo_module_config",
3513        "//tensorflow/compiler/xla:types",
3514        "//tensorflow/compiler/xla:util",
3515        "//tensorflow/compiler/xla:xla_data_proto_cc",
3516        "//tensorflow/core:lib",
3517        "@com_google_absl//absl/container:flat_hash_map",
3518    ],
3519)
3520
3521cc_library(
3522    name = "layout_assignment",
3523    srcs = [
3524        "layout_assignment.cc",
3525    ],
3526    hdrs = [
3527        "layout_assignment.h",
3528    ],
3529    deps = [
3530        ":call_graph",
3531        ":computation_layout",
3532        ":hlo",
3533        ":hlo_alias_analysis",
3534        ":hlo_casting_utils",
3535        ":hlo_dce",
3536        ":hlo_graph_dumper",
3537        ":hlo_pass",
3538        ":logical_buffer",
3539        ":tuple_points_to_analysis",
3540        ":tuple_simplifier",
3541        "//tensorflow/compiler/xla:permutation_util",
3542        "//tensorflow/compiler/xla:shape_layout",
3543        "//tensorflow/compiler/xla:shape_util",
3544        "//tensorflow/compiler/xla:status_macros",
3545        "//tensorflow/compiler/xla:statusor",
3546        "//tensorflow/compiler/xla:types",
3547        "//tensorflow/compiler/xla:util",
3548        "//tensorflow/compiler/xla:xla_data_proto_cc",
3549        "//tensorflow/core:lib",
3550        "@com_google_absl//absl/algorithm:container",
3551        "@com_google_absl//absl/container:flat_hash_map",
3552        "@com_google_absl//absl/container:flat_hash_set",
3553        "@com_google_absl//absl/memory",
3554        "@com_google_absl//absl/strings",
3555        "@com_google_absl//absl/strings:str_format",
3556        "@com_google_absl//absl/types:span",
3557    ],
3558)
3559
3560cc_library(
3561    name = "copy_insertion",
3562    srcs = ["copy_insertion.cc"],
3563    hdrs = ["copy_insertion.h"],
3564    deps = [
3565        ":dump",
3566        ":hlo",
3567        ":hlo_alias_analysis",
3568        ":hlo_dce",
3569        ":hlo_graph_dumper",
3570        ":hlo_ordering",
3571        ":hlo_pass",
3572        ":logical_buffer",
3573        ":tuple_simplifier",
3574        "//tensorflow/compiler/xla:status_macros",
3575        "//tensorflow/compiler/xla:statusor",
3576        "//tensorflow/compiler/xla:types",
3577        "//tensorflow/compiler/xla:util",
3578        "//tensorflow/compiler/xla/service/graphcycles",
3579        "//tensorflow/core:lib",
3580        "@com_google_absl//absl/container:flat_hash_map",
3581        "@com_google_absl//absl/container:flat_hash_set",
3582        "@com_google_absl//absl/strings",
3583    ],
3584)
3585
3586cc_library(
3587    name = "loop_schedule_linearizer",
3588    srcs = ["loop_schedule_linearizer.cc"],
3589    hdrs = ["loop_schedule_linearizer.h"],
3590    deps = [
3591        ":dump",
3592        ":hlo",
3593        ":hlo_alias_analysis",
3594        ":hlo_dce",
3595        ":hlo_graph_dumper",
3596        ":hlo_ordering",
3597        ":hlo_pass",
3598        ":logical_buffer",
3599        ":tuple_simplifier",
3600        "//tensorflow/compiler/xla:status_macros",
3601        "//tensorflow/compiler/xla:statusor",
3602        "//tensorflow/compiler/xla:types",
3603        "//tensorflow/compiler/xla:util",
3604        "//tensorflow/compiler/xla/service/graphcycles",
3605        "//tensorflow/core:lib",
3606        "@com_google_absl//absl/container:flat_hash_map",
3607        "@com_google_absl//absl/container:flat_hash_set",
3608        "@com_google_absl//absl/strings",
3609    ],
3610)
3611
3612tf_cc_test(
3613    name = "copy_insertion_test",
3614    srcs = ["copy_insertion_test.cc"],
3615    deps = [
3616        ":copy_insertion",
3617        ":hlo",
3618        ":hlo_graph_dumper",
3619        ":hlo_matchers",
3620        ":hlo_runner",
3621        "//tensorflow/compiler/xla:debug_options_flags",
3622        "//tensorflow/compiler/xla:literal",
3623        "//tensorflow/compiler/xla:shape_util",
3624        "//tensorflow/compiler/xla:test",
3625        "//tensorflow/compiler/xla:test_helpers",
3626        "//tensorflow/compiler/xla:xla_data_proto_cc",
3627        "//tensorflow/compiler/xla/tests:hlo_test_base",
3628        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3629        "//tensorflow/core:test",
3630    ],
3631)
3632
3633tf_cc_test(
3634    name = "loop_schedule_linearizer_test",
3635    srcs = ["loop_schedule_linearizer_test.cc"],
3636    deps = [
3637        ":copy_insertion",
3638        ":hlo",
3639        ":hlo_graph_dumper",
3640        ":hlo_matchers",
3641        ":hlo_runner",
3642        ":loop_schedule_linearizer",
3643        "//tensorflow/compiler/xla:debug_options_flags",
3644        "//tensorflow/compiler/xla:literal",
3645        "//tensorflow/compiler/xla:shape_util",
3646        "//tensorflow/compiler/xla:test",
3647        "//tensorflow/compiler/xla:test_helpers",
3648        "//tensorflow/compiler/xla:xla_data_proto_cc",
3649        "//tensorflow/compiler/xla/tests:hlo_test_base",
3650        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3651        "//tensorflow/core:test",
3652    ],
3653)
3654
3655cc_library(
3656    name = "memory_space_assignment_utils",
3657    srcs = ["memory_space_assignment_utils.cc"],
3658    hdrs = ["memory_space_assignment_utils.h"],
3659    deps = [
3660        ":heap_simulator",
3661        ":hlo",
3662        ":hlo_casting_utils",
3663    ],
3664)
3665
3666cc_library(
3667    name = "memory_space_assignment_repacking",
3668    hdrs = ["memory_space_assignment_repacking.h"],
3669    deps = [
3670        "//tensorflow/compiler/xla:statusor",
3671        "//tensorflow/compiler/xla:types",
3672    ],
3673)
3674
3675cc_library(
3676    name = "memory_space_assignment_best_fit_repacker",
3677    srcs = ["memory_space_assignment_best_fit_repacker.cc"],
3678    hdrs = ["memory_space_assignment_best_fit_repacker.h"],
3679    deps = [
3680        ":heap_simulator",
3681        ":memory_space_assignment_repacking",
3682    ],
3683)
3684
3685tf_cc_test(
3686    name = "memory_space_assignment_best_fit_repacker_test",
3687    srcs = ["memory_space_assignment_best_fit_repacker_test.cc"],
3688    deps = [
3689        ":memory_space_assignment_best_fit_repacker",
3690        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3691        "//tensorflow/core:test",
3692    ],
3693)
3694
3695cc_library(
3696    name = "memory_space_assignment",
3697    srcs = ["memory_space_assignment.cc"],
3698    hdrs = ["memory_space_assignment.h"],
3699    deps = [
3700        ":heap_simulator",
3701        ":hlo_cost_analysis",
3702        ":memory_space_assignment_repacking",
3703        ":memory_space_assignment_utils",
3704        "//tensorflow/compiler/xla:debug_options_flags",
3705        "//tensorflow/core/lib/math:math_util",
3706    ],
3707)
3708
3709tf_cc_test(
3710    name = "memory_space_assignment_test",
3711    srcs = ["memory_space_assignment_test.cc"],
3712    deps = [
3713        ":hlo",
3714        ":hlo_matchers",
3715        ":memory_space_assignment",
3716        "//tensorflow/compiler/xla:test",
3717        "//tensorflow/compiler/xla/tests:hlo_test_base",
3718        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3719        "//tensorflow/core:test",
3720    ],
3721)
3722
3723cc_library(
3724    name = "memory_space_propagation",
3725    srcs = ["memory_space_propagation.cc"],
3726    hdrs = ["memory_space_propagation.h"],
3727    deps = [
3728        ":hlo",
3729        ":hlo_dataflow_analysis",
3730        ":hlo_pass",
3731    ],
3732)
3733
3734tf_cc_test(
3735    name = "memory_space_propagation_test",
3736    srcs = ["memory_space_propagation_test.cc"],
3737    deps = [
3738        ":hlo_parser",
3739        ":memory_space_propagation",
3740        "//tensorflow/compiler/xla/tests:hlo_test_base",
3741        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3742        "//tensorflow/core:test",
3743    ],
3744)
3745
3746cc_library(
3747    name = "hlo_dce",
3748    srcs = ["hlo_dce.cc"],
3749    hdrs = ["hlo_dce.h"],
3750    deps = [
3751        ":hlo",
3752        ":hlo_casting_utils",
3753        ":hlo_pass",
3754        "//tensorflow/compiler/xla:status",
3755        "//tensorflow/compiler/xla:status_macros",
3756        "//tensorflow/compiler/xla:statusor",
3757        "//tensorflow/compiler/xla:types",
3758        "//tensorflow/compiler/xla:util",
3759        "//tensorflow/core:lib",
3760        "@com_google_absl//absl/container:flat_hash_set",
3761    ],
3762)
3763
3764cc_library(
3765    name = "hlo_module_dce",
3766    srcs = ["hlo_module_dce.cc"],
3767    hdrs = ["hlo_module_dce.h"],
3768    deps = [
3769        ":hlo",
3770        ":hlo_dce",
3771        ":hlo_liveness_analysis",
3772        ":hlo_pass",
3773        ":tuple_simplifier",
3774        ":while_loop_simplifier",
3775        "//tensorflow/compiler/xla:status",
3776        "//tensorflow/compiler/xla:status_macros",
3777        "//tensorflow/compiler/xla:statusor",
3778        "//tensorflow/compiler/xla:types",
3779        "//tensorflow/compiler/xla:util",
3780        "//tensorflow/core:lib",
3781    ],
3782)
3783
3784cc_library(
3785    name = "hlo_verifier",
3786    srcs = ["hlo_verifier.cc"],
3787    hdrs = ["hlo_verifier.h"],
3788    deps = [
3789        ":hlo",
3790        ":hlo_casting_utils",
3791        ":hlo_pass",
3792        ":shape_inference",
3793        "//tensorflow/compiler/xla:comparison_util",
3794        "//tensorflow/compiler/xla:permutation_util",
3795        "//tensorflow/compiler/xla:shape_util",
3796        "//tensorflow/compiler/xla:status_macros",
3797        "//tensorflow/compiler/xla:util",
3798        "//tensorflow/compiler/xla:xla_data_proto_cc",
3799        "//tensorflow/core:lib",
3800        "@com_google_absl//absl/container:flat_hash_map",
3801        "@com_google_absl//absl/memory",
3802        "@com_google_absl//absl/strings",
3803    ],
3804)
3805
3806tf_cc_test(
3807    name = "hlo_verifier_test",
3808    srcs = ["hlo_verifier_test.cc"],
3809    deps = [
3810        ":hlo",
3811        ":hlo_module_config",
3812        ":hlo_parser",
3813        ":hlo_verifier",
3814        ":layout_assignment",
3815        "//tensorflow/compiler/xla:shape_util",
3816        "//tensorflow/compiler/xla:test",
3817        "//tensorflow/compiler/xla:types",
3818        "//tensorflow/compiler/xla:xla_data_proto_cc",
3819        "//tensorflow/compiler/xla:xla_proto_cc",
3820        "//tensorflow/compiler/xla/tests:hlo_test_base",
3821        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3822        "//tensorflow/core:test",
3823        "@com_google_absl//absl/strings",
3824    ],
3825)
3826
3827cc_library(
3828    name = "hlo_rematerialization",
3829    srcs = ["hlo_rematerialization.cc"],
3830    hdrs = ["hlo_rematerialization.h"],
3831    deps = [
3832        ":buffer_value",
3833        ":call_graph",
3834        ":flatten_call_graph",
3835        ":hlo",
3836        ":hlo_casting_utils",
3837        ":hlo_dce",
3838        ":hlo_memory_scheduler",
3839        ":hlo_ordering",
3840        ":logical_buffer",
3841        ":tuple_points_to_analysis",
3842        "//tensorflow/compiler/xla:shape_util",
3843        "//tensorflow/compiler/xla:status_macros",
3844        "//tensorflow/compiler/xla:statusor",
3845        "//tensorflow/compiler/xla:types",
3846        "//tensorflow/compiler/xla:util",
3847        "//tensorflow/core:lib",
3848        "//tensorflow/core:lib_internal",
3849        "@com_google_absl//absl/algorithm:container",
3850        "@com_google_absl//absl/container:flat_hash_map",
3851        "@com_google_absl//absl/container:flat_hash_set",
3852        "@com_google_absl//absl/container:inlined_vector",
3853        "@com_google_absl//absl/strings",
3854        "@com_google_absl//absl/strings:str_format",
3855    ],
3856)
3857
3858cc_library(
3859    name = "hlo_rematerialization_test_utils",
3860    testonly = 1,
3861    hdrs = ["hlo_rematerialization_test_utils.h"],
3862    deps = [
3863        ":hlo",
3864        ":hlo_matchers",
3865        ":hlo_ordering",
3866        ":hlo_rematerialization",
3867        "//tensorflow/compiler/xla:shape_util",
3868        "//tensorflow/compiler/xla:types",
3869        "//tensorflow/compiler/xla:xla_data_proto_cc",
3870        "//tensorflow/compiler/xla/tests:hlo_test_base",
3871        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3872        "//tensorflow/core:test",
3873        "@com_google_absl//absl/flags:flag",
3874    ],
3875)
3876
3877tf_cc_test(
3878    name = "hlo_rematerialization_test_utils_test",
3879    srcs = ["hlo_rematerialization_test_utils_test.cc"],
3880    deps = [
3881        ":flatten_call_graph",
3882        ":hlo",
3883        ":hlo_matchers",
3884        ":hlo_ordering",
3885        ":hlo_rematerialization_test_utils",
3886        "//tensorflow/compiler/xla:shape_util",
3887        "//tensorflow/compiler/xla:types",
3888        "//tensorflow/compiler/xla:util",
3889        "//tensorflow/compiler/xla:xla_data_proto_cc",
3890        "//tensorflow/compiler/xla/tests:hlo_test_base",
3891        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3892        "//tensorflow/core:test",
3893    ],
3894)
3895
3896tf_cc_test(
3897    name = "hlo_rematerialization_test",
3898    srcs = ["hlo_rematerialization_test.cc"],
3899    deps = [
3900        ":flatten_call_graph",
3901        ":hlo",
3902        ":hlo_matchers",
3903        ":hlo_ordering",
3904        ":hlo_rematerialization",
3905        ":hlo_rematerialization_test_utils",
3906        "//tensorflow/compiler/xla:shape_util",
3907        "//tensorflow/compiler/xla:types",
3908        "//tensorflow/compiler/xla:xla_data_proto_cc",
3909        "//tensorflow/compiler/xla/tests:hlo_test_base",
3910        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3911        "//tensorflow/core:test",
3912    ],
3913)
3914
3915tf_cc_test(
3916    name = "hlo_dce_test",
3917    srcs = ["hlo_dce_test.cc"],
3918    deps = [
3919        ":hlo",
3920        ":hlo_casting_utils",
3921        ":hlo_dce",
3922        "//tensorflow/compiler/xla:literal",
3923        "//tensorflow/compiler/xla:literal_util",
3924        "//tensorflow/compiler/xla:shape_util",
3925        "//tensorflow/compiler/xla:types",
3926        "//tensorflow/compiler/xla:util",
3927        "//tensorflow/compiler/xla:xla_data_proto_cc",
3928        "//tensorflow/compiler/xla/tests:hlo_test_base",
3929        "//tensorflow/compiler/xla/tests:literal_test_util",
3930        "//tensorflow/compiler/xla/tests:test_utils",
3931        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3932        "//tensorflow/core:lib",
3933        "//tensorflow/core:test",
3934        "@com_google_absl//absl/memory",
3935    ],
3936)
3937
3938tf_cc_test(
3939    name = "hlo_module_dce_test",
3940    srcs = ["hlo_module_dce_test.cc"],
3941    deps = [
3942        ":hlo",
3943        ":hlo_module_dce",
3944        "//tensorflow/compiler/xla:literal",
3945        "//tensorflow/compiler/xla:shape_util",
3946        "//tensorflow/compiler/xla:types",
3947        "//tensorflow/compiler/xla:util",
3948        "//tensorflow/compiler/xla:xla_data_proto_cc",
3949        "//tensorflow/compiler/xla/tests:hlo_test_base",
3950        "//tensorflow/compiler/xla/tests:literal_test_util",
3951        "//tensorflow/compiler/xla/tests:test_utils",
3952        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3953        "//tensorflow/core:lib",
3954        "//tensorflow/core:test",
3955    ],
3956)
3957
3958tf_cc_test(
3959    name = "layout_assignment_test",
3960    srcs = ["layout_assignment_test.cc"],
3961    deps = [
3962        ":algebraic_simplifier",
3963        ":computation_layout",
3964        ":dynamic_padder",
3965        ":hlo",
3966        ":hlo_parser",
3967        ":layout_assignment",
3968        ":pattern_matcher",
3969        ":pattern_matcher_gmock",
3970        "//tensorflow/compiler/xla:literal",
3971        "//tensorflow/compiler/xla:shape_layout",
3972        "//tensorflow/compiler/xla:shape_util",
3973        "//tensorflow/compiler/xla:test",
3974        "//tensorflow/compiler/xla:test_helpers",
3975        "//tensorflow/compiler/xla:util",
3976        "//tensorflow/compiler/xla:xla_data_proto_cc",
3977        "//tensorflow/compiler/xla/tests:hlo_test_base",
3978        "//tensorflow/compiler/xla/tests:test_utils",
3979        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
3980        "//tensorflow/core:lib",
3981        "//tensorflow/core:test",
3982        "@com_google_absl//absl/types:span",
3983    ],
3984)
3985
3986cc_library(
3987    name = "hlo_pass",
3988    hdrs = [
3989        "hlo_pass_fix.h",
3990        "hlo_pass_interface.h",
3991    ],
3992    deps = [
3993        ":hlo",
3994        ":hlo_module_group",
3995        "//tensorflow/compiler/xla:status_macros",
3996        "//tensorflow/compiler/xla:statusor",
3997        "//tensorflow/compiler/xla:types",
3998        "//tensorflow/core:lib",
3999        "@com_google_absl//absl/container:flat_hash_set",
4000    ],
4001)
4002
4003cc_library(
4004    name = "hlo_pass_pipeline",
4005    srcs = [
4006        "hlo_pass_pipeline.cc",
4007    ],
4008    hdrs = [
4009        "hlo_pass_pipeline.h",
4010    ],
4011    deps = [
4012        ":compilation_stats",
4013        ":dump",
4014        ":hlo",
4015        ":hlo_graph_dumper",
4016        ":hlo_pass",
4017        ":hlo_proto_util",
4018        "//tensorflow/compiler/xla:status_macros",
4019        "//tensorflow/compiler/xla:statusor",
4020        "//tensorflow/compiler/xla:types",
4021        "//tensorflow/compiler/xla:util",
4022        "//tensorflow/core:lib",
4023        "@com_google_absl//absl/container:flat_hash_map",
4024        "@com_google_absl//absl/container:flat_hash_set",
4025        "@com_google_absl//absl/memory",
4026        "@com_google_absl//absl/strings",
4027        "@com_google_absl//absl/strings:str_format",
4028    ],
4029)
4030
4031tf_cc_test(
4032    name = "hlo_pass_pipeline_test",
4033    srcs = ["hlo_pass_pipeline_test.cc"],
4034    deps = [
4035        ":hlo",
4036        ":hlo_parser",
4037        ":hlo_pass_pipeline",
4038        "//tensorflow/compiler/xla:test",
4039        "//tensorflow/compiler/xla:test_helpers",
4040        "//tensorflow/compiler/xla:types",
4041        "//tensorflow/compiler/xla:util",
4042        "//tensorflow/compiler/xla:xla_data_proto_cc",
4043        "//tensorflow/compiler/xla/tests:hlo_test_base",
4044        "//tensorflow/compiler/xla/tests:test_utils",
4045        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4046        "//tensorflow/core:lib",
4047        "//tensorflow/core:test",
4048    ],
4049)
4050
4051cc_library(
4052    name = "hlo_cse",
4053    srcs = ["hlo_cse.cc"],
4054    hdrs = ["hlo_cse.h"],
4055    deps = [
4056        ":hlo",
4057        ":hlo_domain_map",
4058        ":hlo_pass",
4059        "//tensorflow/compiler/xla:literal",
4060        "//tensorflow/compiler/xla:shape_util",
4061        "//tensorflow/compiler/xla:types",
4062        "//tensorflow/core:lib",
4063        "//tensorflow/core/platform:hash",
4064        "@com_google_absl//absl/container:flat_hash_set",
4065        "@com_google_absl//absl/container:inlined_vector",
4066    ],
4067)
4068
4069tf_cc_test(
4070    name = "hlo_cse_test",
4071    srcs = ["hlo_cse_test.cc"],
4072    deps = [
4073        ":cpu_plugin",
4074        ":hlo",
4075        ":hlo_cse",
4076        ":hlo_matchers",
4077        ":hlo_parser",
4078        "//tensorflow/compiler/xla:literal",
4079        "//tensorflow/compiler/xla:shape_util",
4080        "//tensorflow/compiler/xla:types",
4081        "//tensorflow/compiler/xla:util",
4082        "//tensorflow/compiler/xla:xla_data_proto_cc",
4083        "//tensorflow/compiler/xla/tests:hlo_test_base",
4084        "//tensorflow/compiler/xla/tests:literal_test_util",
4085        "//tensorflow/compiler/xla/tests:test_utils",
4086        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4087        "//tensorflow/core:lib",
4088        "@com_google_absl//absl/memory",
4089    ],
4090)
4091
4092cc_library(
4093    name = "hlo_constant_folding",
4094    srcs = ["hlo_constant_folding.cc"],
4095    hdrs = ["hlo_constant_folding.h"],
4096    deps = [
4097        ":hlo",
4098        ":hlo_evaluator",
4099        ":hlo_pass",
4100        ":hlo_query",
4101        "//tensorflow/compiler/xla:literal",
4102        "//tensorflow/compiler/xla:shape_util",
4103        "//tensorflow/compiler/xla:types",
4104        "//tensorflow/core:lib",
4105        "@com_google_absl//absl/memory",
4106    ],
4107)
4108
4109tf_cc_test(
4110    name = "hlo_constant_folding_test",
4111    srcs = ["hlo_constant_folding_test.cc"],
4112    deps = [
4113        ":hlo",
4114        ":hlo_constant_folding",
4115        ":hlo_matchers",
4116        ":hlo_parser",
4117        ":hlo_pass",
4118        ":pattern_matcher",
4119        ":pattern_matcher_gmock",
4120        "//tensorflow/compiler/xla:literal",
4121        "//tensorflow/compiler/xla:permutation_util",
4122        "//tensorflow/compiler/xla:shape_util",
4123        "//tensorflow/compiler/xla:test",
4124        "//tensorflow/compiler/xla:types",
4125        "//tensorflow/compiler/xla/tests:hlo_test_base",
4126        "//tensorflow/compiler/xla/tests:literal_test_util",
4127        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4128    ],
4129)
4130
4131cc_library(
4132    name = "hlo_domain_map",
4133    srcs = ["hlo_domain_map.cc"],
4134    hdrs = ["hlo_domain_map.h"],
4135    deps = [
4136        ":hlo",
4137        "//tensorflow/compiler/xla:statusor",
4138        "//tensorflow/compiler/xla:types",
4139        "//tensorflow/compiler/xla:util",
4140        "//tensorflow/core:lib",
4141        "@com_google_absl//absl/container:flat_hash_map",
4142        "@com_google_absl//absl/container:flat_hash_set",
4143        "@com_google_absl//absl/memory",
4144    ],
4145)
4146
4147cc_library(
4148    name = "hlo_domain_verifier",
4149    srcs = ["hlo_domain_verifier.cc"],
4150    hdrs = ["hlo_domain_verifier.h"],
4151    deps = [
4152        ":hlo",
4153        ":hlo_domain_map",
4154        ":hlo_graph_dumper",
4155        ":hlo_pass",
4156        "//tensorflow/compiler/xla:types",
4157        "//tensorflow/core:lib",
4158    ],
4159)
4160
4161cc_library(
4162    name = "hlo_domain_isolator",
4163    srcs = ["hlo_domain_isolator.cc"],
4164    hdrs = ["hlo_domain_isolator.h"],
4165    deps = [
4166        ":hlo",
4167        ":hlo_graph_dumper",
4168        ":hlo_pass",
4169        "//tensorflow/compiler/xla:types",
4170        "//tensorflow/compiler/xla:util",
4171    ],
4172)
4173
4174cc_library(
4175    name = "hlo_domain_remover",
4176    srcs = ["hlo_domain_remover.cc"],
4177    hdrs = ["hlo_domain_remover.h"],
4178    deps = [
4179        ":hlo",
4180        ":hlo_domain_map",
4181        ":hlo_domain_verifier",
4182        ":hlo_graph_dumper",
4183        ":hlo_pass",
4184        "//tensorflow/compiler/xla:types",
4185        "//tensorflow/core:lib",
4186    ],
4187)
4188
4189tf_cc_test(
4190    name = "hlo_domain_test",
4191    srcs = ["hlo_domain_test.cc"],
4192    deps = [
4193        ":hlo",
4194        ":hlo_domain_isolator",
4195        ":hlo_domain_remover",
4196        ":hlo_parser",
4197        "//tensorflow/compiler/xla:debug_options_flags",
4198        "//tensorflow/compiler/xla:test",
4199        "//tensorflow/compiler/xla/tests:hlo_test_base",
4200        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4201        "//tensorflow/core:test",
4202        "@com_google_absl//absl/memory",
4203    ],
4204)
4205
4206cc_library(
4207    name = "hlo_element_type_converter",
4208    srcs = ["hlo_element_type_converter.cc"],
4209    hdrs = ["hlo_element_type_converter.h"],
4210    deps = [
4211        ":hlo",
4212        ":hlo_evaluator",
4213        ":hlo_pass",
4214        ":hlo_query",
4215        "//tensorflow/compiler/xla:literal",
4216        "//tensorflow/compiler/xla:shape_util",
4217        "//tensorflow/compiler/xla:types",
4218        "//tensorflow/core:lib",
4219    ],
4220)
4221
4222tf_cc_test(
4223    name = "hlo_element_type_converter_test",
4224    srcs = ["hlo_element_type_converter_test.cc"],
4225    deps = [
4226        ":hlo_element_type_converter",
4227        ":hlo_matchers",
4228        "//tensorflow/compiler/xla/tests:hlo_test_base",
4229        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4230    ],
4231)
4232
4233cc_library(
4234    name = "conditional_canonicalizer",
4235    srcs = ["conditional_canonicalizer.cc"],
4236    hdrs = ["conditional_canonicalizer.h"],
4237    deps = [
4238        ":hlo",
4239        ":hlo_pass",
4240        "//tensorflow/compiler/xla:status_macros",
4241    ],
4242)
4243
4244tf_cc_test(
4245    name = "conditional_canonicalizer_test",
4246    srcs = ["conditional_canonicalizer_test.cc"],
4247    deps = [
4248        ":conditional_canonicalizer",
4249        ":hlo",
4250        ":hlo_matchers",
4251        ":hlo_parser",
4252        "//tensorflow/compiler/xla:literal",
4253        "//tensorflow/compiler/xla:shape_util",
4254        "//tensorflow/compiler/xla:types",
4255        "//tensorflow/compiler/xla:util",
4256        "//tensorflow/compiler/xla:xla_data_proto_cc",
4257        "//tensorflow/compiler/xla/tests:hlo_test_base",
4258        "//tensorflow/compiler/xla/tests:literal_test_util",
4259        "//tensorflow/compiler/xla/tests:test_utils",
4260        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4261        "//tensorflow/core:lib",
4262        "//tensorflow/core:test",
4263    ],
4264)
4265
4266cc_library(
4267    name = "maybe_owning_device_memory",
4268    srcs = [
4269        "maybe_owning_device_memory.cc",
4270    ],
4271    hdrs = [
4272        "maybe_owning_device_memory.h",
4273    ],
4274    deps = [
4275        "//tensorflow/stream_executor:device_memory_allocator",
4276        "@com_google_absl//absl/types:optional",
4277        "@com_google_absl//absl/types:variant",
4278    ],
4279)
4280
4281cc_library(
4282    name = "elemental_ir_emitter",
4283    srcs = ["elemental_ir_emitter.cc"],
4284    hdrs = ["elemental_ir_emitter.h"],
4285    deps = [
4286        ":hlo",
4287        ":hlo_casting_utils",
4288        "//tensorflow/compiler/xla:shape_util",
4289        "//tensorflow/compiler/xla:status_macros",
4290        "//tensorflow/compiler/xla:statusor",
4291        "//tensorflow/compiler/xla:types",
4292        "//tensorflow/compiler/xla:util",
4293        "//tensorflow/compiler/xla:window_util",
4294        "//tensorflow/compiler/xla:xla_data_proto_cc",
4295        "//tensorflow/compiler/xla/service/llvm_ir:ir_array",
4296        "//tensorflow/compiler/xla/service/llvm_ir:ir_builder_mixin",
4297        "//tensorflow/compiler/xla/service/llvm_ir:llvm_loop",
4298        "//tensorflow/compiler/xla/service/llvm_ir:llvm_util",
4299        "//tensorflow/compiler/xla/service/llvm_ir:loop_emitter",
4300        "//tensorflow/core:lib",
4301        "//tensorflow/core:lib_internal",
4302        "@com_google_absl//absl/algorithm:container",
4303        "@com_google_absl//absl/container:flat_hash_map",
4304        "@com_google_absl//absl/strings",
4305        "@com_google_absl//absl/types:span",
4306        "@llvm-project//llvm:Core",
4307        "@llvm-project//llvm:TransformUtils",
4308    ],
4309)
4310
4311xla_test(
4312    name = "elemental_ir_emitter_test",
4313    srcs = ["elemental_ir_emitter_test.cc"],
4314    backends = [
4315        "cpu",
4316        "gpu",
4317    ],
4318    tags = [
4319        "no_windows",  # TODO(b/152037541)
4320    ],
4321    deps = [
4322        ":hlo_parser",
4323        "//tensorflow/compiler/xla:execution_options_util",
4324        "//tensorflow/compiler/xla:status_macros",
4325        "//tensorflow/compiler/xla:test",
4326        "//tensorflow/compiler/xla/tests:client_library_test_base",
4327        "//tensorflow/compiler/xla/tests:hlo_test_base",
4328        "//tensorflow/compiler/xla/tests:test_macros_header",
4329        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4330    ],
4331)
4332
4333cc_library(
4334    name = "hlo_module_config",
4335    srcs = ["hlo_module_config.cc"],
4336    hdrs = ["hlo_module_config.h"],
4337    deps = [
4338        ":computation_layout",
4339        ":computation_placer",
4340        "//tensorflow/compiler/xla:shape_layout",
4341        "//tensorflow/compiler/xla:types",
4342        "//tensorflow/compiler/xla:xla_data_proto_cc",
4343        "//tensorflow/compiler/xla:xla_proto_cc",
4344        "@com_google_absl//absl/memory",
4345        "@com_google_absl//absl/strings",
4346        "@com_google_absl//absl/types:optional",
4347    ],
4348)
4349
4350cc_library(
4351    name = "computation_layout",
4352    srcs = ["computation_layout.cc"],
4353    hdrs = ["computation_layout.h"],
4354    deps = [
4355        "//tensorflow/compiler/xla:shape_layout",
4356        "//tensorflow/compiler/xla:types",
4357        "//tensorflow/compiler/xla:xla_data_proto_cc",
4358        "//tensorflow/core:lib",
4359        "@com_google_absl//absl/strings",
4360    ],
4361)
4362
4363cc_library(
4364    name = "hlo_subcomputation_unification",
4365    srcs = ["hlo_subcomputation_unification.cc"],
4366    hdrs = ["hlo_subcomputation_unification.h"],
4367    deps = [
4368        ":hlo_pass",
4369    ],
4370)
4371
4372tf_cc_test(
4373    name = "hlo_subcomputation_unification_test",
4374    srcs = ["hlo_subcomputation_unification_test.cc"],
4375    deps = [
4376        ":hlo",
4377        ":hlo_graph_dumper",
4378        ":hlo_subcomputation_unification",
4379        "//tensorflow/compiler/xla:shape_util",
4380        "//tensorflow/compiler/xla/tests:hlo_test_base",
4381        "//tensorflow/compiler/xla/tests:test_utils",
4382        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4383    ],
4384)
4385
4386cc_library(
4387    name = "hlo_graph_dumper",
4388    srcs = ["hlo_graph_dumper.cc"],
4389    hdrs = ["hlo_graph_dumper.h"],
4390    deps = [
4391        ":hlo",
4392        ":hlo_casting_utils",
4393        ":hlo_execution_profile",
4394        ":pattern_matcher",
4395        "//tensorflow/compiler/xla:literal",
4396        "//tensorflow/compiler/xla:shape_util",
4397        "//tensorflow/compiler/xla:types",
4398        "//tensorflow/compiler/xla:util",
4399        "//tensorflow/compiler/xla:window_util",
4400        "//tensorflow/compiler/xla:xla_proto_cc",
4401        "//tensorflow/core:lib",
4402        "//tensorflow/core:lib_internal",
4403        "//tensorflow/core/platform:regexp",
4404        "@com_google_absl//absl/container:flat_hash_map",
4405        "@com_google_absl//absl/strings",
4406        "@com_google_absl//absl/strings:str_format",
4407        "@com_google_absl//absl/types:optional",
4408    ],
4409    alwayslink = 1,
4410)
4411
4412tf_cc_test(
4413    name = "hlo_graph_dumper_test",
4414    srcs = ["hlo_graph_dumper_test.cc"],
4415    deps = [
4416        ":hlo",
4417        ":hlo_graph_dumper",
4418        "//tensorflow/compiler/xla:literal_util",
4419        "//tensorflow/compiler/xla:test",
4420        "//tensorflow/compiler/xla:xla_proto_cc",
4421        "//tensorflow/compiler/xla/tests:hlo_test_base",
4422        "//tensorflow/compiler/xla/tests:test_utils",
4423        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
4424        "//tensorflow/core:lib",
4425        "@com_google_absl//absl/strings",
4426    ],
4427)
4428
4429cc_library(
4430    name = "transpose_folding",
4431    srcs = ["transpose_folding.cc"],
4432    hdrs = ["transpose_folding.h"],
4433    deps = [
4434        ":hlo",
4435        ":hlo_pass",
4436        "//tensorflow/compiler/xla:shape_util",
4437        "//tensorflow/compiler/xla:status_macros",
4438        "//tensorflow/compiler/xla:util",
4439        "//tensorflow/core:lib",
4440    ],
4441)
4442
4443tf_cc_test(
4444    name = "transpose_folding_test",
4445    srcs = ["transpose_folding_test.cc"],
4446    deps = [
4447        ":hlo",
4448        ":hlo_matchers",
4449        ":shape_inference",
4450        ":transpose_folding",
4451        "//tensorflow/compiler/xla:literal",
4452        "//tensorflow/compiler/xla:shape_util",
4453        "//tensorflow/compiler/xla:test",
4454        "//tensorflow/compiler/xla:test_helpers",
4455        "//tensorflow/compiler/xla:xla_data_proto_cc",
4456        "//tensorflow/compiler/xla/client:xla_builder",
4457        "//tensorflow/compiler/xla/service/gpu:ir_emission_utils",
4458        "//tensorflow/compiler/xla/tests:hlo_test_base",
4459        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4460        "//tensorflow/core:lib",
4461    ],
4462)
4463
4464cc_library(
4465    name = "zero_sized_hlo_elimination",
4466    srcs = ["zero_sized_hlo_elimination.cc"],
4467    hdrs = ["zero_sized_hlo_elimination.h"],
4468    deps = [
4469        ":hlo",
4470        ":hlo_pass",
4471        "//tensorflow/compiler/xla:literal",
4472        "//tensorflow/compiler/xla:shape_util",
4473        "//tensorflow/compiler/xla:status_macros",
4474        "//tensorflow/compiler/xla:util",
4475        "//tensorflow/core:lib",
4476    ],
4477)
4478
4479tf_cc_test(
4480    name = "zero_sized_hlo_elimination_test",
4481    srcs = ["zero_sized_hlo_elimination_test.cc"],
4482    deps = [
4483        ":hlo",
4484        ":shape_inference",
4485        ":zero_sized_hlo_elimination",
4486        "//tensorflow/compiler/xla:literal",
4487        "//tensorflow/compiler/xla:shape_util",
4488        "//tensorflow/compiler/xla:status_macros",
4489        "//tensorflow/compiler/xla:test",
4490        "//tensorflow/compiler/xla:test_helpers",
4491        "//tensorflow/compiler/xla:xla_data_proto_cc",
4492        "//tensorflow/compiler/xla/client:xla_builder",
4493        "//tensorflow/compiler/xla/tests:hlo_test_base",
4494        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4495        "//tensorflow/core:lib",
4496    ],
4497)
4498
4499cc_library(
4500    name = "stream_pool",
4501    srcs = ["stream_pool.cc"],
4502    hdrs = ["stream_pool.h"],
4503    deps = [
4504        "//tensorflow/compiler/xla:types",
4505        "//tensorflow/core:lib",
4506        "//tensorflow/core/platform:stream_executor_no_cuda",
4507        "@com_google_absl//absl/memory",
4508    ],
4509)
4510
4511tf_cc_test(
4512    name = "stream_pool_test",
4513    srcs = ["stream_pool_test.cc"],
4514    deps = [
4515        ":stream_pool",
4516        "//tensorflow/compiler/xla:test_helpers",
4517        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4518        "//tensorflow/core/platform:stream_executor_no_cuda",
4519    ],
4520)
4521
4522cc_library(
4523    name = "hlo_proto_util",
4524    srcs = ["hlo_proto_util.cc"],
4525    hdrs = ["hlo_proto_util.h"],
4526    deps = [
4527        ":buffer_assignment",
4528        ":hlo",
4529        ":hlo_proto_cc",
4530        ":hlo_verifier",
4531        "//tensorflow/compiler/xla:status",
4532        "//tensorflow/compiler/xla:util",
4533    ],
4534)
4535
4536tf_cc_test(
4537    name = "hlo_proto_util_test",
4538    srcs = ["hlo_proto_util_test.cc"],
4539    deps = [
4540        ":hlo",
4541        ":hlo_proto_cc",
4542        ":hlo_proto_util",
4543        "//tensorflow/compiler/xla:shape_util",
4544        "//tensorflow/compiler/xla:status_macros",
4545        "//tensorflow/compiler/xla:test",
4546        "//tensorflow/compiler/xla:types",
4547        "//tensorflow/compiler/xla/tests:hlo_test_base",
4548        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4549        "//tensorflow/core:lib",
4550    ],
4551)
4552
4553cc_library(
4554    name = "hlo_runner_interface",
4555    srcs = ["hlo_runner_interface.cc"],
4556    hdrs = ["hlo_runner_interface.h"],
4557    deps = [
4558        ":computation_placer",
4559        ":executable",
4560        ":hlo",
4561        ":hlo_parser",
4562        "//tensorflow/compiler/xla:status_macros",
4563        "//tensorflow/compiler/xla:statusor",
4564        "//tensorflow/compiler/xla:types",
4565        "//tensorflow/compiler/xla:util",
4566        "//tensorflow/compiler/xla:xla_data_proto_cc",
4567        "//tensorflow/core:core_cpu_internal",
4568        "@com_google_absl//absl/types:span",
4569    ],
4570)
4571
4572cc_library(
4573    name = "hlo_runner",
4574    srcs = ["hlo_runner.cc"],
4575    hdrs = ["hlo_runner.h"],
4576    deps = [
4577        ":backend",
4578        ":compiler",
4579        ":computation_placer",
4580        ":executable",
4581        ":hlo",
4582        ":hlo_module_group",
4583        ":hlo_parser",
4584        ":hlo_runner_interface",
4585        ":transfer_manager",
4586        "//tensorflow/compiler/xla:shape_util",
4587        "//tensorflow/compiler/xla:status_macros",
4588        "//tensorflow/compiler/xla:statusor",
4589        "//tensorflow/compiler/xla:types",
4590        "//tensorflow/compiler/xla:util",
4591        "//tensorflow/compiler/xla:xla_data_proto_cc",
4592        "//tensorflow/core:core_cpu_internal",
4593        "//tensorflow/core:lib",
4594        "//tensorflow/core:lib_internal",
4595        "//tensorflow/core/platform:stream_executor_no_cuda",
4596        "//third_party/eigen3",
4597        "@com_google_absl//absl/memory",
4598        "@com_google_absl//absl/types:span",
4599    ],
4600)
4601
4602cc_library(
4603    name = "hlo_profile_printer",
4604    srcs = ["hlo_profile_printer.cc"],
4605    hdrs = ["hlo_profile_printer.h"],
4606    deps = [
4607        ":hlo_profile_printer_data_cc",
4608        ":human_readable_profile_builder",
4609        "//tensorflow/compiler/xla:types",
4610        "@com_google_absl//absl/algorithm:container",
4611        "@com_google_absl//absl/strings",
4612    ],
4613)
4614
4615cc_library(
4616    name = "sort_simplifier",
4617    srcs = ["sort_simplifier.cc"],
4618    hdrs = ["sort_simplifier.h"],
4619    deps = [
4620        ":hlo",
4621        ":hlo_pass",
4622        "//tensorflow/compiler/xla:statusor",
4623        "@com_google_absl//absl/container:flat_hash_map",
4624        "@com_google_absl//absl/container:flat_hash_set",
4625    ],
4626)
4627
4628tf_cc_test(
4629    name = "sort_simplifier_test",
4630    srcs = ["sort_simplifier_test.cc"],
4631    deps = [
4632        ":hlo_matchers",
4633        ":hlo_parser",
4634        ":pattern_matcher",
4635        ":pattern_matcher_gmock",
4636        ":sort_simplifier",
4637        "//tensorflow/compiler/xla:test",
4638        "//tensorflow/compiler/xla/tests:hlo_test_base",
4639        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4640        "//tensorflow/core:test",
4641    ],
4642)
4643
4644cc_library(
4645    name = "stable_sort_expander",
4646    srcs = ["stable_sort_expander.cc"],
4647    hdrs = ["stable_sort_expander.h"],
4648    deps = [
4649        ":hlo",
4650        ":hlo_casting_utils",
4651        ":hlo_pass",
4652        ":op_expander_pass",
4653        "//tensorflow/compiler/xla:statusor",
4654        "@com_google_absl//absl/container:flat_hash_map",
4655        "@com_google_absl//absl/container:flat_hash_set",
4656    ],
4657)
4658
4659tf_cc_test(
4660    name = "stable_sort_expander_test",
4661    srcs = ["stable_sort_expander_test.cc"],
4662    deps = [
4663        ":algebraic_simplifier",
4664        ":hlo_matchers",
4665        ":hlo_parser",
4666        ":pattern_matcher",
4667        ":pattern_matcher_gmock",
4668        ":stable_sort_expander",
4669        "//tensorflow/compiler/xla:test",
4670        "//tensorflow/compiler/xla/tests:hlo_test_base",
4671        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4672        "//tensorflow/core:test",
4673    ],
4674)
4675
4676cc_library(
4677    name = "tuple_util",
4678    srcs = ["tuple_util.cc"],
4679    hdrs = ["tuple_util.h"],
4680    deps = [
4681        ":hlo",
4682        "@com_google_absl//absl/types:span",
4683    ],
4684)
4685
4686tf_cc_test(
4687    name = "tuple_util_test",
4688    srcs = ["tuple_util_test.cc"],
4689    deps = [
4690        ":hlo_matchers",
4691        ":hlo_module_config",
4692        ":hlo_parser",
4693        ":tuple_util",
4694        "//tensorflow/compiler/xla:shape_util",
4695        "//tensorflow/compiler/xla:test",
4696        "//tensorflow/compiler/xla/tests:verified_hlo_module",
4697        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4698        "@com_google_absl//absl/memory",
4699    ],
4700)
4701
4702cc_library(
4703    name = "root_instruction_sinker",
4704    srcs = ["root_instruction_sinker.cc"],
4705    hdrs = ["root_instruction_sinker.h"],
4706    deps = [
4707        ":hlo",
4708        ":hlo_pass",
4709        ":tuple_util",
4710    ],
4711)
4712
4713tf_cc_test(
4714    name = "root_instruction_sinker_test",
4715    srcs = ["root_instruction_sinker_test.cc"],
4716    deps = [
4717        ":hlo_matchers",
4718        ":root_instruction_sinker",
4719        "//tensorflow/compiler/xla/tests:hlo_test_base",
4720        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4721    ],
4722)
4723
4724cc_library(
4725    name = "while_util",
4726    srcs = ["while_util.cc"],
4727    hdrs = ["while_util.h"],
4728    deps = [
4729        ":call_inliner",
4730        ":hlo",
4731        ":hlo_creation_utils",
4732        ":tuple_util",
4733        "//tensorflow/compiler/xla:literal_util",
4734        "@com_google_absl//absl/algorithm:container",
4735        "@com_google_absl//absl/container:flat_hash_map",
4736        "@com_google_absl//absl/container:inlined_vector",
4737        "@com_google_absl//absl/strings",
4738    ],
4739)
4740
4741tf_cc_test(
4742    name = "while_util_test",
4743    srcs = ["while_util_test.cc"],
4744    deps = [
4745        ":hlo_matchers",
4746        ":while_util",
4747        "//tensorflow/compiler/xla:test",
4748        "//tensorflow/compiler/xla:util",
4749        "//tensorflow/compiler/xla/tests:hlo_test_base",
4750        "//tensorflow/compiler/xla/tests:verified_hlo_module",
4751        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4752        "@com_google_absl//absl/algorithm:container",
4753    ],
4754)
4755
4756cc_library(
4757    name = "while_loop_all_reduce_code_motion",
4758    srcs = ["while_loop_all_reduce_code_motion.cc"],
4759    hdrs = ["while_loop_all_reduce_code_motion.h"],
4760    deps = [
4761        ":call_graph",
4762        ":hlo",
4763        ":hlo_casting_utils",
4764        ":hlo_pass",
4765        ":hlo_query",
4766        ":pattern_matcher",
4767        "//tensorflow/compiler/xla:literal_util",
4768        "//tensorflow/compiler/xla:status",
4769        "//tensorflow/compiler/xla:status_macros",
4770        "//tensorflow/compiler/xla:statusor",
4771        "//tensorflow/compiler/xla:util",
4772        "//tensorflow/compiler/xla:xla_data_proto_cc",
4773        "//tensorflow/core:lib_proto_parsing",
4774        "//tensorflow/core/platform:status",
4775        "@com_google_absl//absl/algorithm:container",
4776        "@com_google_absl//absl/types:span",
4777    ],
4778)
4779
4780tf_cc_test(
4781    name = "while_loop_all_reduce_code_motion_test",
4782    srcs = ["while_loop_all_reduce_code_motion_test.cc"],
4783    deps = [
4784        ":hlo",
4785        ":hlo_casting_utils",
4786        ":hlo_matchers",
4787        ":hlo_verifier",
4788        ":while_loop_all_reduce_code_motion",
4789        "//tensorflow/compiler/xla:xla_data_proto_cc",
4790        "//tensorflow/compiler/xla/tests:hlo_test_base",
4791        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4792        "//tensorflow/core:test",
4793        "@com_google_absl//absl/algorithm:container",
4794        "@com_google_absl//absl/strings",
4795    ],
4796)
4797
4798cc_library(
4799    name = "while_loop_invariant_code_motion",
4800    srcs = ["while_loop_invariant_code_motion.cc"],
4801    hdrs = ["while_loop_invariant_code_motion.h"],
4802    deps = [
4803        ":hlo",
4804        ":hlo_pass",
4805        ":tuple_util",
4806        ":while_loop_analysis",
4807        ":while_util",
4808        "//tensorflow/compiler/xla:shape_util",
4809        "//tensorflow/compiler/xla:statusor",
4810        "//tensorflow/compiler/xla:util",
4811        "@com_google_absl//absl/algorithm:container",
4812        "@com_google_absl//absl/container:flat_hash_map",
4813        "@com_google_absl//absl/container:flat_hash_set",
4814        "@com_google_absl//absl/container:inlined_vector",
4815    ],
4816)
4817
4818tf_cc_test(
4819    name = "while_loop_invariant_code_motion_test",
4820    srcs = ["while_loop_invariant_code_motion_test.cc"],
4821    deps = [
4822        ":hlo_matchers",
4823        ":hlo_parser",
4824        ":while_loop_invariant_code_motion",
4825        "//tensorflow/compiler/xla:test",
4826        "//tensorflow/compiler/xla/tests:hlo_test_base",
4827        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4828        "//tensorflow/core:test",
4829    ],
4830)
4831
4832cc_library(
4833    name = "while_loop_expensive_invariant_code_motion",
4834    srcs = ["while_loop_expensive_invariant_code_motion.cc"],
4835    hdrs = ["while_loop_expensive_invariant_code_motion.h"],
4836    deps = [
4837        ":hlo",
4838        ":hlo_pass",
4839        ":tuple_util",
4840        ":while_loop_analysis",
4841        ":while_util",
4842        "//tensorflow/compiler/xla:shape_util",
4843        "//tensorflow/compiler/xla:statusor",
4844        "//tensorflow/compiler/xla:util",
4845        "@com_google_absl//absl/algorithm:container",
4846        "@com_google_absl//absl/container:flat_hash_map",
4847        "@com_google_absl//absl/container:flat_hash_set",
4848        "@com_google_absl//absl/container:inlined_vector",
4849    ],
4850)
4851
4852tf_cc_test(
4853    name = "while_loop_expensive_invariant_code_motion_test",
4854    srcs = ["while_loop_expensive_invariant_code_motion_test.cc"],
4855    deps = [
4856        ":hlo_matchers",
4857        ":hlo_parser",
4858        ":while_loop_expensive_invariant_code_motion",
4859        "//tensorflow/compiler/xla:test",
4860        "//tensorflow/compiler/xla/tests:hlo_test_base",
4861        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4862        "//tensorflow/core:test",
4863    ],
4864)
4865
4866cc_library(
4867    name = "while_loop_constant_sinking",
4868    srcs = ["while_loop_constant_sinking.cc"],
4869    hdrs = ["while_loop_constant_sinking.h"],
4870    deps = [
4871        ":hlo",
4872        ":hlo_pass",
4873        ":while_util",
4874        "//tensorflow/compiler/xla:statusor",
4875        "//tensorflow/compiler/xla:util",
4876        "@com_google_absl//absl/algorithm:container",
4877        "@com_google_absl//absl/container:inlined_vector",
4878    ],
4879)
4880
4881tf_cc_test(
4882    name = "while_loop_constant_sinking_test",
4883    srcs = ["while_loop_constant_sinking_test.cc"],
4884    deps = [
4885        ":hlo_matchers",
4886        ":while_loop_constant_sinking",
4887        "//tensorflow/compiler/xla:test",
4888        "//tensorflow/compiler/xla/tests:hlo_test_base",
4889        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4890        "//tensorflow/core:test",
4891    ],
4892)
4893
4894cc_library(
4895    name = "despecializer",
4896    srcs = ["despecializer.cc"],
4897    hdrs = ["despecializer.h"],
4898    deps = [
4899        ":bfloat16_normalization",
4900        ":defuser",
4901        ":hlo",
4902        ":hlo_memory_scheduler",
4903        ":hlo_pass",
4904        ":hlo_pass_pipeline",
4905        "//tensorflow/compiler/xla:statusor",
4906    ],
4907)
4908
4909cc_library(
4910    name = "source_map_util",
4911    srcs = [],
4912    hdrs = ["source_map_util.h"],
4913    deps = [
4914        ":executable",
4915        "//tensorflow/compiler/xla:status",
4916        "//tensorflow/core:lib",
4917        "@com_google_absl//absl/strings:str_format",
4918    ],
4919)
4920
4921cc_library(
4922    name = "indexed_array_analysis",
4923    srcs = ["indexed_array_analysis.cc"],
4924    hdrs = ["indexed_array_analysis.h"],
4925    deps = [
4926        ":hlo",
4927        ":hlo_evaluator",
4928        ":hlo_pass",
4929        "//tensorflow/compiler/xla:util",
4930        "//tensorflow/core:ptr_util",
4931        "@com_google_absl//absl/algorithm:container",
4932        "@com_google_absl//absl/container:flat_hash_map",
4933        "@com_google_absl//absl/container:flat_hash_set",
4934        "@com_google_absl//absl/container:inlined_vector",
4935        "@com_google_absl//absl/strings",
4936        "@com_google_absl//absl/types:optional",
4937    ],
4938)
4939
4940tf_cc_test(
4941    name = "indexed_array_analysis_test",
4942    srcs = ["indexed_array_analysis_test.cc"],
4943    deps = [
4944        ":hlo_matchers",
4945        ":hlo_parser",
4946        ":indexed_array_analysis",
4947        "//tensorflow/compiler/xla:test",
4948        "//tensorflow/compiler/xla/tests:hlo_test_base",
4949        "//tensorflow/compiler/xla/tests:test_utils",
4950        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
4951        "//tensorflow/core:test",
4952        "@com_google_absl//absl/strings",
4953    ],
4954)
4955
4956cc_library(
4957    name = "hlo_parser",
4958    srcs = ["hlo_parser.cc"],
4959    hdrs = ["hlo_parser.h"],
4960    deps = [
4961        ":hlo",
4962        ":hlo_casting_utils",
4963        ":hlo_lexer",
4964        ":shape_inference",
4965        "//tensorflow/compiler/xla:literal",
4966        "//tensorflow/compiler/xla:literal_util",
4967        "//tensorflow/compiler/xla:shape_util",
4968        "//tensorflow/compiler/xla:statusor",
4969        "//tensorflow/compiler/xla:util",
4970        "//tensorflow/compiler/xla:xla_data_proto_cc",
4971        "//tensorflow/core:lib",
4972        "//tensorflow/core:lib_internal",
4973        "@com_google_absl//absl/algorithm:container",
4974        "@com_google_absl//absl/container:flat_hash_map",
4975        "@com_google_absl//absl/container:flat_hash_set",
4976        "@com_google_absl//absl/memory",
4977        "@com_google_absl//absl/strings",
4978        "@com_google_absl//absl/strings:str_format",
4979        "@com_google_absl//absl/types:span",
4980        "@com_google_absl//absl/types:variant",
4981    ],
4982)
4983
4984tf_cc_test(
4985    name = "hlo_parser_test",
4986    size = "small",
4987    srcs = ["hlo_parser_test.cc"],
4988    deps = [
4989        ":hlo",
4990        ":hlo_casting_utils",
4991        ":hlo_matchers",
4992        ":hlo_parser",
4993        ":pattern_matcher",
4994        ":pattern_matcher_gmock",
4995        "//tensorflow/compiler/xla:shape_util",
4996        "//tensorflow/compiler/xla:test_helpers",
4997        "//tensorflow/compiler/xla:window_util",
4998        "//tensorflow/compiler/xla:xla_data_proto_cc",
4999        "//tensorflow/compiler/xla/tests:verified_hlo_module",
5000        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
5001        "//tensorflow/core:lib",
5002        "//tensorflow/core:test",
5003        "@com_google_absl//absl/memory",
5004        "@com_google_absl//absl/strings",
5005    ],
5006)
5007
5008cc_library(
5009    name = "hlo_lexer",
5010    srcs = ["hlo_lexer.cc"],
5011    hdrs = [
5012        "hlo_lexer.h",
5013    ],
5014    deps = [
5015        "//tensorflow/compiler/xla:shape_util",
5016        "//tensorflow/compiler/xla:statusor",
5017        "//tensorflow/compiler/xla:types",
5018        "//tensorflow/compiler/xla:util",
5019        "//tensorflow/compiler/xla:xla_data_proto_cc",
5020        "//tensorflow/core:lib",
5021        "//tensorflow/core/platform:regexp",
5022        "@com_google_absl//absl/base",
5023        "@com_google_absl//absl/strings",
5024        "@com_google_absl//absl/types:optional",
5025    ],
5026)
5027
5028cc_library(
5029    name = "hlo_casting_utils",
5030    hdrs = ["hlo_casting_utils.h"],
5031    deps = ["//tensorflow/core:lib"],
5032)
5033
5034cc_library(
5035    name = "map_inliner",
5036    srcs = ["map_inliner.cc"],
5037    hdrs = ["map_inliner.h"],
5038    deps = [
5039        ":hlo",
5040        ":hlo_pass",
5041        ":hlo_query",
5042        "//tensorflow/compiler/xla:status_macros",
5043        "//tensorflow/compiler/xla:types",
5044        "//tensorflow/core:lib",
5045        "@com_google_absl//absl/types:span",
5046    ],
5047)
5048
5049cc_library(
5050    name = "optimize_input_output_buffer_alias",
5051    srcs = ["optimize_input_output_buffer_alias.cc"],
5052    hdrs = ["optimize_input_output_buffer_alias.h"],
5053    deps = [
5054        ":hlo",
5055        ":hlo_pass",
5056        "//tensorflow/compiler/xla:shape_tree",
5057        "//tensorflow/compiler/xla:shape_util",
5058        "//tensorflow/compiler/xla:status",
5059        "//tensorflow/compiler/xla:status_macros",
5060        "//tensorflow/compiler/xla:statusor",
5061        "//tensorflow/compiler/xla:util",
5062        "//tensorflow/core:lib",
5063        "@com_google_absl//absl/container:flat_hash_map",
5064        "@com_google_absl//absl/memory",
5065        "@com_google_absl//absl/strings:str_format",
5066    ],
5067)
5068
5069tf_cc_test(
5070    name = "optimize_input_output_buffer_alias_test",
5071    srcs = ["optimize_input_output_buffer_alias_test.cc"],
5072    deps = [
5073        ":optimize_input_output_buffer_alias",
5074        "//tensorflow/compiler/xla:shape_util",
5075        "//tensorflow/compiler/xla:status_macros",
5076        "//tensorflow/compiler/xla:test",
5077        "//tensorflow/compiler/xla:test_helpers",
5078        "//tensorflow/compiler/xla:util",
5079        "//tensorflow/compiler/xla/tests:hlo_test_base",
5080        "//tensorflow/compiler/xla/tests:test_utils",
5081        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
5082        "//tensorflow/core:lib",
5083        "//tensorflow/core:test",
5084        "@com_google_absl//absl/container:flat_hash_map",
5085        "@com_google_absl//absl/memory",
5086        "@com_google_absl//absl/strings:str_format",
5087    ],
5088)
5089
5090cc_library(
5091    name = "ar_crs_combiner",
5092    srcs = ["ar_crs_combiner.cc"],
5093    hdrs = ["ar_crs_combiner.h"],
5094    deps = [
5095        ":call_graph",
5096        ":hlo",
5097        ":hlo_pass",
5098        ":hlo_query",
5099        ":pattern_matcher",
5100        "//tensorflow/compiler/xla:literal",
5101        "//tensorflow/compiler/xla:literal_util",
5102        "//tensorflow/compiler/xla:shape_util",
5103        "//tensorflow/compiler/xla:status_macros",
5104        "//tensorflow/compiler/xla:statusor",
5105        "//tensorflow/compiler/xla:types",
5106        "//tensorflow/compiler/xla/service:hlo_replication_analysis",
5107        "@com_google_absl//absl/container:flat_hash_map",
5108        "@com_google_absl//absl/strings",
5109    ],
5110)
5111
5112cc_library(
5113    name = "compilation_stats",
5114    srcs = ["compilation_stats.cc"],
5115    hdrs = ["compilation_stats.h"],
5116    deps = [
5117        "//tensorflow/compiler/xla:types",
5118        "//tensorflow/core:lib",
5119        "@com_google_absl//absl/container:flat_hash_map",
5120        "@com_google_absl//absl/memory",
5121        "@com_google_absl//absl/strings:str_format",
5122    ],
5123)
5124
5125cc_library(
5126    name = "dynamic_index_splitter",
5127    srcs = ["dynamic_index_splitter.cc"],
5128    hdrs = ["dynamic_index_splitter.h"],
5129    deps = [
5130        ":hlo",
5131        ":hlo_casting_utils",
5132        ":hlo_pass",
5133        "//tensorflow/compiler/xla:shape_util",
5134        "//tensorflow/compiler/xla:statusor",
5135        "@com_google_absl//absl/container:flat_hash_map",
5136        "@com_google_absl//absl/container:flat_hash_set",
5137        "@com_google_absl//absl/container:inlined_vector",
5138        "@com_google_absl//absl/strings",
5139    ],
5140)
5141
5142tf_cc_test(
5143    name = "dynamic_index_splitter_test",
5144    srcs = ["dynamic_index_splitter_test.cc"],
5145    deps = [
5146        ":dynamic_index_splitter",
5147        ":hlo",
5148        ":hlo_matchers",
5149        "//tensorflow/compiler/xla:statusor",
5150        "//tensorflow/compiler/xla:test",
5151        "//tensorflow/compiler/xla:test_helpers",
5152        "//tensorflow/compiler/xla/tests:hlo_test_base",
5153        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
5154    ],
5155)
5156
5157tf_cc_test(
5158    name = "ar_crs_combiner_test",
5159    srcs = ["ar_crs_combiner_test.cc"],
5160    deps = [
5161        ":ar_crs_combiner",
5162        ":hlo",
5163        ":hlo_matchers",
5164        "//tensorflow/compiler/xla:statusor",
5165        "//tensorflow/compiler/xla/tests:hlo_test_base",
5166        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
5167        "//tensorflow/core:lib",
5168        "//tensorflow/core:test",
5169    ],
5170)
5171
5172tf_cc_test(
5173    name = "map_inliner_test",
5174    srcs = ["map_inliner_test.cc"],
5175    deps = [
5176        ":hlo",
5177        ":hlo_matchers",
5178        ":map_inliner",
5179        "//tensorflow/compiler/xla:literal",
5180        "//tensorflow/compiler/xla:shape_util",
5181        "//tensorflow/compiler/xla:test",
5182        "//tensorflow/compiler/xla:xla_data_proto_cc",
5183        "//tensorflow/compiler/xla/tests:hlo_test_base",
5184        "//tensorflow/compiler/xla/tests:literal_test_util",
5185        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
5186        "@com_google_absl//absl/memory",
5187    ],
5188)
5189
5190tf_cc_test(
5191    name = "hlo_casting_utils_test",
5192    srcs = ["hlo_casting_utils_test.cc"],
5193    deps = [
5194        ":hlo",
5195        ":hlo_casting_utils",
5196        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
5197        "//tensorflow/core:test",
5198    ],
5199)
5200
5201cc_library(
5202    name = "conditional_to_select",
5203    srcs = ["conditional_to_select.cc"],
5204    hdrs = ["conditional_to_select.h"],
5205    deps = [
5206        ":call_graph",
5207        ":call_inliner",
5208        ":hlo",
5209        ":hlo_creation_utils",
5210        ":hlo_pass",
5211        "//tensorflow/compiler/xla:status_macros",
5212        "//tensorflow/compiler/xla:types",
5213        "//tensorflow/core:lib",
5214    ],
5215)
5216
5217tf_cc_test(
5218    name = "conditional_to_select_test",
5219    srcs = ["conditional_to_select_test.cc"],
5220    deps = [
5221        ":conditional_to_select",
5222        ":hlo",
5223        ":hlo_matchers",
5224        "//tensorflow/compiler/xla:literal",
5225        "//tensorflow/compiler/xla:test",
5226        "//tensorflow/compiler/xla:xla_data_proto_cc",
5227        "//tensorflow/compiler/xla/tests:hlo_test_base",
5228        "//tensorflow/compiler/xla/tests:xla_internal_test_main",  # fixdeps: keep
5229        "@com_google_absl//absl/memory",
5230    ],
5231)
5232
5233cc_library(
5234    name = "slice_sinker",
5235    srcs = ["slice_sinker.cc"],
5236    hdrs = ["slice_sinker.h"],
5237    deps = [
5238        ":hlo",
5239        ":hlo_pass",
5240        "//tensorflow/compiler/xla:shape_util",
5241        "//tensorflow/compiler/xla:types",
5242        "//tensorflow/core:lib",
5243        "@com_google_absl//absl/algorithm:container",
5244        "@com_google_absl//absl/types:optional",
5245        "@com_google_absl//absl/types:span",
5246    ],
5247)
5248
5249cc_library(
5250    name = "custom_call_target_registry",
5251    srcs = ["custom_call_target_registry.cc"],
5252    hdrs = ["custom_call_target_registry.h"],
5253    visibility = ["//visibility:public"],
5254)
5255
5256tf_cc_test(
5257    name = "slice_sinker_test",
5258    srcs = ["slice_sinker_test.cc"],
5259    deps = [
5260        ":hlo",
5261        ":hlo_dce",
5262        ":hlo_parser",
5263        ":hlo_pass",
5264        ":pattern_matcher",
5265        ":pattern_matcher_gmock",
5266        ":slice_sinker",
5267        "//tensorflow/compiler/xla:literal_util",
5268        "//tensorflow/compiler/xla:shape_util",
5269        "//tensorflow/compiler/xla:test",
5270        "//tensorflow/compiler/xla:types",
5271        "//tensorflow/compiler/xla:xla_data_proto_cc",
5272        "//tensorflow/compiler/xla/tests:hlo_test_base",
5273        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
5274        "//tensorflow/core:lib",
5275        "//tensorflow/core:test",
5276    ],
5277)
5278
5279cc_library(
5280    name = "rng_expander",
5281    srcs = ["rng_expander.cc"],
5282    hdrs = ["rng_expander.h"],
5283    deps = [
5284        ":hlo_creation_utils",
5285        ":op_expander_pass",
5286        "//tensorflow/compiler/xla:literal_util",
5287        "//tensorflow/compiler/xla:shape_util",
5288        "//tensorflow/compiler/xla/client:xla_builder",
5289        "//tensorflow/compiler/xla/client/lib:prng",
5290    ],
5291)
5292
5293cc_library(
5294    name = "rng_bit_generator_expander",
5295    srcs = ["rng_bit_generator_expander.cc"],
5296    hdrs = ["rng_bit_generator_expander.h"],
5297    deps = [
5298        ":hlo",
5299        ":hlo_casting_utils",
5300        ":op_expander_pass",
5301        "//tensorflow/compiler/xla:shape_util",
5302        "//tensorflow/compiler/xla:statusor",
5303        "//tensorflow/compiler/xla:util",
5304        "//tensorflow/compiler/xla:xla_data_proto_cc",
5305        "//tensorflow/compiler/xla/client:xla_builder",
5306        "//tensorflow/compiler/xla/client/lib:prng",
5307        "//tensorflow/stream_executor/lib",
5308        "@com_google_absl//absl/container:flat_hash_map",
5309    ],
5310)
5311
5312cc_library(
5313    name = "slow_operation_alarm",
5314    srcs = ["slow_operation_alarm.cc"],
5315    hdrs = ["slow_operation_alarm.h"],
5316    deps = [
5317        "//tensorflow/compiler/xla:types",
5318        "//tensorflow/core:lib",
5319        "@com_google_absl//absl/algorithm:container",
5320        "@com_google_absl//absl/base",
5321        "@com_google_absl//absl/base:core_headers",
5322        "@com_google_absl//absl/memory",
5323        "@com_google_absl//absl/strings",
5324        "@com_google_absl//absl/synchronization",
5325        "@com_google_absl//absl/time",
5326    ],
5327)
5328
5329cc_library(
5330    name = "collective_ops_utils",
5331    srcs = ["collective_ops_utils.cc"],
5332    hdrs = ["collective_ops_utils.h"],
5333    deps = [
5334        ":computation_placer",
5335        ":global_device_id",
5336        ":hlo",
5337        ":pattern_matcher",
5338        "//tensorflow/compiler/xla:executable_run_options",
5339        "//tensorflow/compiler/xla:statusor",
5340        "//tensorflow/compiler/xla/service/gpu:gpu_executable_run_options",
5341        "//tensorflow/core:lib_internal",  # fixdeps: keep
5342    ],
5343)
5344
5345tf_cc_test(
5346    name = "collective_ops_utils_test",
5347    srcs = ["collective_ops_utils_test.cc"],
5348    deps = [
5349        ":collective_ops_utils",
5350        ":computation_placer",
5351        ":global_device_id",
5352        "//tensorflow/compiler/xla:xla_data_proto_cc",
5353        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
5354        "//tensorflow/core:test",
5355    ],
5356)
5357
5358cc_library(
5359    name = "topk_rewriter",
5360    srcs = ["topk_rewriter.cc"],
5361    hdrs = ["topk_rewriter.h"],
5362    deps = [
5363        ":hlo",
5364        ":hlo_casting_utils",
5365        ":hlo_pass",
5366        ":pattern_matcher",
5367        "//tensorflow/compiler/xla:shape_util",
5368        "@com_google_absl//absl/algorithm:container",
5369        "@com_google_absl//absl/types:optional",
5370    ],
5371)
5372
5373tf_cc_test(
5374    name = "topk_rewriter_test",
5375    srcs = ["topk_rewriter_test.cc"],
5376    deps = [
5377        ":hlo",
5378        ":hlo_dce",
5379        ":hlo_matchers",
5380        ":topk_rewriter",
5381        "//tensorflow/compiler/xla/tests:hlo_test_base",
5382        "//tensorflow/compiler/xla/tests:test_macros_cpu",
5383        "//tensorflow/compiler/xla/tests:test_utils",
5384        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
5385        "//tensorflow/core:test",
5386    ],
5387)
5388
5389cc_library(
5390    name = "operand_upcaster",
5391    srcs = ["operand_upcaster.cc"],
5392    hdrs = ["operand_upcaster.h"],
5393    deps = [
5394        ":hlo",
5395        ":op_expander_pass",
5396        ":shape_inference",
5397    ],
5398)
5399
5400tf_cc_test(
5401    name = "operand_upcaster_test",
5402    srcs = ["operand_upcaster_test.cc"],
5403    deps = [
5404        ":hlo_matchers",
5405        ":operand_upcaster",
5406        "//tensorflow/compiler/xla:shape_util",
5407        "//tensorflow/compiler/xla/tests:hlo_test_base",
5408        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
5409        "@com_google_absl//absl/strings",
5410    ],
5411)
5412
5413cc_library(
5414    name = "global_device_id",
5415    srcs = ["global_device_id.cc"],
5416    hdrs = ["global_device_id.h"],
5417    deps = [
5418        "//tensorflow/compiler/xla:types",
5419        "//tensorflow/core:lib_internal",
5420        "@com_google_absl//absl/strings",
5421        "@com_google_absl//absl/types:span",
5422    ],
5423)
5424
5425cc_library(
5426    name = "convert_operand_folding",
5427    srcs = ["convert_operand_folding.cc"],
5428    hdrs = ["convert_operand_folding.h"],
5429    deps = [
5430        ":hlo",
5431        ":op_expander_pass",
5432    ],
5433)
5434
5435tf_cc_test(
5436    name = "convert_operand_folding_test",
5437    srcs = ["convert_operand_folding_test.cc"],
5438    deps = [
5439        ":convert_operand_folding",
5440        ":hlo_matchers",
5441        "//tensorflow/compiler/xla:shape_util",
5442        "//tensorflow/compiler/xla/tests:hlo_test_base",
5443        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
5444        "@com_google_absl//absl/strings",
5445    ],
5446)
5447
5448cc_library(
5449    name = "xla_debug_info_manager",
5450    srcs = [
5451        "xla_debug_info_manager.cc",
5452    ],
5453    hdrs = [
5454        "xla_debug_info_manager.h",
5455    ],
5456    deps = [
5457        ":hlo",
5458        ":hlo_proto_cc",
5459        ":hlo_proto_util",
5460        "//tensorflow/core:lib",
5461        "@com_google_absl//absl/container:flat_hash_map",
5462    ],
5463)
5464
5465tf_cc_test(
5466    name = "xla_debug_info_manager_test",
5467    srcs = ["xla_debug_info_manager_test.cc"],
5468    deps = [
5469        ":hlo_proto_cc",
5470        ":xla_debug_info_manager",
5471        "//tensorflow/compiler/xla/tests:hlo_test_base",
5472        "//tensorflow/compiler/xla/tests:xla_internal_test_main",
5473    ],
5474)
5475
5476# copybara:uncomment_begin(google-only)
5477# py_proto_library(
5478#     name = "hlo_pb2",
5479#     api_version = 2,
5480#     deps = [":hlo_proto"],
5481# )
5482# copybara:uncomment_end
5483