MCPcopy
hub / github.com/tinygrad/tinygrad / test_profile_kernel_run

Method test_profile_kernel_run

test/backend/test_profiler.py:55–65  ·  view source on GitHub ↗
(self, wait=False)

Source from the content-addressed store, hash-verified

53 TestProfiler.b.uop.buffer.allocate()
54
55 def test_profile_kernel_run(self, wait=False):
56 runner_name = TestProfiler.runtime.name
57 with helper_collect_profile(TestProfiler.d0) as profile:
58 gs, ls = TestProfiler.prg.arg.launch_dims({})
59 TestProfiler.runtime(TestProfiler.b.uop.buffer._buf, TestProfiler.a.uop.buffer._buf, global_size=gs, local_size=ls, wait=wait)
60
61 profile, _ = helper_profile_filter_device(profile, TestProfiler.d0.device)
62 kernel_runs = [x for x in profile if isinstance(x, ProfileRangeEvent)]
63 assert len(kernel_runs) == 1, "one kernel run is expected"
64 assert kernel_runs[0].name == runner_name, "kernel name is not correct"
65 assert _dev_base(kernel_runs[0].device) == kernel_runs[0].device, "kernel should not be on a sub-device"
66
67 def test_profile_kernel_run_wait(self):
68 self.test_profile_kernel_run(wait=True)

Callers 1

Calls 4

helper_collect_profileFunction · 0.85
_dev_baseFunction · 0.85
launch_dimsMethod · 0.80

Tested by

no test coverage detected