mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-02-19 02:44:40 -05:00
get readable error from wait_check (#6965)
Co-authored-by: Mesozoic Egg <mesozoic.egg@proton.me>
This commit is contained in:
@@ -48,7 +48,7 @@ def to_struct(*t: int, _type: type = ctypes.c_ulong):
|
||||
|
||||
def wait_check(cbuf: Any):
|
||||
msg(cbuf, "waitUntilCompleted")
|
||||
if (error := cast(int, msg(cbuf, "error", restype=ctypes.c_ulong))) != 0: raise RuntimeError(error)
|
||||
error_check(msg(cbuf, "error", restype=objc_instance))
|
||||
|
||||
def elapsed_time(cbuf: objc_id):
|
||||
return cast(float, msg(cbuf, "GPUEndTime", restype=ctypes.c_double)) - cast(float, msg(cbuf, "GPUStartTime", restype=ctypes.c_double))
|
||||
|
||||
Reference in New Issue
Block a user