Add overview errors to gviz. Move the RunEnvironmentErrorMessage processing to OpStatsToOverviewPage. This way, overview_page to gviz is a simple datable insert.

PiperOrigin-RevId: 313321999
Change-Id: I81444d999ab8133c5986d834da4f6ced0a5e1d01
This commit is contained in:
A. Unique TensorFlower 2020-05-26 21:03:33 -07:00 committed by TensorFlower Gardener
parent ddb921bf77
commit 692e52c10f
4 changed files with 24 additions and 1 deletions

View File

@ -297,7 +297,7 @@ OverviewPage ConvertOpStatsToOverviewPage(const OpStats& op_stats,
bottleneck.input_classification(), bottleneck.input_statement(), "",
hardware_type, TfFunctionRecommendationHtml(op_stats.tf_function_db()),
overview_page.mutable_recommendation());
*overview_page.mutable_errors() = op_stats.errors();
SetOverviewPageErrorMessage(op_stats, &overview_page);
return overview_page;
}
@ -314,5 +314,18 @@ void SetRemarks(const OpStats& op_stats, OverviewPageAnalysis* analysis) {
}
}
void SetOverviewPageErrorMessage(const OpStats& op_stats,
OverviewPage* overview_page) {
*overview_page->mutable_errors() = op_stats.errors();
absl::c_sort(*overview_page->mutable_errors());
if (overview_page->errors().empty()) {
// Shows run-environment error only if there is no other existing error.
if (op_stats.run_environment().device_type() != "CPU" &&
op_stats.run_environment().device_core_count() <= 0) {
*overview_page->add_errors() = std::string(kNoDeviceTraceCollected);
}
}
}
} // namespace profiler
} // namespace tensorflow

View File

@ -48,6 +48,9 @@ OverviewPageAnalysis ComputeAnalysisResult(const OpStats& op_stats);
OverviewPageRunEnvironment ComputeRunEnvironment(
const RunEnvironment& run_environment);
void SetOverviewPageErrorMessage(const OpStats& op_stats,
OverviewPage* overview_page);
OverviewPage ConvertOpStatsToOverviewPage(const OpStats& op_stats,
HardwareType hardware_type);

View File

@ -33,5 +33,10 @@ const absl::string_view kErrorNoStepMarker =
" than the step time. For (1), you need to add step instrumentation;"
" for (2), you may try to profile longer.";
const absl::string_view kNoDeviceTraceCollected =
"No device trace was collected. This might happen if your job hadn't been "
"run on the device when sampling was turned on. You could try the sampling"
" again later.";
} // namespace profiler
} // namespace tensorflow

View File

@ -28,6 +28,8 @@ ABSL_CONST_INIT extern const absl::string_view kErrorIncompleteStep;
// step info.
ABSL_CONST_INIT extern const absl::string_view kErrorNoStepMarker;
ABSL_CONST_INIT extern const absl::string_view kNoDeviceTraceCollected;
} // namespace profiler
} // namespace tensorflow