class HloDotDumper {
public:
HloDotDumper(const HloComputation* computation, tensorflow::StringPiece label,
- const DebugOptions& debug_options, bool show_metadata,
- bool show_backend_config, const HloExecutionProfile* profile,
- NodeFilter filter)
+ const DebugOptions& debug_options, bool show_backend_config,
+ const HloExecutionProfile* profile, NodeFilter filter)
: computation_(computation),
label_(std::string(label)),
debug_options_(debug_options),
- show_metadata_(show_metadata),
show_backend_config_(show_backend_config),
profile_(profile),
filter_(std::move(filter)) {}
const HloComputation* computation_; // never null
const string label_; // overall name for the graph
const DebugOptions& debug_options_;
- const bool show_metadata_;
const bool show_backend_config_;
const HloExecutionProfile* profile_; // may be null
const NodeFilter filter_;
}
}
- return Printf(R"(%s [label=<%s>, shape=%s, tooltip=" ", %s];)"
+ return Printf(R"(%s [label=<%s>, shape=%s, tooltip="%s", %s];)"
"\n",
- InstructionId(instr), node_body, node_shape,
+ InstructionId(instr), node_body, node_shape, node_metadata,
NodeColorAttributes(color));
}
}
string HloDotDumper::GetInstructionNodeMetadata(const HloInstruction* instr) {
- if (!show_metadata_) {
- return "";
- }
-
std::vector<string> lines;
if (!instr->metadata().op_name().empty()) {
lines.push_back(HtmlLikeStringSanitize(instr->metadata().op_name()));
string DumpGraph(const HloComputation& computation, const string& label,
const DebugOptions& debug_options,
const HloExecutionProfile* hlo_execution_profile,
- bool show_metadata, bool show_backend_config) {
+ bool show_backend_config) {
GraphRendererInterface::GraphKind graph_kind;
string graph;
if (debug_options.xla_hlo_dump_as_graphdef()) {
graph_kind = GraphRendererInterface::TF_GRAPHDEF;
} else {
graph =
- HloDotDumper(&computation, label, debug_options, show_metadata,
- show_backend_config, hlo_execution_profile, NodeFilter())
+ HloDotDumper(&computation, label, debug_options, show_backend_config,
+ hlo_execution_profile, NodeFilter())
.Dump();
graph_kind = GraphRendererInterface::DOT_GRAPH;
}
}
string DumpNeighborhoodAround(const HloInstruction& node, int radius,
- bool show_metadata, bool show_backend_config) {
+ bool show_backend_config) {
auto debug_options = node.GetModule()->config().debug_options();
string label =
StrCat("Neighborhood of ", radius, " nodes around ", node.name());
NodeFilter filter = MakeNodeFilter(&node, radius);
- string graph = HloDotDumper(node.parent(), label, debug_options,
- show_metadata, show_backend_config,
- /*profile=*/nullptr, filter)
- .Dump();
+ string graph =
+ HloDotDumper(node.parent(), label, debug_options, show_backend_config,
+ /*profile=*/nullptr, filter)
+ .Dump();
return ExportGraph(graph, GraphRendererInterface::DOT_GRAPH, debug_options);
}
string DumpGraph(const HloComputation& computation, const string& label,
const DebugOptions& debug_options,
const HloExecutionProfile* hlo_execution_profile = nullptr,
- bool show_metadata = false, bool show_backend_config = false);
+ bool show_backend_config = false);
// Like DumpGraph, but renders only nodes "near" the given node in the graph.
//
// (roughly) corresponds to the max distance a node may be from the primary node
// before it's omitted from the graph.
string DumpNeighborhoodAround(const HloInstruction& node, int radius,
- bool show_metadata = false,
bool show_backend_config = false);
// Dumps the HloModule::ToString() as a file into the provided directory path