From 6853da2a2ffd89de57e90390c3c3faeda5f51147 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Wed, 29 Oct 2025 18:45:16 +0800 Subject: [PATCH] works --- test/test_rangeify.py | 4 ++-- tinygrad/codegen/late/linearizer.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test_rangeify.py b/test/test_rangeify.py index 297676b7c2..d96f0a61c3 100644 --- a/test/test_rangeify.py +++ b/test/test_rangeify.py @@ -32,8 +32,8 @@ class TestBigDoubleMatmul(unittest.TestCase): outs += (Opt(OptOps.TC, 0, (0, 0, 1, 0)),) outs += (Opt(OptOps.UPCAST, 0, 4),) outs += (Opt(OptOps.UPCAST, 1, 4),) - outs += (Opt(OptOps.UNROLL, 0, 4),) - outs += (Opt(OptOps.UNROLL, 1, 4),) + outs += (Opt(OptOps.UNROLL, 0, 2),) + outs += (Opt(OptOps.UNROLL, 1, 2),) self._test(outs) @unittest.skipIf(isinstance(Device[Device.DEFAULT].renderer, (NIRRenderer, PTXRenderer, CUDARenderer)), "broken in LVP and PTX") diff --git a/tinygrad/codegen/late/linearizer.py b/tinygrad/codegen/late/linearizer.py index 6c95b37880..b91afed1ec 100644 --- a/tinygrad/codegen/late/linearizer.py +++ b/tinygrad/codegen/late/linearizer.py @@ -16,10 +16,10 @@ def linearize(u:UOp) -> list[UOp]: in_degree[u] = len(u.src) # put loads in the beginning of the block and prevent priority inversion. hack for BARRIER grouping too priority = [0] + [priorities[x] for x in consumers[u]] - if u.op is Ops.LOAD: priority.append(-1000) + if u.op is Ops.LOAD: priority.append(-5000) 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)