Some instructions have giant replica group fields, and make it hard to navigate the graph. Truncate the replica group field string to 128 chars.

PiperOrigin-RevId: 344879689
Change-Id: I3a3d84782c6b948c611b47612f24e356bf06d715
This commit is contained in:
A. Unique TensorFlower 2020-11-30 13:41:29 -08:00 committed by TensorFlower Gardener
parent 7e39270384
commit 9cee936319

View File

@ -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