G.nodes isn't always valid

This commit is contained in:
George Hotz
2023-03-04 07:24:43 -08:00
parent 85f69b5489
commit 8bc9277587

View File

@@ -47,7 +47,7 @@ def log_op(ret : DeviceBuffer, ast : LazyOp, show_graph : Optional[bool] = None)
op : List[Op] = [x.op for x in get_lazyops(ast)]
inp : List[DeviceBuffer] = get_buffers(ast)
if len(inp) == 1 and inp[0] == ret:
if nm(ret) in G.nodes: G.nodes[nm(ret)]['style'] += ', bold'
if show_graph and nm(ret) in G.nodes: G.nodes[nm(ret)]['style'] += ', bold'
return # don't log self loops
oporder = [LoadOps, FusedOps, ReduceOps, BinaryOps, UnaryOps, MovementOps]
optype = type(sorted(op, key=lambda x: oporder.index(type(x)))[0])