[XLA] Add a bytes read+written table to the end of --xla_hlo_profile.

This is useful when tuning fusion heuristics -- you expect this number
to go down (even if the total runtime doesn't go down, due to suboptimal
emitters).

PiperOrigin-RevId: 199386923
This commit is contained in:
Justin Lebar 2018-06-05 17:34:20 -07:00 committed by TensorFlower Gardener
parent 902832ae7f
commit 8a141854d8

View File

@ -169,6 +169,23 @@ string HumanReadableProfileBuilder::ToString() const {
StrAppend(&s, table.MakeReport(CyclesToMicroseconds(total_cycles_))); StrAppend(&s, table.MakeReport(CyclesToMicroseconds(total_cycles_)));
} }
} }
if (total_bytes > 0) {
MetricTableReport table;
table.SetMetricName("MiB read+written");
table.SetEntryName("ops");
table.SetShowCategoryTable();
for (const auto& op : op_infos_) {
MetricTableReport::Entry entry;
entry.text = op.name;
entry.short_text = op.short_name;
entry.category_text = op.category;
entry.metric = static_cast<double>(op.bytes_accessed) / (1 << 20);
table.AddEntry(std::move(entry));
}
StrAppend(&s,
table.MakeReport(static_cast<double>(total_bytes) / (1 << 20)));
}
return s; return s;
} }