[XLA] Print live ranges by every moment.

"Spotting peak memory usages has never been easier!"

PiperOrigin-RevId: 357299937
Change-Id: Ie4d4baf7c9182950eb7130ebb06def896faf9fad
This commit is contained in:
A. Unique TensorFlower 2021-02-12 17:42:46 -08:00 committed by TensorFlower Gardener
parent 6f36ade676
commit c0b8e3e1ba
2 changed files with 0 additions and 23 deletions

View File

@ -787,7 +787,6 @@ string BufferAssignment::ToString() const {
}
}
absl::StrAppend(&output, "\nTotal bytes used: ", total_size, "\n");
absl::StrAppend(&output, hlo_live_range_->ToString());
absl::StrAppend(&output, "\nUsed values:\n");
absl::c_sort(used_values, &CompareHloValuesById);
for (const HloValue* value : used_values) {
@ -1733,7 +1732,6 @@ StatusOr<std::unique_ptr<BufferAssignment>> BufferAssigner::CreateAssignment(
assignment->CombineTempAllocations();
XLA_VLOG_LINES(2, assignment->ToString());
TF_RETURN_IF_ERROR(assignment->ComputeSummaryStats());
XLA_VLOG_LINES(1, assignment->GetStats().ToString());
VLOG(1) << "Buffer assignment done.";

View File

@ -228,27 +228,6 @@ std::string HloLiveRange::ToString() const {
}
}
absl::StrAppendFormat(&output, " Live ranges at every moment:\n");
for (int i = 0; i < schedule_end_time(); i++) {
int total = 0;
std::string s;
for (const HloValue* value : alias_analysis_.dataflow_analysis().values()) {
auto it = buffer_live_ranges_.find(value);
if (it != buffer_live_ranges_.end()) {
if (it->second.start <= i && i <= it->second.end) {
absl::StrAppendFormat(&s, "%s,", value->instruction()->name());
total += ShapeUtil::ByteSizeOf(value->instruction()->shape(), 8);
}
}
}
if (!s.empty()) {
// Remove the trailing comma.
s.pop_back();
}
absl::StrAppendFormat(&s, "\n");
absl::StrAppendFormat(&output, " %d, %d bytes: %s", i, total, s);
}
return output;
}