From debae1be5b1c2f23dce4a2c9a8f97087a77a5816 Mon Sep 17 00:00:00 2001 From: Chen-Yu Yang Date: Sat, 21 Feb 2026 20:49:33 -0500 Subject: [PATCH] raise explicitly for test_crossunder_assign --- test/unit/test_assign.py | 1 - tinygrad/schedule/rangeify.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test/unit/test_assign.py b/test/unit/test_assign.py index 870219a8e45db..b39b52c23fea5 100644 --- a/test/unit/test_assign.py +++ b/test/unit/test_assign.py @@ -233,7 +233,6 @@ def test_assign_double_diamond_reduce(self): np.testing.assert_equal(b0.numpy(), 128) np.testing.assert_equal(b1.numpy(), 608) - @unittest.skip("TODO: bring this assert back") def test_crossunder_assign(self): # NOTE: should *not* raise AssertionError from numpy with self.assertRaisesRegex(RuntimeError, "cycle"): diff --git a/tinygrad/schedule/rangeify.py b/tinygrad/schedule/rangeify.py index 5c9b46e4acef0..89688b5db2c53 100644 --- a/tinygrad/schedule/rangeify.py +++ b/tinygrad/schedule/rangeify.py @@ -499,8 +499,8 @@ def get_rangeify(sink:UOp) -> UOp: # TODO: this is probably broken for MSELECT/MSTACK if s.op not in {Ops.BUFFER, Ops.PARAM} or s is u.buf_uop or (a:=kernel_assign.get(s)) is None: continue if a.src[1] is u.src[1]: continue # same kernel (multi-output custom kernels) - if any(x.op is Ops.AFTER and x.buf_uop is s for x in u.toposort()): - raise RuntimeError(f"cycle detected in graph, kernel for {u.buf_uop} must either depend on AFTER or BUFFER") + if any(x.op is Ops.AFTER and x.buf_uop is s for x in kernel_assign[u.buf_uop].backward_slice): + raise RuntimeError(f"cycle detected in assign graph, buffers {s} and {u.buf_uop} have circular dependency") assign_rep[a] = kernel_assign[s] = a.replace(src=a.src+(u,)) if assign_rep: tsink = graph_rewrite(tsink, _substitute, ctx=assign_rep, bottom_up=True, name="fix_assign") if VIZ: graph_rewrite(tsink, PatternMatcher([]), name="View Kernel Graph")