MCPcopy
hub / github.com/tinygrad/tinygrad / test_free_last

Method test_free_last

test/null/test_viz.py:666–681  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

664 self.assertEqual(len(ret["events"]), 6)
665
666 def test_free_last(self):
667 with save_viz():
668 bufs = []
669 for _ in range(3):
670 bufs.append(_alloc(1))
671 profile_marker("alloc")
672 device = bufs[0].device
673 while bufs:
674 b = bufs.pop()
675 del b
676 profile_marker("free")
677 profile = load_profile(cpu_events+Buffer.profile_events)
678 ret = profile["layout"][f"{device} Memory"]
679 self.assertEqual(ret["peak"], 3)
680 self.assertEqual(len(ret["events"]), 6)
681 self.assertEqual(len(profile["markers"]), 6)
682
683 def test_producer_simple(self):
684 with save_viz():

Callers

nothing calls this directly

Calls 5

profile_markerFunction · 0.90
save_vizFunction · 0.85
_allocFunction · 0.85
load_profileFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected