Skip to content

Commit b91dbca

Browse files
authored
Add colors to compute_at edges and thread/block indices. (#5111)
1 parent 841725c commit b91dbca

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

python/tvm/contrib/tedd.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@
3737
8: ('kTensorized', '#A9DFBF'),
3838
}
3939

40+
PALETTE = {
41+
0: '#000000',
42+
1: '#922B21',
43+
2: '#76448A',
44+
3: '#1F618D',
45+
4: '#148F77',
46+
5: '#B7950B',
47+
6: '#AF601A',
48+
7: '#F5B7B1',
49+
8: '#A9DFBF',
50+
}
51+
52+
PALETTE_SIZE = 9
4053

4154
def dom_path_to_string(dom_path, prefix=""):
4255
path_string = prefix
@@ -458,8 +471,8 @@ def stage_node_label(stage):
458471
var_attr_label = ''
459472
if "thread" in leafiv["properties"] and \
460473
leafiv["properties"]["thread"] is not None:
461-
var_attr_label = var_attr_label + "<br/>(" + str(
462-
leafiv["properties"]["thread"]) + ")"
474+
var_attr_label = var_attr_label + "<br/><font color=\"#2980B9\">(" + str(
475+
leafiv["properties"]["thread"]) + ")</font>"
463476
if "intrin" in leafiv["properties"] and \
464477
leafiv["properties"]["intrin"] is not None:
465478
var_attr_label = var_attr_label + "<br/>" + \
@@ -483,7 +496,11 @@ def compute_at_dot(g, stage):
483496
[stage["attaching_to"][0]], "Stage") + ":" + dom_path_to_string(
484497
stage["attaching_to"],
485498
"IterVar") if stage["attaching_to"] is not None else "ROOT"
486-
g.edge(src, dst)
499+
color = PALETTE[
500+
stage["attaching_to"][1] +
501+
1] if stage["attaching_to"] is not None and stage["attaching_to"][
502+
1] < PALETTE_SIZE - 1 else PALETTE[0]
503+
g.edge(src, dst, color=color)
487504

488505
graph = create_schedule_tree_graph("Schedule Tree")
489506
s = extract_dom_for_viz(sch)

tests/python/contrib/test_tedd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def verify():
125125
findany(r"r.outer\(kCommReduce\)", str)
126126
findany(r"label=ROOT", str)
127127
# Check the compute_at edge
128-
findany(r"Stage_1", str)
128+
findany(r"Stage_1.*\[color\=\"\#000000\"\]", str)
129129

130130
if checkdepdency():
131131
verify()

0 commit comments

Comments
 (0)