Add long_name field to OpMetrics

PiperOrigin-RevId: 329108530
Change-Id: Ifa7df2939dac238fe96f475df16eceb137d7d8b5
This commit is contained in:
Jose Baiocchi 2020-08-29 10:57:24 -07:00 committed by TensorFlower Gardener
parent eed8f6c094
commit 976f9b4605
3 changed files with 8 additions and 2 deletions

View File

@ -36,6 +36,9 @@ void CopyOpMetricsMetadata(const OpMetrics& src, OpMetrics* dst) {
DCHECK(dst != nullptr); DCHECK(dst != nullptr);
DCHECK_EQ(src.hlo_module_id(), dst->hlo_module_id()); DCHECK_EQ(src.hlo_module_id(), dst->hlo_module_id());
DCHECK_EQ(src.name(), dst->name()); DCHECK_EQ(src.name(), dst->name());
if (dst->long_name().empty()) {
dst->set_long_name(src.long_name());
}
if (dst->category().empty()) { if (dst->category().empty()) {
dst->set_category(src.category()); dst->set_category(src.category());
} }

View File

@ -234,7 +234,8 @@ OverviewPageAnalysis ComputeAnalysisResult(const OpStats& op_stats) {
uint64 outside_compilation_device_op_time_ps = 0; uint64 outside_compilation_device_op_time_ps = 0;
for (const OpMetrics& metrics : for (const OpMetrics& metrics :
op_stats.device_op_metrics_db().metrics_db()) { op_stats.device_op_metrics_db().metrics_db()) {
if (!IsOutsideCompilationOp(metrics.provenance(), metrics.name())) continue; if (!IsOutsideCompilationOp(metrics.provenance(), metrics.long_name()))
continue;
outside_compilation_device_op_time_ps += metrics.self_time_ps(); outside_compilation_device_op_time_ps += metrics.self_time_ps();
} }
uint64 num_total_tf_ops = num_host_tf_ops + num_device_tf_ops; uint64 num_total_tf_ops = num_host_tf_ops + num_device_tf_ops;

View File

@ -26,12 +26,14 @@ message LayoutAnalysis {
} }
// Metrics for an operation (accumulated over all occurrences). // Metrics for an operation (accumulated over all occurrences).
// Next ID: 20 // Next ID: 21
message OpMetrics { message OpMetrics {
// HLO module id. 0 for TF ops. // HLO module id. 0 for TF ops.
uint64 hlo_module_id = 13; uint64 hlo_module_id = 13;
// Name of this op. // Name of this op.
string name = 6; string name = 6;
// Long name of this op (e.g., HLO expression).
string long_name = 20;
// Category of this op. // Category of this op.
string category = 11; string category = 11;
// Provenance of this op (e.g., if HLO op, original TF op). // Provenance of this op (e.g., if HLO op, original TF op).