1load("//tensorflow:tensorflow.bzl", "cuda_py_test") # buildifier: disable=same-origin-load 2load("//tensorflow:tensorflow.bzl", "get_compatible_with_cloud") # buildifier: disable=same-origin-load 3load("//tensorflow:tensorflow.bzl", "tf_python_pybind_extension") # buildifier: disable=same-origin-load 4load("//tensorflow:tensorflow.bzl", "py_test") 5load("//tensorflow/core/profiler/builds:build_config.bzl", "tf_profiler_copts") 6 7package( 8 default_visibility = ["//tensorflow/python/profiler:__subpackages__"], 9 licenses = ["notice"], 10) 11 12py_library( 13 name = "flops_registry", 14 srcs = ["flops_registry.py"], 15 srcs_version = "PY3", 16 deps = [ 17 "//tensorflow/python:framework_ops", 18 "//tensorflow/python:graph_util", 19 ], 20) 21 22py_library( 23 name = "model_analyzer_testlib", 24 srcs = ["model_analyzer_testlib.py"], 25 srcs_version = "PY3", 26 visibility = ["//visibility:public"], 27 deps = [ 28 "//tensorflow/python:array_ops", 29 "//tensorflow/python:framework_for_generated_wrappers", 30 "//tensorflow/python:init_ops", 31 "//tensorflow/python:math_ops", 32 "//tensorflow/python:nn_grad", 33 "//tensorflow/python:nn_ops", 34 "//tensorflow/python:rnn", 35 "//tensorflow/python:rnn_cell", 36 "//tensorflow/python:tensor_array_grad", 37 "//tensorflow/python:training", 38 "//tensorflow/python:variable_scope", 39 ], 40) 41 42py_test( 43 name = "print_model_analysis_test", 44 srcs = ["print_model_analysis_test.py"], 45 python_version = "PY3", 46 srcs_version = "PY3", 47 deps = [ 48 "//tensorflow/core/profiler:protos_all_py", 49 "//tensorflow/python:array_ops", 50 "//tensorflow/python:client", 51 "//tensorflow/python:client_testlib", 52 "//tensorflow/python:framework_for_generated_wrappers", 53 "//tensorflow/python:init_ops", 54 "//tensorflow/python:nn_ops", 55 "//tensorflow/python:pywrap_tensorflow", 56 "//tensorflow/python:variable_scope", 57 ], 58) 59 60cuda_py_test( 61 name = "run_metadata_test", 62 srcs = ["run_metadata_test.py"], 63 python_version = "PY3", 64 tags = [ 65 "no_gpu", # b/138442728 66 "no_pip", 67 ], 68 xla_enable_strict_auto_jit = False, # Node names are different with autojit 69 deps = [ 70 ":model_analyzer_testlib", 71 "//tensorflow/core/profiler:protos_all_py", 72 "//tensorflow/python:array_ops", 73 "//tensorflow/python:client_testlib", 74 "//tensorflow/python:math_ops", 75 "//tensorflow/python:random_ops", 76 "//tensorflow/python/profiler:model_analyzer", 77 ], 78) 79 80tf_python_pybind_extension( 81 name = "_pywrap_traceme", 82 srcs = ["traceme_wrapper.cc"], 83 copts = tf_profiler_copts(), 84 visibility = [ 85 "//perftools/accelerators/xprof/xprofilez/integration_tests:__pkg__", 86 "//tensorflow/python/profiler:__subpackages__", 87 ], 88 deps = [ 89 ":traceme_wrapper", 90 "@pybind11", 91 ], 92) 93 94cc_library( 95 name = "traceme_wrapper", 96 hdrs = ["traceme_wrapper.h"], 97 copts = tf_profiler_copts(), 98 visibility = [ 99 "//tensorflow/compiler/xla/python:__pkg__", 100 ], 101 deps = [ 102 "//tensorflow/core:lib", 103 "//tensorflow/core/profiler/lib:traceme_for_pybind", 104 "@com_google_absl//absl/strings", 105 "@com_google_absl//absl/types:optional", 106 "@pybind11", 107 ], 108) 109 110tf_python_pybind_extension( 111 name = "_pywrap_profiler", 112 srcs = ["profiler_wrapper.cc"], 113 copts = tf_profiler_copts(), 114 visibility = [ 115 "//tensorflow/core/profiler:internal", 116 "//tensorflow/python/eager:__pkg__", 117 "//tensorflow/python/profiler:__pkg__", 118 ], 119 deps = [ 120 ":profiler_pywrap_impl", 121 "//tensorflow/core/platform:env", 122 "//tensorflow/core/profiler/convert:tool_options", 123 "//tensorflow/core/profiler/convert:xplane_to_tools_data", 124 "//tensorflow/core/profiler/rpc:profiler_server_for_pybind", 125 "//tensorflow/python:pybind11_status", 126 "@com_google_absl//absl/types:variant", 127 "@pybind11", 128 ], 129) 130 131cc_library( 132 name = "python_hooks", 133 srcs = ["python_hooks.cc"], 134 hdrs = ["python_hooks.h"], 135 compatible_with = get_compatible_with_cloud(), 136 copts = tf_profiler_copts() + ["-fexceptions"], 137 features = ["-use_header_modules"], # Incompatible with -fexceptions. 138 visibility = ["//visibility:public"], 139 deps = [ 140 "//tensorflow/core:lib", 141 "//tensorflow/core/profiler/protobuf:xplane_proto_cc", 142 "//tensorflow/core/profiler/utils:time_utils", 143 "//tensorflow/core/profiler/utils:xplane_builder", 144 "//tensorflow/core/profiler/utils:xplane_schema", 145 "//tensorflow/core/profiler/utils:xplane_utils", 146 "@com_google_absl//absl/container:flat_hash_map", 147 "@com_google_absl//absl/memory", 148 "@com_google_absl//absl/strings", 149 "@pybind11", 150 ], 151 alwayslink = True, 152) 153 154cc_library( 155 name = "profiler_pywrap_impl", 156 srcs = ["profiler_pywrap_impl.cc"], 157 hdrs = ["profiler_pywrap_impl.h"], 158 visibility = [ 159 "//tensorflow/compiler/xla:__subpackages__", 160 ], 161 deps = [ 162 "//tensorflow/core:lib", 163 "//tensorflow/core:lib_internal", 164 "//tensorflow/core/profiler/convert:xplane_to_tools_data", 165 "//tensorflow/core/profiler/convert:xplane_to_trace_events", 166 "//tensorflow/core/profiler/lib:profiler_session_for_pybind", 167 "//tensorflow/core/profiler/protobuf:xplane_proto_cc", 168 "//tensorflow/core/profiler/rpc:profiler_server_for_pybind", 169 "//tensorflow/core/profiler/rpc/client:capture_profile", 170 "//tensorflow/core/profiler/rpc/client:save_profile", 171 "@com_google_absl//absl/container:flat_hash_map", 172 "@com_google_absl//absl/memory", 173 "@com_google_absl//absl/strings", 174 "@com_google_absl//absl/time", 175 "@com_google_absl//absl/types:variant", 176 ], 177) 178