Home | History | Annotate | Download | only in debug
      1 # Description:
      2 # TensorFlow Debugger (tfdbg).
      3 #
      4 # Public target(s):
      5 #
      6 # ":debug" - Depending on this target causes a concrete implementation of
      7 #    DebuggerState to be constructed at initialization time, enabling
      8 #    TensorFlow Debugger (tfdbg) support. For details, please see
      9 #    core/common_runtime/debugger_state_interface.h.
     10 # ":debug_callback_registry" - Depending on this target exposes a global
     11 #    callback registry that will be used to record any observed tensors matching
     12 #    a watch state.
     13 # ":debug_node_key" - Defines a struct used for tracking tensors.
     14 
     15 package(
     16     default_visibility = ["//tensorflow:internal"],
     17 )
     18 
     19 licenses(["notice"])  # Apache 2.0
     20 
     21 load(
     22     "//tensorflow:tensorflow.bzl",
     23     "check_deps",
     24     "tf_copts",
     25     "tf_cc_test",
     26     "tf_cuda_library",
     27 )
     28 
     29 # For platform specific build config
     30 load(
     31     "//tensorflow/core:platform/default/build_config.bzl",
     32     "tf_kernel_tests_linkstatic",
     33     "tf_proto_library",
     34     "tf_proto_library_cc",
     35     "tf_additional_all_protos",
     36 )
     37 load(
     38     "//tensorflow/core:platform/default/build_config_root.bzl",
     39     "tf_cuda_tests_tags",
     40 )
     41 
     42 # Check that tensorflow/core:tensorflow does not depend on grpc.
     43 check_deps(
     44     name = "core_tensorflow_check_deps",
     45     disallowed_deps = ["@grpc//:grpc++"],
     46     deps = ["//tensorflow/core:tensorflow"],
     47 )
     48 
     49 tf_proto_library(
     50     name = "debug_service_proto",
     51     srcs = [
     52         "debug_service.proto",
     53     ],
     54     has_services = 1,
     55     cc_api_version = 2,
     56     cc_grpc_version = 1,
     57     protodeps = [
     58         ":debugger_event_metadata_proto",
     59         "//tensorflow/core/profiler:protos_all",
     60     ] + tf_additional_all_protos(),
     61     visibility = ["//tensorflow:__subpackages__"],
     62 )
     63 
     64 tf_proto_library(
     65     name = "debugger_event_metadata_proto",
     66     srcs = ["debugger_event_metadata.proto"],
     67     cc_api_version = 2,
     68 )
     69 
     70 cc_library(
     71     name = "debug",
     72     srcs = ["debug.cc"],
     73     copts = tf_copts(),
     74     linkstatic = 1,
     75     visibility = ["//visibility:public"],
     76     deps = [
     77         ":debugger_state_impl",
     78         "//tensorflow/core:core_cpu_internal",
     79         "//tensorflow/core:debug_ops_op_lib",
     80     ],
     81     alwayslink = 1,
     82 )
     83 
     84 tf_cuda_library(
     85     name = "debugger_state_impl",
     86     srcs = ["debugger_state_impl.cc"],
     87     hdrs = ["debugger_state_impl.h"],
     88     copts = tf_copts(),
     89     linkstatic = 1,
     90     deps = [
     91         ":debug_graph_utils",
     92         ":debug_io_utils",
     93         "//tensorflow/core:core_cpu_internal",
     94     ],
     95     alwayslink = 1,
     96 )
     97 
     98 tf_cuda_library(
     99     name = "debug_graph_utils",
    100     srcs = ["debug_graph_utils.cc"],
    101     hdrs = ["debug_graph_utils.h"],
    102     copts = tf_copts(),
    103     linkstatic = 1,
    104     deps = [
    105         "//tensorflow/core:core_cpu_internal",
    106         "//tensorflow/core:framework",
    107         "//tensorflow/core:graph",
    108         "//tensorflow/core:lib",
    109         "//tensorflow/core:lib_internal",
    110         "//tensorflow/core:proto_text",
    111         "//tensorflow/core:protos_all_cc",
    112     ],
    113     alwayslink = 1,
    114 )
    115 
    116 tf_cuda_library(
    117     name = "debug_io_utils",
    118     srcs = ["debug_io_utils.cc"],
    119     hdrs = ["debug_io_utils.h"],
    120     copts = tf_copts(),
    121     linkstatic = 1,
    122     deps = [
    123         ":debug_callback_registry",
    124         ":debug_node_key",
    125         ":debug_service_proto_cc",
    126         ":debugger_event_metadata_proto_cc",
    127         "//tensorflow:grpc++",
    128         "//tensorflow/core:core_cpu_internal",
    129         "//tensorflow/core:framework",
    130         "//tensorflow/core:graph",
    131         "//tensorflow/core:lib",
    132         "//tensorflow/core:lib_internal",
    133         "//tensorflow/core:proto_text",
    134         "//tensorflow/core:protos_all_cc",
    135     ],
    136     alwayslink = 1,
    137 )
    138 
    139 tf_cuda_library(
    140     name = "debug_grpc_testlib",
    141     srcs = ["debug_grpc_testlib.cc"],
    142     hdrs = ["debug_grpc_testlib.h"],
    143     copts = tf_copts(),
    144     linkstatic = 1,
    145     deps = [
    146         ":debug_graph_utils",
    147         ":debug_io_utils",
    148         ":debug_service_proto_cc",
    149         ":debugger_event_metadata_proto_cc",
    150         "//tensorflow:grpc++",
    151         "//tensorflow/core:framework",
    152         "//tensorflow/core:lib",
    153         "//tensorflow/core:lib_internal",
    154         "//tensorflow/core:protos_all_cc",
    155     ],
    156     alwayslink = 1,
    157 )
    158 
    159 tf_cuda_library(
    160     name = "debug_node_key",
    161     srcs = ["debug_node_key.cc"],
    162     hdrs = ["debug_node_key.h"],
    163     copts = tf_copts(),
    164     linkstatic = 1,
    165     visibility = ["//visibility:public"],
    166     deps = [
    167         "//tensorflow/core:lib",
    168     ],
    169 )
    170 
    171 tf_cc_test(
    172     name = "debug_io_utils_test",
    173     size = "small",
    174     srcs = ["debug_io_utils_test.cc"],
    175     linkstatic = tf_kernel_tests_linkstatic(),
    176     deps = [
    177         ":debug_callback_registry",
    178         ":debug_grpc_testlib",
    179         ":debug_io_utils",
    180         ":debug_node_key",
    181         ":debug_service_proto_cc",
    182         ":debugger_event_metadata_proto_cc",
    183         "//tensorflow/core:core_cpu",
    184         "//tensorflow/core:core_cpu_internal",
    185         "//tensorflow/core:framework",
    186         "//tensorflow/core:framework_internal",
    187         "//tensorflow/core:lib",
    188         "//tensorflow/core:lib_internal",
    189         "//tensorflow/core:protos_all_cc",
    190         "//tensorflow/core:test",
    191         "//tensorflow/core:test_main",
    192         "//tensorflow/core:testlib",
    193         "//tensorflow/core/platform/default/build_config:platformlib",
    194     ],
    195 )
    196 
    197 tf_cc_test(
    198     name = "debug_graph_utils_test",
    199     size = "small",
    200     srcs = ["debug_graph_utils_test.cc"],
    201     linkstatic = tf_kernel_tests_linkstatic(),
    202     deps = [
    203         ":debug_graph_utils",
    204         "//tensorflow/core:lib",
    205         "//tensorflow/core:lib_internal",
    206         "//tensorflow/core:test",
    207         "//tensorflow/core:test_main",
    208         "//tensorflow/core:testlib",
    209     ],
    210 )
    211 
    212 tf_cc_test(
    213     name = "grpc_session_debug_test",
    214     size = "medium",
    215     srcs = ["grpc_session_debug_test.cc"],
    216     linkstatic = tf_kernel_tests_linkstatic(),
    217     tags = [
    218         "no_oss",  # b/62956105: port conflicts.
    219         "nomac",  # b/38276817
    220     ],
    221     deps = [
    222         ":debug_grpc_testlib",
    223         ":debug_io_utils",
    224         "//tensorflow/core:array_ops_op_lib",
    225         "//tensorflow/core:core_cpu",
    226         "//tensorflow/core:framework",
    227         "//tensorflow/core:functional_ops_op_lib",
    228         "//tensorflow/core:lib",
    229         "//tensorflow/core:master_proto_cc",
    230         "//tensorflow/core:math_ops_op_lib",
    231         "//tensorflow/core:nn_ops_op_lib",
    232         "//tensorflow/core:no_op_op_lib",
    233         "//tensorflow/core:protos_all_cc",
    234         "//tensorflow/core:sendrecv_ops_op_lib",
    235         "//tensorflow/core:test",
    236         "//tensorflow/core:test_main",
    237         "//tensorflow/core:testlib",
    238         "//tensorflow/core/distributed_runtime/rpc:grpc_server_lib",
    239         "//tensorflow/core/distributed_runtime/rpc:grpc_session",
    240         "//tensorflow/core/distributed_runtime/rpc:grpc_testlib",
    241         "//tensorflow/core/kernels:constant_op",
    242         "//tensorflow/core/kernels:matmul_op",
    243     ],
    244 )
    245 
    246 tf_cc_test(
    247     name = "debug_grpc_io_utils_test",
    248     size = "small",
    249     srcs = ["debug_grpc_io_utils_test.cc"],
    250     linkstatic = tf_kernel_tests_linkstatic(),
    251     tags = [
    252         "no_oss",  # b/73962011
    253     ],
    254     deps = [
    255         ":debug_graph_utils",
    256         ":debug_grpc_testlib",
    257         ":debug_io_utils",
    258         "//tensorflow/core:core_cpu_internal",
    259         "//tensorflow/core:framework_internal",
    260         "//tensorflow/core:lib",
    261         "//tensorflow/core:lib_internal",
    262         "//tensorflow/core:protos_all_cc",
    263         "//tensorflow/core:test",
    264         "//tensorflow/core:test_main",
    265     ],
    266 )
    267 
    268 cc_library(
    269     name = "debug_callback_registry",
    270     srcs = ["debug_callback_registry.cc"],
    271     hdrs = ["debug_callback_registry.h"],
    272     visibility = ["//visibility:public"],
    273     deps = [
    274         ":debug_node_key",
    275         "//tensorflow/core:framework",
    276         "//tensorflow/core:lib",
    277         "//tensorflow/core:protos_all_cc",
    278     ],
    279 )
    280 
    281 # TODO(cais): Add the following back in when tfdbg is supported on Android.
    282 # filegroup(
    283 #     name = "android_srcs",
    284 #     srcs = [
    285 #         "debug_graph_utils.cc",
    286 #         "debug_graph_utils.h",
    287 #         "debug_io_utils.cc",
    288 #         "debug_io_utils.h",
    289 #     ],
    290 #     visibility = ["//visibility:public"],
    291 # )
    292