viz: kernel_graph.txt unique is per schedule (#16511)

This commit is contained in:
qazal 2026-06-05 15:17:28 +08:00 committed by GitHub
commit 79a13310b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,13 +20,13 @@ if __name__ == "__main__":
if (v:=json.loads(next(sys.stdin, "{}")).get("value")): print(v)
if ref is not None or not isinstance(rec:=next(iter(graph.values()), {}), dict) or "label" not in rec: continue
sched_num = next(sched_counter)
unique:dict[int, int] = {}
for v in graph.values():
if not v["label"].startswith("CALL"): continue
lines = v["label"].splitlines()
# print the CALL and its kernel name from codegen
print(f"{lines[0]:<12} {lines[-1]}")
# print sources (buffer, param, multi)
unique:dict[int, int] = {}
for i,(_,s) in enumerate(v["src"][1:]):
while get_node(graph, s)["label"].startswith("AFTER"): s = get_node(graph, s)["src"][0][1]
if (num:=unique.get(s)) is None: unique[s] = num = len(unique)