diff --git a/tensorflow/compiler/xla/service/hlo_graph_dumper.cc b/tensorflow/compiler/xla/service/hlo_graph_dumper.cc index 164e92ae8e8..533e6b11160 100644 --- a/tensorflow/compiler/xla/service/hlo_graph_dumper.cc +++ b/tensorflow/compiler/xla/service/hlo_graph_dumper.cc @@ -1153,7 +1153,16 @@ string HloDotDumper::GetInstructionNodeExtraInfo(const HloInstruction* instr) { for (const auto& line : instr->ExtraAttributesToString( HloPrintOptions().set_print_subcomputation_mode( HloPrintOptions::PrintSubcomputationMode::kOff))) { - lines.push_back(HtmlLikeStringSanitize(line)); + // Some instructions have giant replica group fields, so truncate the + // replica group line length to 128. + constexpr int kMaxReplicaGroupLen = 128; + if (absl::StartsWith(line, "replica_groups=") && + line.length() > kMaxReplicaGroupLen) { + lines.push_back(HtmlLikeStringSanitize( + StrCat(line.substr(0, kMaxReplicaGroupLen - 3), "..."))); + } else { + lines.push_back(HtmlLikeStringSanitize(line)); + } } // Show the shape and layout of the instruction, unless it's an inlined fusion