From a59cbb288613aa9ca99ebda70b2e5202fc3d71b0 Mon Sep 17 00:00:00 2001 From: qazal Date: Sat, 19 Oct 2024 16:08:28 +0300 Subject: [PATCH] shorter path for realized --- tinygrad/engine/schedule.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tinygrad/engine/schedule.py b/tinygrad/engine/schedule.py index e043511989..b822990c65 100644 --- a/tinygrad/engine/schedule.py +++ b/tinygrad/engine/schedule.py @@ -159,6 +159,7 @@ def to_uop(buf:LazyBuffer, outputs:List[LazyBuffer], inputs:List[LazyBuffer], bu return ret if buf.op is MetaOps.CONST: return buf_uops[buf.buffer] dtype = buf.dtype.base if isinstance(buf.dtype, ImageDType) else buf.dtype + if buf.is_realized(): return UOp(UOps.LOAD, dtype, (buf_uops[buf.buffer], buf.st.to_uop())) if (ubuf:=buf_uops.get(buf.buffer)) is not None and buf not in outputs: if not any(x.buffer is buf.buffer for x in outputs) and buf not in inputs: inputs.append(buf) return UOp.load(ubuf, buf.st.to_uop(), dtype=dtype)