mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
viz: better name for src id in kernel_graph.txt (#16495)
* viz: better name for src id in kernel_graph.txt * better order * cleanup
This commit is contained in:
parent
9dac781e45
commit
f7f03bd7e5
1 changed files with 5 additions and 5 deletions
|
|
@ -26,16 +26,16 @@ if __name__ == "__main__":
|
|||
# print the CALL and its kernel name from codegen
|
||||
print(f"{lines[0]:<12} {lines[-1]}")
|
||||
# print sources (buffer, param, multi)
|
||||
unique:dict[str, int] = {}
|
||||
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(str(s))) is None: unique[str(s)] = num = len(unique)
|
||||
print(f"SRC {i} {' '.join(get_node(graph, s)['label'].splitlines())} g{num}-{sched_num}")
|
||||
if (num:=unique.get(s)) is None: unique[s] = num = len(unique)
|
||||
print(f"SRC {i} id={num}-{sched_num} {' '.join(get_node(graph, s)['label'].splitlines())}")
|
||||
# print access patterns
|
||||
ss = [v["src"][0][1]]
|
||||
seen:set[str] = set()
|
||||
seen:set[int] = set()
|
||||
while ss:
|
||||
if (s:=str(ss.pop())) in seen: continue
|
||||
if (s:=ss.pop()) in seen: continue
|
||||
seen.add(s)
|
||||
if get_node(graph, s)["label"].startswith("INDEX"):
|
||||
idx_str = get_node(graph, s)["label"].splitlines()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue