compiler support (#3260)

* compiler support

* revert that

* fix tests
This commit is contained in:
George Hotz
2024-01-26 23:36:40 -08:00
committed by GitHub
parent 4273aabe31
commit 3c728d1082
14 changed files with 137 additions and 99 deletions

View File

@@ -8,19 +8,19 @@ class TestDeviceSpeed(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.dev = Device[Device.DEFAULT]
cls.empty = Device[Device.DEFAULT].renderer("test", [])
cls.empty = Device[Device.DEFAULT].compiler.render("test", [])
def test_empty_compile(self):
with Timing("compiler "):
self.dev.compiler(self.empty)
self.dev.compiler.compile(self.empty)
def test_empty_compile_twice(self):
self.dev.compiler(self.empty)
self.dev.compiler.compile(self.empty)
with Timing("compiler "):
self.dev.compiler(self.empty)
self.dev.compiler.compile(self.empty)
def test_launch_speed(self):
prg_bin = self.dev.compiler(self.empty)
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 "):
@@ -29,7 +29,7 @@ class TestDeviceSpeed(unittest.TestCase):
for _ in range(1000): prg(wait=True)
def test_profile_launch_speed(self):
prg_bin = self.dev.compiler(self.empty)
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():