Skip to content

Commit

Permalink
reduceop should always realize
Browse files Browse the repository at this point in the history
  • Loading branch information
Qazalin committed May 6, 2024
1 parent d3a226d commit 023f25a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tinygrad/engine/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ def _graph_schedule(outs:List[LazyBuffer], seen:Set[LazyBuffer]) -> Tuple[Defaul
continue
parents.extend(p.srcs)
if forced_realize:
for rc in (prev_children:=realized_children.copy()):
for rc in realized_children.copy():
rc_parents = deque(rc.srcs)
while rc_parents:
if (p:=rc_parents.pop().base).op is LoadOps.CONST or p.realized or p is r: continue
if p in realizes or p.op in ReduceOps or p in reduce_for_op:
del realized_children[rc]
break
rc_parents.extend(p.srcs)
if len(realized_children) < len(prev_children): realizes[r] = None
if len(realized_children) != 0: realizes[r] = None
if len(realized_children) == 0:
tr = r
if can_chase:
Expand Down

0 comments on commit 023f25a

Please sign in to comment.