1 licenses(["notice"]) # Apache 2.0 2 3 load("//tensorflow:tensorflow.bzl", "tf_cuda_library", "tf_cc_test") 4 load( 5 "//tensorflow/core:platform/default/build_config.bzl", 6 "tf_protos_grappler", 7 ) 8 9 filegroup( 10 name = "all_files", 11 srcs = glob( 12 ["**/*"], 13 exclude = [ 14 "**/METADATA", 15 "**/OWNERS", 16 ], 17 ), 18 visibility = ["//tensorflow:__subpackages__"], 19 ) 20 21 filegroup( 22 name = "graph_properties_testdata", 23 srcs = glob([ 24 "graph_properties_testdata/*.pbtxt", 25 "graph_properties_testdata/*.pbtxt.html", 26 ]), 27 visibility = ["//visibility:public"], 28 ) 29 30 load( 31 "//tensorflow/core:platform/default/build_config.bzl", 32 "tf_proto_library", 33 "tf_additional_all_protos", 34 ) 35 load( 36 "@local_config_cuda//cuda:build_defs.bzl", 37 "if_cuda", 38 ) 39 40 tf_proto_library( 41 name = "op_performance_data", 42 srcs = ["op_performance_data.proto"], 43 cc_api_version = 2, 44 default_header = True, 45 protodeps = tf_additional_all_protos(), 46 visibility = ["//visibility:public"], 47 ) 48 49 cc_library( 50 name = "graph_properties", 51 srcs = ["graph_properties.cc"], 52 hdrs = ["graph_properties.h"], 53 visibility = ["//visibility:public"], 54 deps = [ 55 ":utils", 56 "//tensorflow/core:core_cpu_base", 57 "//tensorflow/core:framework", 58 "//tensorflow/core:protos_all_cc", 59 "//tensorflow/core/grappler:grappler_item", 60 "//tensorflow/core/grappler:utils", 61 "//tensorflow/core/grappler/clusters:cluster", 62 ] + tf_protos_grappler(), 63 ) 64 65 tf_cc_test( 66 name = "graph_properties_test", 67 srcs = ["graph_properties_test.cc"], 68 args = ["--heap_check=local"], # The GPU tracer leaks memory 69 data = [":graph_properties_testdata"], 70 deps = [ 71 ":graph_properties", 72 "//tensorflow/cc:cc_ops", 73 "//tensorflow/cc:scope", 74 "//tensorflow/core:framework", 75 "//tensorflow/core:lib", 76 "//tensorflow/core:lib_proto_parsing", 77 "//tensorflow/core:protos_all_cc", 78 "//tensorflow/core:tensor_testutil", 79 "//tensorflow/core:test", 80 "//tensorflow/core:test_main", 81 "//tensorflow/core/grappler:grappler_item", 82 "//tensorflow/core/grappler/clusters:single_machine", 83 "//tensorflow/core/grappler/inputs:trivial_test_graph_input_yielder", 84 "//tensorflow/core/grappler/inputs:utils", 85 ], 86 ) 87 88 cc_library( 89 name = "graph_memory", 90 srcs = ["graph_memory.cc"], 91 hdrs = ["graph_memory.h"], 92 visibility = ["//visibility:public"], 93 deps = [ 94 ":cost_estimator", 95 ":graph_properties", 96 "//tensorflow/core:framework", 97 "//tensorflow/core:protos_all_cc", 98 "//tensorflow/core/grappler:grappler_item", 99 "//tensorflow/core/grappler:utils", 100 "//tensorflow/core/grappler/clusters:cluster", 101 "//tensorflow/core/grappler/clusters:virtual_cluster", 102 ], 103 ) 104 105 tf_cc_test( 106 name = "graph_memory_test", 107 srcs = ["graph_memory_test.cc"], 108 args = ["--heap_check=local"], # The GPU tracer leaks memory 109 deps = [ 110 ":graph_memory", 111 "//tensorflow/cc:cc_ops", 112 "//tensorflow/core:test", 113 "//tensorflow/core:test_main", 114 "//tensorflow/core/grappler:grappler_item", 115 "//tensorflow/core/grappler/inputs:trivial_test_graph_input_yielder", 116 ], 117 ) 118 119 cc_library( 120 name = "robust_stats", 121 srcs = ["robust_stats.cc"], 122 hdrs = ["robust_stats.h"], 123 visibility = ["//visibility:public"], 124 ) 125 126 tf_cc_test( 127 name = "robust_stats_test", 128 srcs = ["robust_stats_test.cc"], 129 deps = [ 130 ":robust_stats", 131 "//tensorflow/core:test", 132 "//tensorflow/core:test_main", 133 ], 134 ) 135 136 tf_cuda_library( 137 name = "utils", 138 srcs = ["utils.cc"], 139 hdrs = ["utils.h"], 140 visibility = ["//visibility:public"], 141 deps = [ 142 "//third_party/eigen3", 143 "//tensorflow/core:framework", 144 "//tensorflow/core:graph", 145 "//tensorflow/core:lib", 146 "//tensorflow/core:lib_proto_parsing", 147 "//tensorflow/core:protos_all_cc", 148 "//tensorflow/core/grappler:utils", 149 "//tensorflow/core/grappler/clusters:utils", 150 ] + tf_protos_grappler(), 151 ) 152 153 tf_cc_test( 154 name = "utils_test", 155 srcs = ["utils_test.cc"], 156 visibility = ["//visibility:public"], 157 deps = [ 158 ":utils", 159 "//tensorflow/cc:cc_ops", 160 "//tensorflow/core:all_kernels", 161 "//tensorflow/core:core_cpu_internal", 162 "//tensorflow/core:framework", 163 "//tensorflow/core:protos_all_cc", 164 "//tensorflow/core:tensor_testutil", 165 "//tensorflow/core:test", 166 "//tensorflow/core:test_main", 167 "//tensorflow/core:testlib", 168 ], 169 ) 170 171 cc_library( 172 name = "cost_estimator", 173 hdrs = ["cost_estimator.h"], 174 visibility = ["//visibility:public"], 175 deps = [ 176 "//tensorflow/core:lib", 177 ], 178 ) 179 180 cc_library( 181 name = "virtual_placer", 182 srcs = ["virtual_placer.cc"], 183 hdrs = ["virtual_placer.h"], 184 visibility = ["//visibility:public"], 185 deps = [ 186 "//tensorflow/core:framework", 187 "//tensorflow/core:lib", 188 "//tensorflow/core:protos_all_cc", 189 "//tensorflow/core/grappler:devices", 190 "//tensorflow/core/grappler/clusters:cluster", 191 ], 192 ) 193 194 tf_cc_test( 195 name = "virtual_placer_test", 196 srcs = ["virtual_placer_test.cc"], 197 deps = [ 198 ":virtual_placer", 199 "//tensorflow/core:core_cpu", 200 "//tensorflow/core:lib", 201 "//tensorflow/core:protos_all_cc", 202 "//tensorflow/core:test", 203 "//tensorflow/core:test_main", 204 "//tensorflow/core/grappler/clusters:virtual_cluster", 205 ], 206 ) 207 208 cc_library( 209 name = "op_context", 210 hdrs = ["op_context.h"], 211 visibility = ["//visibility:public"], 212 deps = [ 213 "//tensorflow/core:protos_all_cc", 214 ] + tf_protos_grappler(), 215 ) 216 217 cc_library( 218 name = "virtual_scheduler", 219 srcs = ["virtual_scheduler.cc"], 220 hdrs = ["virtual_scheduler.h"], 221 visibility = ["//visibility:public"], 222 deps = [ 223 ":graph_properties", 224 ":op_context", 225 ":utils", 226 ":virtual_placer", 227 "//tensorflow/core:framework", 228 "//tensorflow/core:lib", 229 "//tensorflow/core:protos_all_cc", 230 "//tensorflow/core/grappler:grappler_item", 231 "//tensorflow/core/grappler:op_types", 232 "//tensorflow/core/grappler:utils", 233 "//tensorflow/core/grappler/clusters:utils", 234 "//tensorflow/core/grappler/costs:cost_estimator", 235 ], 236 ) 237 238 tf_cc_test( 239 name = "virtual_scheduler_test", 240 srcs = ["virtual_scheduler_test.cc"], 241 deps = [ 242 ":virtual_placer", 243 ":virtual_scheduler", 244 "//tensorflow/cc:cc_ops", 245 "//tensorflow/core:protos_all_cc", 246 "//tensorflow/core:tensorflow", 247 "//tensorflow/core:test", 248 "//tensorflow/core:test_main", 249 "//tensorflow/core/grappler/clusters:virtual_cluster", 250 ], 251 ) 252 253 cc_library( 254 name = "measuring_cost_estimator", 255 srcs = ["measuring_cost_estimator.cc"], 256 hdrs = ["measuring_cost_estimator.h"], 257 visibility = ["//visibility:public"], 258 deps = [ 259 ":robust_stats", 260 "//tensorflow/core:core_cpu", 261 "//tensorflow/core:framework", 262 "//tensorflow/core:lib", 263 "//tensorflow/core:lib_internal", 264 "//tensorflow/core:lib_proto_parsing", 265 "//tensorflow/core:protos_all_cc", 266 "//tensorflow/core/grappler:grappler_item", 267 "//tensorflow/core/grappler/clusters:cluster", 268 "//tensorflow/core/grappler/costs:cost_estimator", 269 "//tensorflow/core/kernels:ops_util", 270 ], 271 ) 272 273 cc_library( 274 name = "op_level_cost_estimator", 275 srcs = ["op_level_cost_estimator.cc"], 276 hdrs = ["op_level_cost_estimator.h"], 277 visibility = ["//visibility:public"], 278 deps = [ 279 ":cost_estimator", 280 ":op_context", 281 "//third_party/eigen3", 282 "//tensorflow/core:framework", 283 "//tensorflow/core:protos_all_cc", 284 "//tensorflow/core/grappler/clusters:utils", 285 ] + tf_protos_grappler(), 286 ) 287 288 tf_cc_test( 289 name = "op_level_cost_estimator_test", 290 srcs = ["op_level_cost_estimator_test.cc"], 291 deps = [ 292 ":op_level_cost_estimator", 293 "//tensorflow/core:framework", 294 "//tensorflow/core:protos_all_cc", 295 "//tensorflow/core:test", 296 "//tensorflow/core:test_main", 297 ], 298 ) 299 300 cc_library( 301 name = "analytical_cost_estimator", 302 srcs = ["analytical_cost_estimator.cc"], 303 hdrs = ["analytical_cost_estimator.h"], 304 visibility = ["//visibility:public"], 305 deps = [ 306 ":cost_estimator", 307 ":graph_properties", 308 ":op_level_cost_estimator", 309 ":utils", 310 ":virtual_placer", 311 ":virtual_scheduler", 312 "//tensorflow/core:core_cpu_base", 313 "//tensorflow/core:graph", 314 "//tensorflow/core:lib", 315 "//tensorflow/core:protos_all_cc", 316 "//tensorflow/core/grappler:grappler_item", 317 ] + tf_protos_grappler(), 318 ) 319 320 tf_cc_test( 321 name = "analytical_cost_estimator_test", 322 srcs = ["analytical_cost_estimator_test.cc"], 323 deps = [ 324 ":analytical_cost_estimator", 325 ":virtual_scheduler", 326 "//tensorflow/cc:cc_ops", 327 "//tensorflow/core:protos_all_cc", 328 "//tensorflow/core:tensorflow", 329 "//tensorflow/core:test", 330 "//tensorflow/core:test_main", 331 "//tensorflow/core/grappler/clusters:virtual_cluster", 332 ], 333 ) 334