From ba0c246cfd32ad08b3ba25d21f78bee4d359bdb9 Mon Sep 17 00:00:00 2001 From: chenyu Date: Sat, 2 Nov 2024 18:40:53 -0400 Subject: [PATCH] update test_setitem_overlapping_inplace1 (#7494) failed on LLVM and remu, not real AMD --- test/test_setitem.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/test/test_setitem.py b/test/test_setitem.py index b70cca8784..1b5e4385e9 100644 --- a/test/test_setitem.py +++ b/test/test_setitem.py @@ -1,5 +1,6 @@ import unittest from tinygrad import Device, Tensor, TinyJit, Variable, dtypes +from tinygrad.helpers import CI import numpy as np class TestSetitem(unittest.TestCase): @@ -114,12 +115,20 @@ class TestSetitem(unittest.TestCase): np.testing.assert_allclose(t.numpy(), n) np.testing.assert_allclose(t.numpy(), [[1,1,1,1,1,1],[2,2,2,2,2,2],[3,3,3,3,3,3],[4,4,4,4,4,4],[5,5,5,5,5,5],[6,6,6,6,6,6]]) - @unittest.skipUnless(Device.DEFAULT in {"LLVM", "AMD"}, "only fails on LLVM and AMD") - @unittest.expectedFailure - def test_setitem_overlapping_inplace(self): + def test_setitem_overlapping_inplace1(self): t = Tensor([[3.0], [2.0], [1.0]]).contiguous() t[1:] = t[:-1] - self.assertEqual(t.tolist(), [[3.0], [3.0], [2.0]]) + if (Device.DEFAULT == "LLVM") or (CI and Device.DEFAULT == "AMD"): + # TODO: FIXME + with self.assertRaises(AssertionError): + self.assertEqual(t.tolist(), [[3.0], [3.0], [2.0]]) + else: + self.assertEqual(t.tolist(), [[3.0], [3.0], [2.0]]) + + def test_setitem_overlapping_inplace2(self): + t = Tensor([[3.0], [2.0], [1.0]]).contiguous() + t[:-1] = t[1:] + self.assertEqual(t.tolist(), [[2.0], [1.0], [1.0]]) class TestWithGrad(unittest.TestCase): def test_no_requires_grad_works(self):