mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-08-20 23:53:44 +08:00
100f89a161
* openpilot v0.9.9 release date: 2025-06-05T19:54:08 master commit: 8aadf02b2fd91f4e1285e18c2c7feb32d93b66f5 * AGNOS 12.4 (#35558) agnos12.4 --------- Co-authored-by: Vehicle Researcher <user@comma.ai> Co-authored-by: Maxime Desroches <desroches.maxime@gmail.com>
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
import unittest
|
|
from tinygrad import Device
|
|
from tinygrad.helpers import Timing, Profiling
|
|
|
|
class TestDeviceSpeed(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.dev = Device[Device.DEFAULT]
|
|
cls.empty = Device[Device.DEFAULT].renderer.render([])
|
|
|
|
def test_empty_compile(self):
|
|
with Timing("compiler "):
|
|
self.dev.compiler.compile(self.empty)
|
|
|
|
def test_empty_compile_twice(self):
|
|
self.dev.compiler.compile(self.empty)
|
|
with Timing("compiler "):
|
|
self.dev.compiler.compile(self.empty)
|
|
|
|
def test_launch_speed(self):
|
|
prg_bin = self.dev.compiler.compile(self.empty)
|
|
prg = self.dev.runtime("test", prg_bin)
|
|
for _ in range(10): prg() # ignore first launches
|
|
with Timing("launch 1000x "):
|
|
for _ in range(1000): prg()
|
|
with Timing("launch 1000x with wait "):
|
|
for _ in range(1000): prg(wait=True)
|
|
|
|
def test_profile_launch_speed(self):
|
|
prg_bin = self.dev.compiler.compile(self.empty)
|
|
prg = self.dev.runtime("test", prg_bin)
|
|
for _ in range(10): prg() # ignore first launches
|
|
with Profiling():
|
|
for _ in range(1000): prg()
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|