1# Description: 2# Libraries for helping construct LLVM IR for XLA backends. 3 4load("//tensorflow:tensorflow.bzl", "filegroup") 5load("//tensorflow/core/platform:rules_cc.bzl", "cc_library") 6load( 7 "//tensorflow:tensorflow.bzl", 8 "tf_cc_test", 9) 10 11package( 12 default_visibility = [":friends"], 13 licenses = ["notice"], # Apache 2.0 14) 15 16package_group( 17 name = "friends", 18 includes = [ 19 "//tensorflow/compiler/xla:friends", 20 ], 21) 22 23# Filegroup used to collect source files for dependency checking. 24filegroup( 25 name = "c_srcs", 26 data = glob([ 27 "**/*.cc", 28 "**/*.h", 29 ]), 30) 31 32cc_library( 33 name = "alias_analysis", 34 srcs = ["alias_analysis.cc"], 35 hdrs = ["alias_analysis.h"], 36 deps = [ 37 ":ir_array", 38 ":llvm_util", 39 "//tensorflow/compiler/xla:types", 40 "//tensorflow/compiler/xla/service:buffer_assignment", 41 "//tensorflow/compiler/xla/service:hlo", 42 "//tensorflow/compiler/xla/service:logical_buffer", 43 "//tensorflow/core:lib", 44 "@com_google_absl//absl/container:flat_hash_map", 45 "@com_google_absl//absl/container:flat_hash_set", 46 "@com_google_absl//absl/strings", 47 "@llvm-project//llvm:Core", 48 ], 49) 50 51tf_cc_test( 52 name = "alias_analysis_test", 53 srcs = ["alias_analysis_test.cc"], 54 deps = [ 55 ":alias_analysis", 56 "//tensorflow/compiler/xla/service:custom_call_target_registry", 57 "//tensorflow/compiler/xla/service:hlo_parser", 58 "//tensorflow/compiler/xla/service/cpu/tests:cpu_codegen_test", 59 "//tensorflow/compiler/xla/tests:filecheck", 60 "//tensorflow/core:test", 61 ], 62) 63 64cc_library( 65 name = "llvm_util", 66 srcs = ["llvm_util.cc"], 67 hdrs = ["llvm_util.h"], 68 deps = [ 69 "//tensorflow/compiler/xla:debug_options_flags", 70 "//tensorflow/compiler/xla:literal", 71 "//tensorflow/compiler/xla:shape_util", 72 "//tensorflow/compiler/xla:types", 73 "//tensorflow/compiler/xla:util", 74 "//tensorflow/compiler/xla:xla_data_proto_cc", 75 "//tensorflow/compiler/xla/service:dump", 76 "//tensorflow/compiler/xla/service:hlo", 77 "//tensorflow/compiler/xla/service:hlo_module_config", 78 "//tensorflow/compiler/xla/service:name_uniquer", 79 "//tensorflow/compiler/xla/service/cpu:cpu_options", 80 "//tensorflow/core:lib", 81 "@com_google_absl//absl/base", 82 "@com_google_absl//absl/strings", 83 "@com_google_absl//absl/types:span", 84 "@llvm-project//llvm:Core", 85 "@llvm-project//llvm:Support", 86 "@llvm-project//llvm:Target", 87 "@llvm-project//llvm:TransformUtils", 88 ], 89) 90 91cc_library( 92 name = "ir_array", 93 srcs = ["ir_array.cc"], 94 hdrs = ["ir_array.h"], 95 deps = [ 96 ":llvm_util", 97 "//tensorflow/compiler/xla:permutation_util", 98 "//tensorflow/compiler/xla:shape_util", 99 "//tensorflow/compiler/xla:statusor", 100 "//tensorflow/compiler/xla:types", 101 "//tensorflow/compiler/xla:util", 102 "//tensorflow/compiler/xla:xla_data_proto_cc", 103 "//tensorflow/core:lib", 104 "@com_google_absl//absl/algorithm:container", 105 "@com_google_absl//absl/strings", 106 "@com_google_absl//absl/types:span", 107 "@llvm-project//llvm:Core", 108 ], 109) 110 111cc_library( 112 name = "llvm_loop", 113 srcs = ["llvm_loop.cc"], 114 hdrs = ["llvm_loop.h"], 115 deps = [ 116 ":ir_array", 117 ":llvm_util", 118 "//tensorflow/compiler/xla:shape_util", 119 "//tensorflow/compiler/xla:types", 120 "//tensorflow/compiler/xla:xla_data_proto_cc", 121 "//tensorflow/core:lib", 122 "@com_google_absl//absl/algorithm:container", 123 "@com_google_absl//absl/strings", 124 "@com_google_absl//absl/types:span", 125 "@llvm-project//llvm:Core", 126 ], 127) 128 129cc_library( 130 name = "loop_emitter", 131 srcs = ["loop_emitter.cc"], 132 hdrs = ["loop_emitter.h"], 133 deps = [ 134 ":ir_array", 135 ":llvm_loop", 136 "//tensorflow/compiler/xla:shape_util", 137 "//tensorflow/compiler/xla:status_macros", 138 "//tensorflow/compiler/xla:statusor", 139 "//tensorflow/compiler/xla:types", 140 "//tensorflow/compiler/xla:xla_data_proto_cc", 141 "//tensorflow/core:lib", 142 "@com_google_absl//absl/strings:str_format", 143 "@llvm-project//llvm:Core", 144 ], 145) 146 147cc_library( 148 name = "fused_ir_emitter", 149 srcs = ["fused_ir_emitter.cc"], 150 hdrs = ["fused_ir_emitter.h"], 151 deps = [ 152 ":ir_array", 153 ":llvm_util", 154 ":loop_emitter", 155 ":tuple_ops", 156 "//tensorflow/compiler/xla:shape_util", 157 "//tensorflow/compiler/xla:status_macros", 158 "//tensorflow/compiler/xla:statusor", 159 "//tensorflow/compiler/xla:util", 160 "//tensorflow/compiler/xla:xla_data_proto_cc", 161 "//tensorflow/compiler/xla/service:elemental_ir_emitter", 162 "//tensorflow/compiler/xla/service:fusion_node_indexing_evaluation", 163 "//tensorflow/compiler/xla/service:hlo", 164 "//tensorflow/core:lib", 165 "@com_google_absl//absl/container:flat_hash_map", 166 "@com_google_absl//absl/types:optional", 167 "@com_google_absl//absl/types:span", 168 "@llvm-project//llvm:Core", 169 ], 170) 171 172cc_library( 173 name = "dynamic_update_slice_util", 174 srcs = ["dynamic_update_slice_util.cc"], 175 hdrs = ["dynamic_update_slice_util.h"], 176 deps = [ 177 ":fused_ir_emitter", 178 ":ir_array", 179 ":llvm_util", 180 ":loop_emitter", 181 "//tensorflow/compiler/xla/service:buffer_assignment", 182 "//tensorflow/compiler/xla/service:elemental_ir_emitter", 183 "//tensorflow/compiler/xla/service:hlo", 184 "//tensorflow/compiler/xla/service/gpu:launch_dimensions", 185 "//tensorflow/compiler/xla/service/gpu:parallel_loop_emitter", 186 ], 187) 188 189cc_library( 190 name = "sort_util", 191 srcs = ["sort_util.cc"], 192 hdrs = ["sort_util.h"], 193 deps = [ 194 ":ir_array", 195 ":kernel_support_library", 196 ":llvm_loop", 197 ":llvm_util", 198 ":loop_emitter", 199 "//tensorflow/compiler/xla:shape_util", 200 "//tensorflow/compiler/xla:util", 201 "//tensorflow/compiler/xla/service/gpu:launch_dimensions", 202 "//tensorflow/compiler/xla/service/gpu:parallel_loop_emitter", 203 "//tensorflow/compiler/xla/service/gpu:target_util", 204 "//tensorflow/core:lib", 205 "@com_google_absl//absl/strings", 206 "@com_google_absl//absl/types:span", 207 "@llvm-project//llvm:Core", 208 "@llvm-project//llvm:Support", 209 ], 210) 211 212cc_library( 213 name = "tuple_ops", 214 srcs = ["tuple_ops.cc"], 215 hdrs = ["tuple_ops.h"], 216 deps = [ 217 ":ir_array", 218 ":llvm_util", 219 "//tensorflow/compiler/xla:shape_util", 220 "//tensorflow/compiler/xla:types", 221 "//tensorflow/compiler/xla:xla_data_proto_cc", 222 "//tensorflow/core:lib", 223 "@com_google_absl//absl/types:span", 224 "@llvm-project//llvm:Core", 225 ], 226) 227 228cc_library( 229 name = "kernel_support_library", 230 srcs = ["kernel_support_library.cc"], 231 hdrs = ["kernel_support_library.h"], 232 deps = [ 233 ":llvm_loop", 234 ":llvm_util", 235 "@com_google_absl//absl/strings", 236 "@llvm-project//llvm:Core", 237 ], 238) 239 240cc_library( 241 name = "buffer_assignment_util", 242 srcs = ["buffer_assignment_util.cc"], 243 hdrs = ["buffer_assignment_util.h"], 244 deps = [ 245 "//tensorflow/compiler/xla/service:buffer_assignment", 246 "@com_google_absl//absl/strings", 247 ], 248) 249 250cc_library( 251 name = "math_ops", 252 srcs = ["math_ops.cc"], 253 hdrs = ["math_ops.h"], 254 deps = [ 255 ":llvm_util", 256 "@llvm-project//llvm:Core", 257 ], 258) 259 260cc_library( 261 name = "ir_builder_mixin", 262 srcs = [], 263 hdrs = ["ir_builder_mixin.h"], 264 deps = [ 265 "@llvm-project//llvm:Core", 266 ], 267) 268 269tf_cc_test( 270 name = "ir_array_test", 271 srcs = ["ir_array_test.cc"], 272 deps = [ 273 ":ir_array", 274 "//tensorflow/compiler/xla:test", 275 "//tensorflow/compiler/xla/tests:xla_internal_test_main", 276 ], 277) 278