From 00dec1c554532b9073b21ff0a89a6bb2cc351e54 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Tue, 17 Feb 2026 09:41:52 +0800 Subject: [PATCH] limit src lines --- tinygrad/viz/serve.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tinygrad/viz/serve.py b/tinygrad/viz/serve.py index 175aec8925..05988552bc 100755 --- a/tinygrad/viz/serve.py +++ b/tinygrad/viz/serve.py @@ -137,6 +137,9 @@ def uop_to_json(x:UOp) -> dict[int, dict]: if (ref:=ref_map.get(u.src[0]) if u.op is Ops.CALL else None) is not None: label += f"\ncodegen@{ctxs[ref]['name']}" # NOTE: kernel already has metadata in arg if TRACEMETA >= 2 and u.metadata is not None and u.op is not Ops.CALL: label += "\n"+str(u.metadata) + # limit SOURCE labels line count + if u.op is Ops.SOURCE and len(lines:=label.split("\n")) > 40: + label = "\n".join(lines[:30]) + "\n..." graph[id(u)] = {"label":label, "src":[(i,id(x)) for i,x in enumerate(u.src) if x not in excluded], "color":uops_colors.get(u.op, "#ffffff"), "ref":ref, "tag":repr(u.tag) if u.tag is not None else None} return graph