MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / get_node_content

Function get_node_content

src/graphviz.cpp:153–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153graphviz_node_content get_node_content(const instruction_ref& ins)
154{
155 const auto& op = ins->get_operator();
156 const std::string name = ins->name();
157
158 graphviz_node_content content;
159
160 if(name == "@param") // for params, get typing information
161 {
162 content.title = name;
163 content.body_lines.push_back(graphviz::format_shape_name(ins->get_shape(), "<BR/>"));
164
165 content.html_style = {0, 0, 0, 0};
166 content.node_style = {
167 "#F0E68C" /* khaki */, "#000000" /* black */, "filled", "rectangle", "Helvectica"};
168 }
169 else if(name == "@literal") // for literals, just put @literal for name
170 {
171 content.title = name;
172
173 content.html_style = {0, 0, 0, 0};
174 content.node_style.style = "filled";
175 content.node_style.shape = "rectangle";
176 }
177 else if(name == "gpu::code_object") // use code_object_op::symbol_name for title
178 {
179 content.title = op.to_value()["symbol_name"].to<std::string>();
180 content.body_lines.push_back(to_string(op));
181
182 content.node_style.fillcolor = "#E9D66B"; // arylideyellow
183 }
184 else
185 {
186 // default case
187 content.title = name;
188
189 if(std::string op_to_string = to_string(op);
190 name != op_to_string) // stops title == body, don't like doing compare
191 content.body_lines.push_back(op_to_string);
192
193 const auto& attr = op.attributes();
194 if(attr.contains("style"))
195 content.node_style.style = attr.at("style").to<std::string>();
196 if(attr.contains("fontcolor"))
197 content.node_style.fontcolor = attr.at("fontcolor").to<std::string>();
198 }
199
200 if(content.node_style.fillcolor.empty())
201 content.node_style.fillcolor = get_graph_color(ins);
202
203 return content;
204}
205
206} // namespace graphviz
207} // namespace MIGRAPHX_INLINE_NS

Callers 1

print_graphMethod · 0.85

Calls 11

format_shape_nameFunction · 0.85
get_graph_colorFunction · 0.85
atMethod · 0.80
to_stringFunction · 0.50
nameMethod · 0.45
push_backMethod · 0.45
get_shapeMethod · 0.45
to_valueMethod · 0.45
attributesMethod · 0.45
containsMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected