MCPcopy
hub / github.com/tinygrad/tinygrad / test_python_marker

Method test_python_marker

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

Source from the content-addressed store, hash-verified

604 get_profile(VizData(), prof)
605
606 def test_python_marker(self):
607 with save_viz():
608 a = Tensor.empty(1, device="NULL")
609 b = Tensor.empty(1, device="NULL")
610 (a+b).realize()
611 profile_marker("test 1")
612 (a*b).realize()
613 profile_marker("test 2")
614 profile_ret = load_profile(cpu_events)
615 markers = profile_ret["markers"]
616 kernels = profile_ret["layout"]["NULL"]["events"]
617 self.assertEqual(len(markers), 2)
618 assert kernels[0]["st"] <= markers[0]["ts"] <= kernels[1]["st"]
619 assert markers[1]["ts"] >= kernels[1]["st"]+kernels[1]["dur"]
620
621 def test_layout_order(self):
622 with save_viz():

Callers

nothing calls this directly

Calls 5

profile_markerFunction · 0.90
save_vizFunction · 0.85
load_profileFunction · 0.85
realizeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected