mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
viz: show contents of vconst (#16636)
* failing test * render vconst * simpler test * reorder
This commit is contained in:
parent
5644605d92
commit
1cb6b88d37
2 changed files with 4 additions and 1 deletions
|
|
@ -258,6 +258,9 @@ class TestViz(unittest.TestCase):
|
|||
const_reshaped = const_stack.reshape((1, 2))
|
||||
const_graph = uop_to_json(VizData(), const_reshaped)
|
||||
self.assertTrue(const_graph[id(const_stack)]["exclude"])
|
||||
reshape_node = const_graph[id(const_reshaped)]
|
||||
self.assertFalse(reshape_node["exclude"])
|
||||
self.assertIn("STACK0 {1,2} Ops.CONST", reshape_node["label"].split("\n"))
|
||||
|
||||
# VIZ displays nested graph_rewrites in a tree view
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ def uop_to_json(data:VizData, x:UOp) -> dict[int, dict]:
|
|||
# walk through excluded movement ops to find the underlying CONST
|
||||
cx = x
|
||||
while cx.op in GroupOp.Movement and len(cx.src) >= 1 and cx.src[0] in excluded: cx = cx.src[0]
|
||||
arg = f"{cx.arg:g}" if cx.op is Ops.CONST and dtypes.is_float(cx.dtype) else f"{cx.arg}"
|
||||
arg = f"{cx.arg:g}" if cx.op is Ops.CONST and dtypes.is_float(cx.dtype) else cx.render() if cx.op is Ops.STACK else f"{cx.arg}"
|
||||
label += f"\n{cx.op.name}{idx} {arg}" + (f" {cx.src[0].op}" if len(cx.src) else "")
|
||||
try:
|
||||
if len(rngs:=u.ranges):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue