Add tf_profiler_pywrap_cc_library_wrapper macro
PiperOrigin-RevId: 336361876 Change-Id: I63941a552f9833d0004896be3b1eef9acef7ac45
This commit is contained in:
parent
f8886a872b
commit
9839be926d
@ -3,9 +3,11 @@
|
|||||||
load(
|
load(
|
||||||
"//tensorflow/core/profiler/builds/oss:build_config.bzl",
|
"//tensorflow/core/profiler/builds/oss:build_config.bzl",
|
||||||
_tf_profiler_alias = "tf_profiler_alias",
|
_tf_profiler_alias = "tf_profiler_alias",
|
||||||
|
_tf_profiler_pybind_cc_library_wrapper = "tf_profiler_pybind_cc_library_wrapper",
|
||||||
)
|
)
|
||||||
|
|
||||||
tf_profiler_alias = _tf_profiler_alias
|
tf_profiler_alias = _tf_profiler_alias
|
||||||
|
tf_profiler_pybind_cc_library_wrapper = _tf_profiler_pybind_cc_library_wrapper
|
||||||
|
|
||||||
def if_profiler_oss(if_true, if_false = []):
|
def if_profiler_oss(if_true, if_false = []):
|
||||||
return select({
|
return select({
|
||||||
|
@ -3,5 +3,17 @@
|
|||||||
TF profiler build macros for use in OSS.
|
TF profiler build macros for use in OSS.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
load("//tensorflow:tensorflow.bzl", "cc_header_only_library")
|
||||||
|
|
||||||
def tf_profiler_alias(target_dir, name):
|
def tf_profiler_alias(target_dir, name):
|
||||||
return target_dir + "oss:" + name
|
return target_dir + "oss:" + name
|
||||||
|
|
||||||
|
def tf_profiler_pybind_cc_library_wrapper(name, actual, **kwargs):
|
||||||
|
"""Wrapper for cc_library used by tf_python_pybind_extension.
|
||||||
|
|
||||||
|
This wrapper ensures that cc libraries headers are made available to pybind
|
||||||
|
code, without creating ODR violations in the dynamically linked case. The
|
||||||
|
symbols in these deps symbols should be linked to, and exported by, the core
|
||||||
|
pywrap_tensorflow_internal.so
|
||||||
|
"""
|
||||||
|
cc_header_only_library(name = name, deps = [actual], **kwargs)
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
||||||
load("//tensorflow/core/platform:build_config_root.bzl", "if_static")
|
load("//tensorflow/core/platform:build_config_root.bzl", "if_static")
|
||||||
load("//tensorflow:tensorflow.bzl", "if_not_android", "tf_cc_test", "tf_cuda_library")
|
load("//tensorflow:tensorflow.bzl", "if_not_android", "tf_cc_test", "tf_cuda_library")
|
||||||
load("//tensorflow:tensorflow.bzl", "filegroup") # buildifier: disable=same-origin-load
|
load("//tensorflow:tensorflow.bzl", "filegroup")
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_pybind_cc_library_wrapper") # buildifier: disable=same-origin-load
|
load(
|
||||||
load("//tensorflow/core/profiler/builds:build_config.bzl", "tf_profiler_copts")
|
"//tensorflow/core/profiler/builds:build_config.bzl",
|
||||||
|
"tf_profiler_copts",
|
||||||
|
"tf_profiler_pybind_cc_library_wrapper",
|
||||||
|
)
|
||||||
|
|
||||||
package(
|
package(
|
||||||
default_visibility = [
|
default_visibility = [
|
||||||
@ -13,13 +16,10 @@ package(
|
|||||||
licenses = ["notice"], # Apache 2.0
|
licenses = ["notice"], # Apache 2.0
|
||||||
)
|
)
|
||||||
|
|
||||||
tf_pybind_cc_library_wrapper(
|
tf_profiler_pybind_cc_library_wrapper(
|
||||||
name = "profiler_session_headers",
|
name = "profiler_session_for_pybind",
|
||||||
visibility = [
|
actual = ":profiler_session",
|
||||||
"//tensorflow/core/profiler/rpc:__pkg__",
|
visibility = ["//tensorflow/python/profiler/internal:__pkg__"],
|
||||||
"//tensorflow/python/profiler/internal:__pkg__",
|
|
||||||
],
|
|
||||||
deps = [":profiler_session"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
@ -68,13 +68,13 @@ cc_library(
|
|||||||
alwayslink = True,
|
alwayslink = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
tf_pybind_cc_library_wrapper(
|
tf_profiler_pybind_cc_library_wrapper(
|
||||||
name = "local_profiler_headers",
|
name = "local_profiler_for_pybind",
|
||||||
|
actual = ":local_profiler",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//tensorflow/core/profiler/rpc:__pkg__",
|
"//tensorflow/core/profiler/rpc:__pkg__",
|
||||||
"//tensorflow/python/profiler/internal:__pkg__",
|
"//tensorflow/python/profiler/internal:__pkg__",
|
||||||
],
|
],
|
||||||
deps = [":local_profiler"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
@ -179,10 +179,10 @@ tf_cuda_library(
|
|||||||
alwayslink = True,
|
alwayslink = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
tf_pybind_cc_library_wrapper(
|
tf_profiler_pybind_cc_library_wrapper(
|
||||||
name = "traceme_headers",
|
name = "traceme_for_pybind",
|
||||||
|
actual = ":traceme",
|
||||||
visibility = ["//tensorflow/python/profiler/internal:__pkg__"],
|
visibility = ["//tensorflow/python/profiler/internal:__pkg__"],
|
||||||
deps = [":traceme"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_external_workspace_visible") # buildifier: disable=same-origin-load
|
load("//tensorflow:tensorflow.bzl", "tf_external_workspace_visible") # buildifier: disable=same-origin-load
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_grpc_cc_dependency") # buildifier: disable=same-origin-load
|
load("//tensorflow:tensorflow.bzl", "tf_grpc_cc_dependency") # buildifier: disable=same-origin-load
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_pybind_cc_library_wrapper") # buildifier: disable=same-origin-load
|
load(
|
||||||
load("//tensorflow/core/profiler/builds:build_config.bzl", "tf_profiler_alias", "tf_profiler_copts")
|
"//tensorflow/core/profiler/builds:build_config.bzl",
|
||||||
|
"tf_profiler_alias",
|
||||||
|
"tf_profiler_copts",
|
||||||
|
"tf_profiler_pybind_cc_library_wrapper",
|
||||||
|
)
|
||||||
|
|
||||||
package(
|
package(
|
||||||
default_visibility = ["//tensorflow/core/profiler:internal"],
|
default_visibility = ["//tensorflow/core/profiler:internal"],
|
||||||
@ -25,12 +29,12 @@ exports_files(
|
|||||||
visibility = ["//tensorflow/core/profiler/rpc:__subpackages__"],
|
visibility = ["//tensorflow/core/profiler/rpc:__subpackages__"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Linked to pywrap_tensorflow.
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "profiler_service_impl",
|
name = "profiler_service_impl",
|
||||||
srcs = ["profiler_service_impl.cc"],
|
srcs = ["profiler_service_impl.cc"],
|
||||||
hdrs = ["profiler_service_impl.h"],
|
hdrs = ["profiler_service_impl.h"],
|
||||||
copts = tf_profiler_copts(),
|
copts = tf_profiler_copts(),
|
||||||
features = ["-layering_check"],
|
|
||||||
visibility = tf_external_workspace_visible(
|
visibility = tf_external_workspace_visible(
|
||||||
[
|
[
|
||||||
"//tensorflow/core/data/service:__pkg__",
|
"//tensorflow/core/data/service:__pkg__",
|
||||||
@ -41,13 +45,20 @@ cc_library(
|
|||||||
deps = [
|
deps = [
|
||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
"//tensorflow/core/profiler:profiler_service_proto_cc",
|
"//tensorflow/core/profiler:profiler_service_proto_cc",
|
||||||
"//tensorflow/core/profiler/lib:profiler_session_headers",
|
"//tensorflow/core/profiler/lib:profiler_session",
|
||||||
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
|
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
|
||||||
|
"@com_google_absl//absl/container:flat_hash_map",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
tf_grpc_cc_dependency(),
|
tf_grpc_cc_dependency(),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
tf_profiler_pybind_cc_library_wrapper(
|
||||||
|
name = "profiler_server_for_pybind",
|
||||||
|
actual = ":profiler_server_impl",
|
||||||
|
visibility = ["//tensorflow/python/profiler/internal:__pkg__"],
|
||||||
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "profiler_server_impl",
|
name = "profiler_server_impl",
|
||||||
srcs = ["profiler_server.cc"],
|
srcs = ["profiler_server.cc"],
|
||||||
@ -68,11 +79,3 @@ cc_library(
|
|||||||
],
|
],
|
||||||
alwayslink = True,
|
alwayslink = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
tf_pybind_cc_library_wrapper(
|
|
||||||
name = "profiler_server_headers",
|
|
||||||
visibility = [
|
|
||||||
"//tensorflow/python/profiler/internal:__pkg__",
|
|
||||||
],
|
|
||||||
deps = [":profiler_server_impl"],
|
|
||||||
)
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_grpc_cc_dependency")
|
load("//tensorflow:tensorflow.bzl", "tf_grpc_cc_dependency")
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_pybind_cc_library_wrapper") # buildifier: disable=same-origin-load
|
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
|
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
|
||||||
load("//tensorflow/core/profiler/builds:build_config.bzl", "tf_profiler_copts")
|
load(
|
||||||
|
"//tensorflow/core/profiler/builds:build_config.bzl",
|
||||||
|
"tf_profiler_copts",
|
||||||
|
"tf_profiler_pybind_cc_library_wrapper",
|
||||||
|
)
|
||||||
|
|
||||||
# For platform specific build config
|
# For platform specific build config
|
||||||
load(
|
load(
|
||||||
@ -19,14 +22,14 @@ cc_library(
|
|||||||
srcs = ["capture_profile.cc"],
|
srcs = ["capture_profile.cc"],
|
||||||
hdrs = ["capture_profile.h"],
|
hdrs = ["capture_profile.h"],
|
||||||
copts = tf_profiler_copts(),
|
copts = tf_profiler_copts(),
|
||||||
features = ["-layering_check"],
|
|
||||||
visibility = [
|
visibility = [
|
||||||
"//tensorflow/python/profiler/internal:__pkg__",
|
"//tensorflow/python/profiler/internal:__pkg__",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":profiler_client_headers",
|
":profiler_client_for_pybind",
|
||||||
":save_profile",
|
":save_profile",
|
||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
|
"//tensorflow/core:lib_internal",
|
||||||
"//tensorflow/core/profiler:profiler_analysis_proto_cc",
|
"//tensorflow/core/profiler:profiler_analysis_proto_cc",
|
||||||
"//tensorflow/core/profiler:profiler_options_proto_cc",
|
"//tensorflow/core/profiler:profiler_options_proto_cc",
|
||||||
"//tensorflow/core/profiler:profiler_service_proto_cc",
|
"//tensorflow/core/profiler:profiler_service_proto_cc",
|
||||||
@ -53,10 +56,9 @@ cc_library(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
tf_pybind_cc_library_wrapper(
|
tf_profiler_pybind_cc_library_wrapper(
|
||||||
name = "profiler_client_headers",
|
name = "profiler_client_for_pybind",
|
||||||
visibility = ["//tensorflow/python/profiler/internal:__pkg__"],
|
actual = ":profiler_client",
|
||||||
deps = [":profiler_client"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
@ -113,9 +115,9 @@ cc_library(
|
|||||||
tf_cc_test(
|
tf_cc_test(
|
||||||
name = "profiler_client_test",
|
name = "profiler_client_test",
|
||||||
srcs = ["profiler_client_test.cc"],
|
srcs = ["profiler_client_test.cc"],
|
||||||
features = ["-layering_check"],
|
|
||||||
tags = ["external"], # So that test suite reruns unconditionally.
|
tags = ["external"], # So that test suite reruns unconditionally.
|
||||||
deps = [
|
deps = [
|
||||||
|
":profiler_client",
|
||||||
":profiler_client_impl", # for oss
|
":profiler_client_impl", # for oss
|
||||||
":profiler_client_test_util",
|
":profiler_client_test_util",
|
||||||
"@com_google_absl//absl/time",
|
"@com_google_absl//absl/time",
|
||||||
@ -131,10 +133,9 @@ cc_library(
|
|||||||
srcs = ["remote_profiler_session_manager.cc"],
|
srcs = ["remote_profiler_session_manager.cc"],
|
||||||
hdrs = ["remote_profiler_session_manager.h"],
|
hdrs = ["remote_profiler_session_manager.h"],
|
||||||
copts = tf_profiler_copts(),
|
copts = tf_profiler_copts(),
|
||||||
features = ["-layering_check"],
|
|
||||||
visibility = ["//tensorflow/core/profiler:internal"],
|
visibility = ["//tensorflow/core/profiler:internal"],
|
||||||
deps = [
|
deps = [
|
||||||
":profiler_client_headers",
|
":profiler_client_for_pybind",
|
||||||
":save_profile",
|
":save_profile",
|
||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
"//tensorflow/core:protos_all_cc",
|
"//tensorflow/core:protos_all_cc",
|
||||||
@ -150,7 +151,6 @@ cc_library(
|
|||||||
tf_cc_test(
|
tf_cc_test(
|
||||||
name = "remote_profiler_session_manager_test",
|
name = "remote_profiler_session_manager_test",
|
||||||
srcs = ["remote_profiler_session_manager_test.cc"],
|
srcs = ["remote_profiler_session_manager_test.cc"],
|
||||||
features = ["-layering_check"],
|
|
||||||
tags = ["external"], # So that test suite reruns unconditionally.
|
tags = ["external"], # So that test suite reruns unconditionally.
|
||||||
deps = [
|
deps = [
|
||||||
":profiler_client_impl", # for oss
|
":profiler_client_impl", # for oss
|
||||||
|
@ -27,7 +27,6 @@ limitations under the License.
|
|||||||
#include "tensorflow/core/platform/macros.h"
|
#include "tensorflow/core/platform/macros.h"
|
||||||
#include "tensorflow/core/platform/mutex.h"
|
#include "tensorflow/core/platform/mutex.h"
|
||||||
#include "tensorflow/core/platform/status.h"
|
#include "tensorflow/core/platform/status.h"
|
||||||
#include "tensorflow/core/profiler/lib/profiler_interface.h"
|
|
||||||
#include "tensorflow/core/profiler/lib/profiler_session.h"
|
#include "tensorflow/core/profiler/lib/profiler_session.h"
|
||||||
#include "tensorflow/core/profiler/profiler_service.grpc.pb.h"
|
#include "tensorflow/core/profiler/profiler_service.grpc.pb.h"
|
||||||
#include "tensorflow/core/profiler/profiler_service.pb.h"
|
#include "tensorflow/core/profiler/profiler_service.pb.h"
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
# buildifier: disable=same-origin-load
|
load("//tensorflow:tensorflow.bzl", "cuda_py_test") # buildifier: disable=same-origin-load
|
||||||
load("//tensorflow:tensorflow.bzl", "cuda_py_test")
|
load("//tensorflow:tensorflow.bzl", "get_compatible_with_cloud") # buildifier: disable=same-origin-load
|
||||||
|
load("//tensorflow:tensorflow.bzl", "tf_python_pybind_extension") # buildifier: disable=same-origin-load
|
||||||
# buildifier: disable=same-origin-load
|
|
||||||
load("//tensorflow:tensorflow.bzl", "get_compatible_with_cloud")
|
|
||||||
|
|
||||||
# buildifier: disable=same-origin-load
|
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_python_pybind_extension")
|
|
||||||
load("//tensorflow:tensorflow.bzl", "py_test")
|
load("//tensorflow:tensorflow.bzl", "py_test")
|
||||||
load("//tensorflow/core/profiler/builds:build_config.bzl", "tf_profiler_copts")
|
load("//tensorflow/core/profiler/builds:build_config.bzl", "tf_profiler_copts")
|
||||||
|
|
||||||
@ -102,13 +97,12 @@ cc_library(
|
|||||||
name = "traceme_wrapper",
|
name = "traceme_wrapper",
|
||||||
hdrs = ["traceme_wrapper.h"],
|
hdrs = ["traceme_wrapper.h"],
|
||||||
copts = tf_profiler_copts(),
|
copts = tf_profiler_copts(),
|
||||||
features = ["-layering_check"],
|
|
||||||
visibility = [
|
visibility = [
|
||||||
"//tensorflow/compiler/xla/python:__pkg__",
|
"//tensorflow/compiler/xla/python:__pkg__",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
"//tensorflow/core/profiler/lib:traceme_headers",
|
"//tensorflow/core/profiler/lib:traceme_for_pybind",
|
||||||
"@com_google_absl//absl/strings",
|
"@com_google_absl//absl/strings",
|
||||||
"@com_google_absl//absl/types:optional",
|
"@com_google_absl//absl/types:optional",
|
||||||
"@pybind11",
|
"@pybind11",
|
||||||
@ -119,7 +113,6 @@ tf_python_pybind_extension(
|
|||||||
name = "_pywrap_profiler",
|
name = "_pywrap_profiler",
|
||||||
srcs = ["profiler_wrapper.cc"],
|
srcs = ["profiler_wrapper.cc"],
|
||||||
copts = tf_profiler_copts(),
|
copts = tf_profiler_copts(),
|
||||||
features = ["-layering_check"],
|
|
||||||
module_name = "_pywrap_profiler",
|
module_name = "_pywrap_profiler",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//tensorflow/python/eager:__pkg__",
|
"//tensorflow/python/eager:__pkg__",
|
||||||
@ -129,9 +122,9 @@ tf_python_pybind_extension(
|
|||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
"//tensorflow/core/profiler/convert:xplane_to_tools_data",
|
"//tensorflow/core/profiler/convert:xplane_to_tools_data",
|
||||||
"//tensorflow/core/profiler/convert:xplane_to_trace_events",
|
"//tensorflow/core/profiler/convert:xplane_to_trace_events",
|
||||||
"//tensorflow/core/profiler/lib:profiler_session_headers",
|
"//tensorflow/core/profiler/lib:profiler_session_for_pybind",
|
||||||
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
|
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
|
||||||
"//tensorflow/core/profiler/rpc:profiler_server_headers",
|
"//tensorflow/core/profiler/rpc:profiler_server_for_pybind",
|
||||||
"//tensorflow/core/profiler/rpc/client:capture_profile",
|
"//tensorflow/core/profiler/rpc/client:capture_profile",
|
||||||
"//tensorflow/core/profiler/rpc/client:save_profile",
|
"//tensorflow/core/profiler/rpc/client:save_profile",
|
||||||
"//tensorflow/python:pybind11_status",
|
"//tensorflow/python:pybind11_status",
|
||||||
|
Loading…
Reference in New Issue
Block a user