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