From 494eec269485f29f6c6cda0741b45ebe392471ed Mon Sep 17 00:00:00 2001 From: chenyu Date: Tue, 10 Feb 2026 08:33:02 -0500 Subject: [PATCH] test_setitem_const_fused (#14668) did not realize #14640 also fixed #10690, so added a test for it --- test/test_schedule.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_schedule.py b/test/test_schedule.py index 35c5331cdd..c61c520fec 100644 --- a/test/test_schedule.py +++ b/test/test_schedule.py @@ -1012,6 +1012,15 @@ class TestSchedule(unittest.TestCase): def test_setitem_permuted_sched(self): self.test_setitem_sched(lambda x: x.T, 2) def test_setitem_paddded_sched(self): self.test_setitem_sched(lambda x: x.shrink_to(4, 1).pad_to(4, 4), 1) + def test_setitem_const_fused(self): + # https://github.com/tinygrad/tinygrad/issues/10690 + a = Tensor.arange(16).contiguous().realize() + GlobalCounters.reset() + a[4] = 3 + # TODO: update when this becomes lazy + self.assertEqual(GlobalCounters.kernel_count, 1) + self.assertListEqual(a.tolist(), [0, 1, 2, 3, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) + def test_no_extra_contiguous_on_setitem_assign_back(self): # pattern: contiguous copy, advanced setitem, assign back (e.g. torch backend _view_write) base = Tensor.arange(16).reshape(4, 4).contiguous()