[Profiler] Add optimization advice for reducing the host-to-TPU data transfer time.
PiperOrigin-RevId: 312388184 Change-Id: I2fc8a60af6724467e447026dde7a8d6925ed1357
This commit is contained in:
parent
692bb1da53
commit
7f3ef3e1ea
@ -752,5 +752,17 @@ std::string GetSummaryNextStep(absl::string_view input_classification,
|
||||
return summary_next_step;
|
||||
}
|
||||
|
||||
double HostToDeviceTransferAsPercentOfInputTime(
|
||||
const InputTimeBreakdown& breakdown) {
|
||||
// Thanks to the scaling trick we did in GenerateHostResult(), we can
|
||||
// estimate the percentage of input-time spent on host-to-device transfer in
|
||||
// the following way.
|
||||
double total_input_time_us =
|
||||
breakdown.demanded_file_read_us() + breakdown.advanced_file_read_us() +
|
||||
breakdown.preprocessing_us() + breakdown.enqueue_us() +
|
||||
breakdown.unclassified_non_enqueue_us();
|
||||
return 100.0 * SafeDivide(breakdown.enqueue_us(), total_input_time_us);
|
||||
}
|
||||
|
||||
} // namespace profiler
|
||||
} // namespace tensorflow
|
||||
|
@ -31,6 +31,17 @@ limitations under the License.
|
||||
namespace tensorflow {
|
||||
namespace profiler {
|
||||
|
||||
// If the percent of input-time spent on host-to-device transfer is greater than
|
||||
// kHostToDeviceTimePercentAsSignificant, we should advise the
|
||||
// user to optimize this transfer.
|
||||
constexpr double kHostToDeviceTimePercentAsSignificant = 10.0;
|
||||
|
||||
// If the percent of input-time spent on host-to-device transfer is greater than
|
||||
// kHostToDeviceTimePercentAsDominant, we should ONLY advise the
|
||||
// user to optimize this transfer; we won't bother to suggest optimization for
|
||||
// tf.data.
|
||||
constexpr double kHostToDeviceTimePercentAsDominant = 90.0;
|
||||
|
||||
// Computes the summary of step time in milliseconds.
|
||||
StepSummary ComputeStepTimeSummaryInMs(
|
||||
const ::tensorflow::protobuf::RepeatedPtrField<PerCoreStepInfo>&
|
||||
@ -62,6 +73,11 @@ void OutputAnalysis(double output_percent, std::string* output_classification,
|
||||
string GetSummaryNextStep(absl::string_view input_classification,
|
||||
const InputTimeBreakdown& breakdown);
|
||||
|
||||
// Returns the percentage of the input time that is spent on transferring the
|
||||
// data from host to device.
|
||||
double HostToDeviceTransferAsPercentOfInputTime(
|
||||
const InputTimeBreakdown& breakdown);
|
||||
|
||||
void AddErrorMessages(const OpStats& op_stats,
|
||||
InputPipelineAnalysisResult* result);
|
||||
|
||||
|
@ -81,6 +81,8 @@ message OverviewPageRecommendation {
|
||||
// A statement for input that recommends the next steps for investigating the
|
||||
// bottleneck.
|
||||
string statement = 2;
|
||||
// A list of tips for tackling input bottleneck.
|
||||
repeated OverviewPageTip input_tips = 11;
|
||||
// A statement for output that recommends the next steps for investigating the
|
||||
// bottleneck.
|
||||
string output_statement = 9;
|
||||
|
Loading…
Reference in New Issue
Block a user