mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-07 03:00:26 -04:00
simplify tensors before scheduling [pr] (#8580)
* delete forced_realize * put that back * work * remove forced_realize * expectedFailures * contiguous(buffer) * multi * expectedFailures * cleaner create_subbuffer * more comments * remove that * note * realizes * work * one upat and image is back * remove * cleaner * fix test_complex_backward for now --------- Co-authored-by: George Hotz <geohot@gmail.com>
This commit is contained in:
@@ -113,7 +113,8 @@ class TestImageDType(unittest.TestCase):
|
||||
assert it.lazydata.base.realized._buf != b1
|
||||
|
||||
# issue caused by: don't realize image to image casts. this is part of a larger problem
|
||||
@unittest.expectedFailure
|
||||
#@unittest.expectedFailure
|
||||
# update: passing after tensor_map
|
||||
def test_lil_model(self):
|
||||
with Context(IMAGE=2):
|
||||
x = Tensor.zeros(1, 1)
|
||||
|
||||
@@ -220,7 +220,7 @@ class TestSchedule(unittest.TestCase):
|
||||
GlobalCounters.reset()
|
||||
expr = (a*b)/b
|
||||
expr.realize()
|
||||
self.assertEqual(GlobalCounters.kernel_count, 1)
|
||||
self.assertEqual(GlobalCounters.kernel_count, 0) # the scheduler can fold divs now!
|
||||
self.assertEqual(GlobalCounters.global_ops, 0)
|
||||
np.testing.assert_allclose(expr.numpy(), np.full((4,), 4.0))
|
||||
|
||||
@@ -229,7 +229,7 @@ class TestSchedule(unittest.TestCase):
|
||||
GlobalCounters.reset()
|
||||
expr = a/a
|
||||
expr.realize()
|
||||
self.assertEqual(GlobalCounters.kernel_count, 1)
|
||||
self.assertEqual(GlobalCounters.kernel_count, 0)
|
||||
self.assertEqual(GlobalCounters.global_ops, 0)
|
||||
np.testing.assert_allclose(expr.numpy(), np.full((4,), 1.0))
|
||||
|
||||
@@ -2204,7 +2204,7 @@ class TestConst(unittest.TestCase):
|
||||
sched = add.schedule()
|
||||
self.assertEqual(len(sched), 0)
|
||||
# b+0 and b share the same underlying device memory
|
||||
self.assertIs(add.lazydata.realized, b.lazydata.realized)
|
||||
self.assertIs(add.lazydata.buffer, b.lazydata.buffer)
|
||||
self.assertListEqual(add.tolist(), [2, 2, 2, 2])
|
||||
|
||||
def test_src_masked_const_folding(self):
|
||||
|
||||
Reference in New Issue
Block a user