1licenses(["notice"]) # Apache 2.0 2 3load("//tensorflow:tensorflow.bzl", "tf_cc_binary", "tf_cc_test") 4 5package_group( 6 name = "internal", 7 packages = [ 8 "//tensorflow/compiler/aot/...", 9 "//tensorflow/compiler/jit/...", 10 "//tensorflow/compiler/tests/...", 11 "//tensorflow/compiler/tf2xla/...", 12 ], 13) 14 15package_group( 16 name = "friends", 17 includes = [":internal"], 18 packages = ["//tensorflow/..."], 19) 20 21package( 22 default_visibility = [":internal"], 23) 24 25load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda_is_configured") 26load("//tensorflow/compiler/xla:xla.bzl", "xla_proto_library") 27 28cc_library( 29 name = "tf2xla_supported_ops_lib", 30 srcs = ["tf2xla_supported_ops.cc"], 31 hdrs = ["tf2xla_supported_ops.h"], 32 visibility = ["//visibility:public"], 33 deps = [ 34 ":xla_compiler", 35 "//tensorflow/compiler/tf2xla/kernels:xla_cpu_only_ops", 36 "//tensorflow/compiler/tf2xla/kernels:xla_ops", 37 "//tensorflow/core:framework", 38 "//tensorflow/core:framework_internal", 39 "//tensorflow/core:lib", 40 "//tensorflow/core:ops", 41 "//tensorflow/core:protos_all_cc", 42 ], 43) 44 45tf_cc_binary( 46 name = "tf2xla_supported_ops", 47 srcs = ["tf2xla_supported_ops_main.cc"], 48 visibility = ["//visibility:public"], 49 deps = [":tf2xla_supported_ops_lib"], 50) 51 52xla_proto_library( 53 name = "tf2xla_proto", 54 srcs = ["tf2xla.proto"], 55 visibility = ["//visibility:public"], 56 deps = [ 57 "//tensorflow/core:protos_all_cc", 58 ], 59) 60 61cc_library( 62 name = "tf2xla", 63 srcs = ["tf2xla.cc"], 64 hdrs = ["tf2xla.h"], 65 visibility = ["//visibility:public"], 66 deps = [ 67 ":common", 68 ":dump_graph", 69 ":tf2xla_proto", 70 ":tf2xla_util", 71 ":xla_compiler", 72 "//tensorflow/compiler/tf2xla/kernels:xla_cpu_only_ops", 73 "//tensorflow/compiler/tf2xla/kernels:xla_ops", 74 "//tensorflow/compiler/xla/client", 75 "//tensorflow/compiler/xla/client:computation", 76 "//tensorflow/core:core_cpu", 77 "//tensorflow/core:core_cpu_internal", 78 "//tensorflow/core:framework", 79 "//tensorflow/core:framework_internal", 80 "//tensorflow/core:lib", 81 "//tensorflow/core:protos_all_cc", 82 ], 83) 84 85cc_library( 86 name = "xla_compiled_cpu_function", 87 srcs = ["xla_compiled_cpu_function.cc"], 88 hdrs = ["xla_compiled_cpu_function.h"], 89 visibility = ["//visibility:public"], 90 deps = [ 91 # Keep dependencies to a minimum here; this library is used in every AOT 92 # binary produced by tfcompile. 93 "//tensorflow/compiler/aot:runtime", 94 "//tensorflow/compiler/xla:executable_run_options", 95 "//tensorflow/core:framework_lite", 96 ], 97) 98 99cc_library( 100 name = "xla_jit_compiled_cpu_function", 101 srcs = ["xla_jit_compiled_cpu_function.cc"], 102 hdrs = ["xla_jit_compiled_cpu_function.h"], 103 visibility = ["//visibility:public"], 104 deps = [ 105 ":tf2xla", 106 ":tf2xla_proto", 107 ":xla_compiled_cpu_function", 108 "//tensorflow/compiler/xla:shape_util", 109 "//tensorflow/compiler/xla:statusor", 110 "//tensorflow/compiler/xla:xla_data_proto", 111 "//tensorflow/compiler/xla/client:client_library", 112 "//tensorflow/compiler/xla/client:local_client", 113 "//tensorflow/compiler/xla/service:cpu_plugin", 114 "//tensorflow/compiler/xla/service/cpu:cpu_executable", 115 "//tensorflow/core:lib", 116 "//tensorflow/core:protos_all_cc", 117 ], 118) 119 120cc_library( 121 name = "xla_compiler", 122 srcs = [ 123 "const_analysis.cc", 124 "graph_compiler.cc", 125 "xla_compilation_device.cc", 126 "xla_compiler.cc", 127 "xla_context.cc", 128 "xla_helpers.cc", 129 "xla_op_kernel.cc", 130 "xla_op_registry.cc", 131 "xla_resource.cc", 132 "xla_cpu_backend.cc", 133 ] + if_cuda_is_configured([ 134 "xla_gpu_backend.cc", 135 ]), 136 hdrs = [ 137 "const_analysis.h", 138 "graph_compiler.h", 139 "xla_compilation_device.h", 140 "xla_compiler.h", 141 "xla_context.h", 142 "xla_helpers.h", 143 "xla_op_kernel.h", 144 "xla_op_registry.h", 145 "xla_resource.h", 146 ], 147 visibility = [":friends"], 148 deps = [ 149 ":common", 150 ":dump_graph", 151 ":functionalize_control_flow", 152 ":sharding_util", 153 ":tf2xla_util", 154 "//tensorflow/compiler/tf2xla/lib:util", 155 "//tensorflow/compiler/xla:literal_util", 156 "//tensorflow/compiler/xla:shape_util", 157 "//tensorflow/compiler/xla:statusor", 158 "//tensorflow/compiler/xla:types", 159 "//tensorflow/compiler/xla:xla_data_proto", 160 "//tensorflow/compiler/xla/client:client_library", 161 "//tensorflow/compiler/xla/client:computation", 162 "//tensorflow/compiler/xla/client:computation_builder", 163 "//tensorflow/compiler/xla/client:local_client", 164 "//tensorflow/core:core_cpu", 165 "//tensorflow/core:core_cpu_internal", 166 "//tensorflow/core:framework", 167 "//tensorflow/core:lib", 168 "//tensorflow/core:lib_internal", 169 "//tensorflow/core:protos_all_cc", 170 "//tensorflow/core:stream_executor_no_cuda", 171 ], 172 alwayslink = 1, 173) 174 175cc_library( 176 name = "common", 177 srcs = [ 178 "literal_util.cc", 179 "shape_util.cc", 180 "str_util.cc", 181 "type_util.cc", 182 ], 183 hdrs = [ 184 "literal_util.h", 185 "shape_util.h", 186 "str_util.h", 187 "type_util.h", 188 ], 189 visibility = [":friends"], 190 deps = [ 191 "//tensorflow/compiler/xla:literal_util", 192 "//tensorflow/compiler/xla:shape_util", 193 "//tensorflow/compiler/xla:xla_data_proto", 194 "//tensorflow/core:core_cpu_internal", 195 "//tensorflow/core:framework", 196 "//tensorflow/core:lib", 197 "//tensorflow/core:protos_all_cc", 198 ], 199) 200 201cc_library( 202 name = "sharding_util", 203 srcs = ["sharding_util.cc"], 204 hdrs = ["sharding_util.h"], 205 visibility = ["//visibility:public"], 206 deps = [ 207 "//tensorflow/compiler/xla:status_macros", 208 "//tensorflow/compiler/xla/client:computation_builder", 209 "//tensorflow/compiler/xla/client:sharding_builder", 210 "//tensorflow/core:core_cpu", 211 "//tensorflow/core:core_cpu_internal", 212 "//tensorflow/core:framework", 213 "//tensorflow/core:framework_internal", 214 "//tensorflow/core:lib", 215 "//tensorflow/core:protos_all_cc", 216 ], 217) 218 219tf_cc_test( 220 name = "sharding_util_test", 221 srcs = ["sharding_util_test.cc"], 222 deps = [ 223 ":sharding_util", 224 "//tensorflow/core:lib", 225 "//tensorflow/core:protos_all_cc", 226 "//tensorflow/core:test", 227 "//tensorflow/core:test_main", 228 ], 229) 230 231# Internal targets below this point. 232 233cc_library( 234 name = "tf2xla_util", 235 srcs = ["tf2xla_util.cc"], 236 hdrs = ["tf2xla_util.h"], 237 deps = [ 238 ":sharding_util", 239 ":tf2xla_proto", 240 "//tensorflow/compiler/xla:xla_data_proto", 241 "//tensorflow/core:core_cpu", 242 "//tensorflow/core:core_cpu_internal", 243 "//tensorflow/core:framework", 244 "//tensorflow/core:framework_internal", 245 "//tensorflow/core:graph", 246 "//tensorflow/core:lib", 247 "//tensorflow/core:protos_all_cc", 248 ], 249) 250 251tf_cc_test( 252 name = "tf2xla_util_test", 253 srcs = ["tf2xla_util_test.cc"], 254 deps = [ 255 ":sharding_util", 256 ":tf2xla_util", 257 "//tensorflow/cc:cc_ops", 258 "//tensorflow/cc:function_ops", 259 "//tensorflow/cc:ops", 260 "//tensorflow/core:core_cpu_internal", 261 "//tensorflow/core:lib", 262 "//tensorflow/core:math_ops_op_lib", 263 "//tensorflow/core:protos_all_cc", 264 "//tensorflow/core:test", 265 "//tensorflow/core:test_main", 266 ], 267) 268 269tf_cc_test( 270 name = "tf2xla_test", 271 srcs = ["tf2xla_test.cc"], 272 deps = [ 273 ":tf2xla", 274 ":tf2xla_proto", 275 "//tensorflow/compiler/xla:literal_util", 276 "//tensorflow/compiler/xla:statusor", 277 "//tensorflow/compiler/xla/client:client_library", 278 "//tensorflow/compiler/xla/client:local_client", 279 "//tensorflow/compiler/xla/service:cpu_plugin", 280 "//tensorflow/core:framework", 281 "//tensorflow/core:lib", 282 "//tensorflow/core:protos_all_cc", 283 "//tensorflow/core:test", 284 "//tensorflow/core:test_main", 285 ], 286) 287 288tf_cc_test( 289 name = "xla_jit_compiled_cpu_function_test", 290 srcs = ["xla_jit_compiled_cpu_function_test.cc"], 291 deps = [ 292 ":tf2xla_proto", 293 ":xla_jit_compiled_cpu_function", 294 "//tensorflow/compiler/xla:shape_util", 295 "//tensorflow/compiler/xla:status_macros", 296 "//tensorflow/compiler/xla:statusor", 297 "//tensorflow/compiler/xla:xla_data_proto", 298 "//tensorflow/compiler/xla/client:local_client", 299 "//tensorflow/core:framework", 300 "//tensorflow/core:lib", 301 "//tensorflow/core:protos_all_cc", 302 "//tensorflow/core:test", 303 "//tensorflow/core:test_main", 304 ], 305) 306 307tf_cc_test( 308 name = "xla_compiler_test", 309 srcs = ["xla_compiler_test.cc"], 310 deps = [ 311 ":xla_compiler", 312 "//tensorflow/cc:cc_ops", 313 "//tensorflow/cc:function_ops", 314 "//tensorflow/cc:ops", 315 "//tensorflow/cc:resource_variable_ops", 316 "//tensorflow/compiler/tf2xla/kernels:xla_ops", 317 "//tensorflow/compiler/xla:literal_util", 318 "//tensorflow/compiler/xla:shape_util", 319 "//tensorflow/compiler/xla/client:client_library", 320 "//tensorflow/compiler/xla/client:local_client", 321 "//tensorflow/compiler/xla/service:cpu_plugin", 322 "//tensorflow/compiler/xla/tests:literal_test_util", 323 "//tensorflow/core:core_cpu_internal", 324 "//tensorflow/core:framework", 325 "//tensorflow/core:tensor_testutil", 326 "//tensorflow/core:test", 327 "//tensorflow/core:test_main", 328 "//tensorflow/core:testlib", 329 ], 330) 331 332tf_cc_test( 333 name = "str_util_test", 334 srcs = [ 335 "str_util_test.cc", 336 ], 337 deps = [ 338 ":common", 339 "//tensorflow/core:lib", 340 "//tensorflow/core:test", 341 "//tensorflow/core:test_main", 342 ], 343) 344 345tf_cc_test( 346 name = "literal_util_test", 347 srcs = [ 348 "literal_util_test.cc", 349 ], 350 deps = [ 351 ":common", 352 "//tensorflow/compiler/xla:literal_util", 353 "//tensorflow/core:framework", 354 "//tensorflow/core:test", 355 "//tensorflow/core:test_main", 356 "//tensorflow/core:testlib", 357 ], 358) 359 360tf_cc_test( 361 name = "const_analysis_test", 362 size = "small", 363 srcs = ["const_analysis_test.cc"], 364 deps = [ 365 ":xla_compiler", 366 "//tensorflow/cc:cc_ops", 367 "//tensorflow/cc:function_ops", 368 "//tensorflow/cc:ops", 369 "//tensorflow/compiler/tf2xla/kernels:xla_ops", 370 "//tensorflow/core:core_cpu_internal", 371 "//tensorflow/core:ops", 372 "//tensorflow/core:test", 373 "//tensorflow/core:test_main", 374 ], 375) 376 377cc_library( 378 name = "dump_graph", 379 srcs = [ 380 "dump_graph.cc", 381 "dump_graph_flags.cc", 382 "dump_graph_flags.h", 383 ], 384 hdrs = [ 385 "dump_graph.h", 386 ], 387 deps = [ 388 "//tensorflow/compiler/xla/legacy_flags:parse_flags_from_env", 389 "//tensorflow/core:core_cpu", 390 "//tensorflow/core:core_cpu_internal", 391 "//tensorflow/core:framework", 392 "//tensorflow/core:framework_internal", 393 "//tensorflow/core:lib", 394 "//tensorflow/core:protos_all_cc", 395 ], 396) 397 398cc_library( 399 name = "functionalize_control_flow", 400 srcs = ["functionalize_control_flow.cc"], 401 hdrs = ["functionalize_control_flow.h"], 402 deps = [ 403 ":tf2xla_util", 404 "//tensorflow/compiler/jit:graph_to_functiondef", 405 "//tensorflow/compiler/jit:union_find", 406 "//tensorflow/compiler/tf2xla:dump_graph", 407 "//tensorflow/compiler/tf2xla/ops:functional_ops", 408 "//tensorflow/compiler/xla:status_macros", 409 "//tensorflow/compiler/xla:util", 410 "//tensorflow/core:core_cpu", 411 "//tensorflow/core:core_cpu_internal", 412 "//tensorflow/core:framework", 413 "//tensorflow/core:graph", 414 "//tensorflow/core:lib", 415 ], 416) 417 418tf_cc_test( 419 name = "functionalize_control_flow_test", 420 srcs = ["functionalize_control_flow_test.cc"], 421 deps = [ 422 ":functionalize_control_flow", 423 ":test_util", 424 "//tensorflow/cc:cc_ops", 425 "//tensorflow/cc:cc_ops_internal", 426 "//tensorflow/cc:function_ops", 427 "//tensorflow/cc:ops", 428 "//tensorflow/cc:resource_variable_ops", 429 "//tensorflow/compiler/tf2xla/cc:functional_ops", 430 "//tensorflow/compiler/xla:status_macros", 431 "//tensorflow/core:core_cpu", 432 "//tensorflow/core:core_cpu_internal", 433 "//tensorflow/core:framework", 434 "//tensorflow/core:framework_internal", 435 "//tensorflow/core:ops", 436 "//tensorflow/core:resource_variable_ops_op_lib", 437 "//tensorflow/core:test", 438 "//tensorflow/core:test_main", 439 ], 440) 441 442cc_library( 443 name = "test_util", 444 testonly = 1, 445 srcs = ["test_util.cc"], 446 hdrs = ["test_util.h"], 447 deps = [ 448 "//tensorflow/compiler/xla:status_macros", 449 "//tensorflow/core:core_cpu", 450 "//tensorflow/core:framework", 451 "//tensorflow/core:lib", 452 "//tensorflow/core:protos_all_cc", 453 ], 454) 455 456# ----------------------------------------------------------------------------- 457 458filegroup( 459 name = "all_files", 460 srcs = glob( 461 ["**/*"], 462 exclude = [ 463 "**/METADATA", 464 "**/OWNERS", 465 ], 466 ), 467 visibility = ["//tensorflow:__subpackages__"], 468) 469