From 8a141854d81a9135a3658255c5813c5277364d01 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Tue, 5 Jun 2018 17:34:20 -0700 Subject: [PATCH] [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 --- .../service/human_readable_profile_builder.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tensorflow/compiler/xla/service/human_readable_profile_builder.cc b/tensorflow/compiler/xla/service/human_readable_profile_builder.cc index dc3bfce0c49..d7458c338e9 100644 --- a/tensorflow/compiler/xla/service/human_readable_profile_builder.cc +++ b/tensorflow/compiler/xla/service/human_readable_profile_builder.cc @@ -169,6 +169,23 @@ string HumanReadableProfileBuilder::ToString() const { 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(op.bytes_accessed) / (1 << 20); + table.AddEntry(std::move(entry)); + } + StrAppend(&s, + table.MakeReport(static_cast(total_bytes) / (1 << 20))); + } return s; }