mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-08 22:48:25 -05:00
limit metal buffers and revert the 207 fix (try 2) (#2088)
* limit metal buffers
* look at the base, not the srcs
* Revert "Revert "openpilot kernel fix from 209 to 207 (#2006)" (#2065)"
This reverts commit 924ecc4d6a.
* add a test for that
This commit is contained in:
@@ -326,5 +326,17 @@ class TestSchedule(unittest.TestCase):
|
||||
out = x.to('cpu')
|
||||
check_schedule(out, 0, filter_loadops=False)
|
||||
|
||||
@unittest.skipUnless(Device.DEFAULT == "METAL", "only for metal")
|
||||
def test_metal_limit_buffers(self):
|
||||
t = sum([Tensor([1,2,3,4]) for _ in range(40)])
|
||||
for si in t.lazydata.schedule():
|
||||
assert len(si.inputs) <= 30
|
||||
|
||||
@unittest.skipUnless(Device.DEFAULT == "METAL", "only for metal")
|
||||
def test_metal_dont_limit_same_buffers(self):
|
||||
bt = Tensor(list(range(1, 100)))
|
||||
out = sum([bt[i:i+2] for i in range(1,40)])
|
||||
check_schedule(out, 1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
||||
|
||||
Reference in New Issue
Block a user