1# Description: 2# XLA client libraries. 3 4load("//tensorflow:tensorflow.bzl", "filegroup") 5load("//tensorflow/core/platform:rules_cc.bzl", "cc_library") 6load("//tensorflow:tensorflow.bzl", "tf_cc_test") 7 8package( 9 default_visibility = ["//visibility:public"], 10 licenses = ["notice"], 11) 12 13package_group( 14 name = "friends", 15 includes = [ 16 "//tensorflow/compiler/xla:friends", 17 ], 18) 19 20# Filegroup used to collect source files for dependency checking. 21filegroup( 22 name = "c_srcs", 23 data = glob([ 24 "**/*.cc", 25 "**/*.h", 26 ]), 27) 28 29cc_library( 30 name = "global_data", 31 srcs = ["global_data.cc"], 32 hdrs = ["global_data.h"], 33 deps = [ 34 "//tensorflow/compiler/xla:service_interface", 35 "//tensorflow/compiler/xla:types", 36 "//tensorflow/compiler/xla:xla_data_proto_cc", 37 "//tensorflow/compiler/xla:xla_proto_cc", 38 "//tensorflow/core:lib", 39 "@com_google_absl//absl/container:flat_hash_map", 40 "@com_google_absl//absl/types:span", 41 ], 42) 43 44cc_library( 45 name = "padding", 46 srcs = ["padding.cc"], 47 hdrs = ["padding.h"], 48 deps = [ 49 "//tensorflow/compiler/xla:statusor", 50 "//tensorflow/compiler/xla:types", 51 "//tensorflow/compiler/xla:util", 52 "//tensorflow/core:lib", 53 "@com_google_absl//absl/types:span", 54 ], 55) 56 57tf_cc_test( 58 name = "padding_test", 59 srcs = ["padding_test.cc"], 60 deps = [ 61 ":padding", 62 "//tensorflow/core:test", 63 "//tensorflow/core:test_main", 64 ], 65) 66 67cc_library( 68 name = "client", 69 srcs = ["client.cc"], 70 hdrs = ["client.h"], 71 deps = [ 72 ":global_data", 73 ":xla_computation", 74 "//tensorflow/compiler/xla:debug_options_flags", 75 "//tensorflow/compiler/xla:execution_options_util", 76 "//tensorflow/compiler/xla:literal", 77 "//tensorflow/compiler/xla:service_interface", 78 "//tensorflow/compiler/xla:status_macros", 79 "//tensorflow/compiler/xla:statusor", 80 "//tensorflow/compiler/xla:types", 81 "//tensorflow/compiler/xla:xla_data_proto_cc", 82 "//tensorflow/compiler/xla:xla_proto_cc", 83 "//tensorflow/compiler/xla/service:hlo_proto_cc", 84 "//tensorflow/core:lib", 85 "@com_google_absl//absl/memory", 86 "@com_google_absl//absl/strings", 87 "@com_google_absl//absl/types:span", 88 ], 89) 90 91cc_library( 92 name = "executable_build_options", 93 srcs = ["executable_build_options.cc"], 94 hdrs = ["executable_build_options.h"], 95 deps = [ 96 "//tensorflow/compiler/xla:debug_options_flags", 97 "//tensorflow/compiler/xla:execution_options_util", 98 "//tensorflow/compiler/xla:shape_util", 99 "//tensorflow/compiler/xla:util", 100 "//tensorflow/compiler/xla:xla_data_proto_cc", 101 "//tensorflow/compiler/xla:xla_proto_cc", 102 "//tensorflow/compiler/xla/pjrt:compile_options_proto_cc", 103 "//tensorflow/compiler/xla/service:computation_placer", 104 "//tensorflow/core:lib", 105 "@com_google_absl//absl/strings", 106 "@com_google_absl//absl/strings:str_format", 107 ], 108) 109 110cc_library( 111 name = "local_client", 112 srcs = ["local_client.cc"], 113 hdrs = ["local_client.h"], 114 deps = [ 115 ":client", 116 ":executable_build_options", 117 ":xla_computation", 118 "//tensorflow/compiler/xla:executable_run_options", 119 "//tensorflow/compiler/xla:shape_tree", 120 "//tensorflow/compiler/xla:status_macros", 121 "//tensorflow/compiler/xla:statusor", 122 "//tensorflow/compiler/xla:xla_data_proto_cc", 123 "//tensorflow/compiler/xla/service:backend", 124 "//tensorflow/compiler/xla/service:compiler", 125 "//tensorflow/compiler/xla/service:dump", 126 "//tensorflow/compiler/xla/service:executable", 127 "//tensorflow/compiler/xla/service:hlo_proto_cc", 128 "//tensorflow/compiler/xla/service:local_service", 129 "//tensorflow/compiler/xla/service:maybe_owning_device_memory", 130 "//tensorflow/compiler/xla/service:shaped_buffer", 131 "//tensorflow/compiler/xla/service:source_map_util", 132 "//tensorflow/compiler/xla/service:stream_pool", 133 "//tensorflow/core/platform:stream_executor_no_cuda", 134 "//tensorflow/stream_executor:device_memory_allocator", 135 "@com_google_absl//absl/memory", 136 "@com_google_absl//absl/types:span", 137 "@llvm-project//llvm:Support", 138 ], 139) 140 141cc_library( 142 name = "compile_only_client", 143 srcs = ["compile_only_client.cc"], 144 hdrs = ["compile_only_client.h"], 145 deps = [ 146 ":client", 147 ":xla_computation", 148 "//tensorflow/compiler/xla:status_macros", 149 "//tensorflow/compiler/xla:statusor", 150 "//tensorflow/compiler/xla:xla_data_proto_cc", 151 "//tensorflow/compiler/xla/service:compile_only_service", 152 "//tensorflow/compiler/xla/service:compiler", 153 "//tensorflow/core/platform:stream_executor_no_cuda", 154 "@com_google_absl//absl/memory", 155 "@llvm-project//llvm:Support", 156 ], 157) 158 159# This target is used to instantiate the XLA service in-process and create 160# a client for it. 161cc_library( 162 name = "client_library", 163 srcs = ["client_library.cc"], 164 hdrs = ["client_library.h"], 165 deps = [ 166 ":compile_only_client", 167 ":local_client", 168 "//tensorflow/compiler/xla:status_macros", 169 "//tensorflow/compiler/xla:statusor", 170 "//tensorflow/compiler/xla:types", 171 "//tensorflow/compiler/xla:util", 172 "//tensorflow/compiler/xla/service:backend", 173 "//tensorflow/compiler/xla/service:compile_only_service", 174 "//tensorflow/compiler/xla/service:local_service", 175 "//tensorflow/compiler/xla/service:platform_util", 176 "//tensorflow/core:lib", 177 "//tensorflow/core/platform:stream_executor_no_cuda", 178 "//tensorflow/stream_executor:device_memory_allocator", 179 "@com_google_absl//absl/container:flat_hash_map", 180 "@com_google_absl//absl/memory", 181 ], 182) 183 184cc_library( 185 name = "sharding_builder", 186 srcs = ["sharding_builder.cc"], 187 hdrs = ["sharding_builder.h"], 188 deps = [ 189 "//tensorflow/compiler/xla:array", 190 "//tensorflow/compiler/xla:shape_tree", 191 "//tensorflow/compiler/xla:shape_util", 192 "//tensorflow/compiler/xla:types", 193 "//tensorflow/compiler/xla:util", 194 "//tensorflow/compiler/xla:xla_data_proto_cc", 195 ], 196) 197 198cc_library( 199 name = "xla_computation", 200 srcs = ["xla_computation.cc"], 201 hdrs = ["xla_computation.h"], 202 visibility = ["//visibility:public"], 203 deps = [ 204 "//tensorflow/compiler/xla:shape_util", 205 "//tensorflow/compiler/xla:status_macros", 206 "//tensorflow/compiler/xla:util", 207 "//tensorflow/compiler/xla:xla_data_proto_cc", 208 "//tensorflow/compiler/xla/service:hlo_proto_cc", 209 "@com_google_absl//absl/memory", 210 ], 211) 212 213cc_library( 214 name = "value_inference", 215 srcs = ["value_inference.cc"], 216 hdrs = ["value_inference.h"], 217 visibility = ["//visibility:public"], 218 deps = [ 219 ":xla_builder", 220 "//tensorflow/compiler/xla:comparison_util", 221 "//tensorflow/compiler/xla:literal", 222 "//tensorflow/compiler/xla:literal_util", 223 "//tensorflow/compiler/xla:shape_util", 224 "//tensorflow/compiler/xla:status_macros", 225 "//tensorflow/compiler/xla:statusor", 226 "//tensorflow/compiler/xla:util", 227 "//tensorflow/compiler/xla:xla_data_proto_cc", 228 "//tensorflow/compiler/xla/service:hlo", 229 "//tensorflow/compiler/xla/service:hlo_evaluator", 230 "//tensorflow/compiler/xla/service:hlo_proto_cc", 231 "//tensorflow/core/platform:errors", 232 "//tensorflow/stream_executor/lib", 233 "@com_google_absl//absl/container:flat_hash_map", 234 "@com_google_absl//absl/strings:str_format", 235 "@com_google_absl//absl/types:span", 236 ], 237) 238 239cc_library( 240 name = "xla_builder", 241 srcs = ["xla_builder.cc"], 242 hdrs = ["xla_builder.h"], 243 visibility = ["//visibility:public"], 244 deps = [ 245 ":padding", 246 ":sharding_builder", 247 ":xla_computation", 248 "//tensorflow/compiler/xla:comparison_util", 249 "//tensorflow/compiler/xla:literal", 250 "//tensorflow/compiler/xla:literal_util", 251 "//tensorflow/compiler/xla:permutation_util", 252 "//tensorflow/compiler/xla:shape_util", 253 "//tensorflow/compiler/xla:sharding_op_util", 254 "//tensorflow/compiler/xla:status_macros", 255 "//tensorflow/compiler/xla:statusor", 256 "//tensorflow/compiler/xla:types", 257 "//tensorflow/compiler/xla:util", 258 "//tensorflow/compiler/xla:window_util", 259 "//tensorflow/compiler/xla:xla_data_proto_cc", 260 "//tensorflow/compiler/xla/service:hlo", 261 "//tensorflow/compiler/xla/service:hlo_proto_cc", 262 "//tensorflow/compiler/xla/service:shape_inference", 263 "//tensorflow/core:lib", 264 "@com_google_absl//absl/algorithm:container", 265 "@com_google_absl//absl/container:flat_hash_map", 266 "@com_google_absl//absl/container:flat_hash_set", 267 "@com_google_absl//absl/strings", 268 "@com_google_absl//absl/types:span", 269 ], 270) 271 272tf_cc_test( 273 name = "xla_builder_test", 274 srcs = ["xla_builder_test.cc"], 275 deps = [ 276 ":value_inference", 277 ":xla_builder", 278 ":xla_computation", 279 "//tensorflow/compiler/xla:debug_options_flags", 280 "//tensorflow/compiler/xla:literal", 281 "//tensorflow/compiler/xla:shape_util", 282 "//tensorflow/compiler/xla:status_macros", 283 "//tensorflow/compiler/xla:test", 284 "//tensorflow/compiler/xla:test_helpers", 285 "//tensorflow/compiler/xla:util", 286 "//tensorflow/compiler/xla:xla_data_proto_cc", 287 "//tensorflow/compiler/xla/service:hlo", 288 "//tensorflow/compiler/xla/service:hlo_matchers", 289 "//tensorflow/compiler/xla/tests:xla_internal_test_main", 290 "//tensorflow/core:test", 291 ], 292) 293