From 0e8bcda07e6806a9ffa13ef76c7d15b06792395e Mon Sep 17 00:00:00 2001 From: mesozoic-egg <133102390+mesozoic-egg@users.noreply.github.com> Date: Wed, 9 Oct 2024 22:28:58 +0800 Subject: [PATCH] get readable error from wait_check (#6965) Co-authored-by: Mesozoic Egg --- tinygrad/runtime/ops_metal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinygrad/runtime/ops_metal.py b/tinygrad/runtime/ops_metal.py index f900cf113d..4fbfad0321 100644 --- a/tinygrad/runtime/ops_metal.py +++ b/tinygrad/runtime/ops_metal.py @@ -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))