From 3a98035fa8fe8d02960c605e210fbf8af2d14516 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 11 Sep 2017 15:09:42 -0700 Subject: [PATCH] [XLA] Augment metadata output with source-line info, as before. PiperOrigin-RevId: 168292527 --- .../compiler/xla/service/hlo_graph_dumper.cc | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tensorflow/compiler/xla/service/hlo_graph_dumper.cc b/tensorflow/compiler/xla/service/hlo_graph_dumper.cc index 3c5113eb4d993e..b8cb8c2c8b6ea1 100644 --- a/tensorflow/compiler/xla/service/hlo_graph_dumper.cc +++ b/tensorflow/compiler/xla/service/hlo_graph_dumper.cc @@ -811,13 +811,25 @@ string HloDotDumper::GetInstructionNodeLabel(const HloInstruction* instr) { } string HloDotDumper::GetInstructionNodeMetadata(const HloInstruction* instr) { - if (!show_metadata_ || instr->metadata().op_name().empty()) { + if (!show_metadata_) { return ""; } - return Printf(R"(%s
op_type: %s)", - HtmlLikeStringSanitize(instr->metadata().op_name()), - HtmlLikeStringSanitize(instr->metadata().op_type())); + std::vector lines; + if (!instr->metadata().op_name().empty()) { + lines.push_back(HtmlLikeStringSanitize(instr->metadata().op_name())); + } + if (!instr->metadata().op_type().empty()) { + lines.push_back(Printf( + "op_type: %s", HtmlLikeStringSanitize(instr->metadata().op_type()))); + } + if (!instr->metadata().source_file().empty() && + instr->metadata().source_line() != 0) { + lines.push_back(Printf("op_type: %s", instr->metadata().source_file(), + instr->metadata().source_line())); + } + + return Join(lines, "
"); } string HloDotDumper::GetInstructionNodeExtraInfo(const HloInstruction* instr) {