dedup COPY UOp [pr] (#8506)

This commit is contained in:
qazal
2025-01-06 10:37:20 +02:00
committed by GitHub
parent 76a138cdb6
commit eb7df92136
2 changed files with 7 additions and 6 deletions

View File

@@ -230,16 +230,16 @@ class TestSchedule(unittest.TestCase):
# a and b share the same underlying device memory
self.assertIs(a.lazydata.realized, b.lazydata.realized)
# EMPTY and COPY are assigned to unique device Buffers
def test_no_dedup_copy(self):
def test_copy_dedups(self):
src = Tensor.ones(4).contiguous().realize()
a = src.clone()
b = src.clone()
sched = check_schedule([a, b], 2, filter_sink=False)
sched = check_schedule([a, b], 1, filter_sink=False)
run_schedule(sched)
# a and b are assigned to different device Buffers
self.assertIsNot(a.lazydata.realized, b.lazydata.realized)
# a and b are assigned to the same device Buffer
self.assertIs(a.lazydata.realized, b.lazydata.realized)
# EMPTY is assigned to a unique device Buffer
def test_no_dedup_empty(self):
a = Tensor.empty((4,))