mirror of https://github.com/commaai/tinygrad.git
faster program start in llvm (#3897)
This commit is contained in:
parent
46a3501cec
commit
4e18dd78d3
|
@ -27,7 +27,8 @@ class LLVMProgram:
|
||||||
self.fxn = device.engine.get_function_address(name)
|
self.fxn = device.engine.get_function_address(name)
|
||||||
|
|
||||||
def __call__(self, *bufs, vals:Tuple[int, ...]=(), wait=False):
|
def __call__(self, *bufs, vals:Tuple[int, ...]=(), wait=False):
|
||||||
self.cfunc = ctypes.CFUNCTYPE(ctypes.c_int, *([ctypes.c_void_p]*len(bufs)), *([ctypes.c_int32]*len(vals)))(self.fxn)
|
if not hasattr(self, 'cfunc'):
|
||||||
|
self.cfunc = ctypes.CFUNCTYPE(ctypes.c_int, *([ctypes.c_void_p]*len(bufs)), *([ctypes.c_int32]*len(vals)))(self.fxn)
|
||||||
return cpu_time_execution(lambda: self.cfunc(*bufs, *vals), enable=wait)
|
return cpu_time_execution(lambda: self.cfunc(*bufs, *vals), enable=wait)
|
||||||
|
|
||||||
class LLVMDevice(Compiled):
|
class LLVMDevice(Compiled):
|
||||||
|
|
Loading…
Reference in New Issue