From 914defd55d6909b746554b4dbf5aaa641abd2cc0 Mon Sep 17 00:00:00 2001 From: Sieds Lykles <93992551+S-Lykles@users.noreply.github.com> Date: Thu, 23 Oct 2025 05:19:13 +0200 Subject: [PATCH] give endrange priority (#12870) * uncomment line * try giving endrange priority --- tinygrad/codegen/late/control_flow.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tinygrad/codegen/late/control_flow.py b/tinygrad/codegen/late/control_flow.py index 8db34caaff..d866b285ed 100644 --- a/tinygrad/codegen/late/control_flow.py +++ b/tinygrad/codegen/late/control_flow.py @@ -45,7 +45,8 @@ def linearize(u:UOp) -> list[UOp]: if u.op is Ops.LOAD: priority.append(-1000) if u.op is Ops.BARRIER: priority.append(-1500) # ranges are scheduled as late as possible so anything that can be outside is - #if u.op is Ops.RANGE: priority = [2000] + # if u.op is Ops.RANGE: priority = [2000] + if u.op is Ops.END: priority = [-1000] # move defines and consts to the top if u.op in {Ops.DEFINE_GLOBAL, Ops.DEFINE_LOCAL, Ops.DEFINE_REG, Ops.DEFINE_VAR, Ops.SPECIAL, Ops.CONST}: priority.append(-2000) priorities[u] = min(priority)