Skip to content

Commit

Permalink
Move op_profile from contrib/tpu/profiler/ to core/profiler. The next…
Browse files Browse the repository at this point in the history
… step is to move tpu_profiler.proto out as well.

PiperOrigin-RevId: 233701416
  • Loading branch information
tensorflower-gardener committed Feb 13, 2019
1 parent fdf1261 commit 6f74255
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
12 changes: 3 additions & 9 deletions tensorflow/contrib/tpu/profiler/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ load("//tensorflow:tensorflow.bzl", "tf_cc_binary")
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
load("//tensorflow/core:platform/default/build_config.bzl", "tf_proto_library")
load("//tensorflow/core:platform/default/build_config.bzl", "tf_additional_all_protos")
load("//tensorflow/core:platform/default/build_config.bzl", "tf_profiler_all_protos")

tf_proto_library(
name = "tpu_profiler_proto",
srcs = ["tpu_profiler.proto"],
has_services = 1,
cc_api_version = 2,
cc_grpc_version = 1,
protodeps = [":op_profile_proto"] + tf_additional_all_protos(),
protodeps = tf_profiler_all_protos() + tf_additional_all_protos(),
visibility = ["//visibility:public"],
)

Expand All @@ -21,13 +22,13 @@ cc_library(
hdrs = ["dump_tpu_profile.h"],
visibility = ["//visibility:public"],
deps = [
":op_profile_proto_cc",
":tpu_profiler_proto_cc",
":trace_events_proto_cc",
":trace_events_to_json",
"//tensorflow/core:framework",
"//tensorflow/core:lib",
"//tensorflow/core:protos_all_cc",
"//tensorflow/core/profiler:protos_all_cc",
],
)

Expand Down Expand Up @@ -81,13 +82,6 @@ tf_cc_test(
],
)

tf_proto_library(
name = "op_profile_proto",
srcs = ["op_profile.proto"],
cc_api_version = 2,
visibility = ["//visibility:public"],
)

tf_proto_library(
name = "tpu_profiler_analysis_proto",
srcs = ["tpu_profiler_analysis.proto"],
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/contrib/tpu/profiler/dump_tpu_profile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ limitations under the License.
#include <ctime>
#include <vector>

#include "tensorflow/contrib/tpu/profiler/op_profile.pb.h"
#include "tensorflow/contrib/tpu/profiler/trace_events.pb.h"
#include "tensorflow/contrib/tpu/profiler/trace_events_to_json.h"
#include "tensorflow/core/lib/core/errors.h"
Expand All @@ -29,6 +28,7 @@ limitations under the License.
#include "tensorflow/core/lib/strings/strcat.h"
#include "tensorflow/core/platform/env.h"
#include "tensorflow/core/platform/protobuf.h"
#include "tensorflow/core/profiler/op_profile.pb.h"
#include "tensorflow/core/util/events_writer.h"

namespace tensorflow {
Expand Down Expand Up @@ -88,7 +88,7 @@ Status DumpTraceToLogDirectory(StringPiece run_dir, const string& host_prefix,

Status DumpOpProfileToLogDirectory(StringPiece run_dir,
const string& host_prefix,
const tpu::op_profile::Profile& profile,
const profiler::op_profile::Profile& profile,
std::ostream* os) {
string path = JoinPath(run_dir, StrCat(host_prefix, kJsonOpProfileFileName));
string json;
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/contrib/tpu/profiler/tpu_profiler.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tensorflow;

import "tensorflow/core/framework/graph.proto";
import "tensorflow/core/protobuf/config.proto";
import "tensorflow/contrib/tpu/profiler/op_profile.proto";
import "tensorflow/core/profiler/op_profile.proto";

// The TPUProfiler service retrieves performance information about
// the programs running on connected TPUs over a period of time.
Expand Down Expand Up @@ -96,7 +96,7 @@ message ProfileResponse {
// Assembles a hierarchical performance profile based on HLOs in trace events.
// If the trace covers multiple programs, the longest-running one is analyzed.
// See op_profile.proto for the detailed semantics of the returned profile.
tpu.op_profile.Profile op_profile = 4;
profiler.op_profile.Profile op_profile = 4;

// Data payload for each required tools.
repeated ProfileToolData tool_data = 6;
Expand Down
4 changes: 4 additions & 0 deletions tensorflow/core/platform/default/build_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,10 @@ def tf_additional_human_readable_json_deps():
def tf_additional_all_protos():
return ["//tensorflow/core:protos_all"]

# TODO(fishx): Remove it after moving profiler proto out from contrib.
def tf_profiler_all_protos():
return ["//tensorflow/core/profiler:protos_all"]

def tf_protos_all_impl():
return ["//tensorflow/core:protos_all_cc_impl"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package tensorflow.tpu.op_profile;
package tensorflow.profiler.op_profile;

// Profile is the top-level data that summarizes a program.
message Profile {
Expand Down

0 comments on commit 6f74255

Please sign in to comment.