touchup cl_errors (#6058)

* touchup cl_errors

* update test
This commit is contained in:
chenyu
2024-08-13 13:06:59 -04:00
committed by GitHub
parent 9145ad52ff
commit e3af273fa1
2 changed files with 12 additions and 5 deletions

View File

@@ -9,7 +9,7 @@ from tinygrad.device import BufferOptions, LRUAllocator, Compiled, Compiler, Com
# see test/external/external_osx_profiling.py to determine this ratio. it's in like GPU clocks or something
OSX_TIMING_RATIO = (125/3) if OSX else 1.0
cl_errors = {getattr(cl, k): k for k in filter(lambda e: e.startswith("CL_"), dir(cl)) if getattr(cl, k) <= 0}
cl_errors = {attr: k for k in dir(cl) if k.startswith("CL_") and (attr:=getattr(cl, k)) <= 0}
def check(status):
if status != 0: raise RuntimeError(f"OpenCL Error {status}: {cl_errors.get(status, 'Unknown error')}")
def checked(ret, status): return (check(status.value), ret)[1]