forked from tinygrad/tinygrad
raise CompileError in metal if newLibraryWithSource_options_error_ fails (#4695)
This commit is contained in:
@@ -3,7 +3,7 @@ import os, subprocess, pathlib, ctypes, tempfile, functools
|
||||
import Metal, libdispatch
|
||||
from typing import List, Set, Any, Tuple, Optional
|
||||
from tinygrad.helpers import prod, getenv, DEBUG, unwrap2
|
||||
from tinygrad.device import Compiled, Compiler, LRUAllocator
|
||||
from tinygrad.device import Compiled, Compiler, CompileError, LRUAllocator
|
||||
from tinygrad.renderer.cstyle import MetalRenderer
|
||||
|
||||
def wait_check(cbuf: Any):
|
||||
@@ -23,7 +23,8 @@ class MetalCompiler(Compiler):
|
||||
else:
|
||||
options = Metal.MTLCompileOptions.new()
|
||||
options.setFastMathEnabled_(getenv("METAL_FAST_MATH"))
|
||||
library = unwrap2(self.device.device.newLibraryWithSource_options_error_(src, options, None))
|
||||
try: library = unwrap2(self.device.device.newLibraryWithSource_options_error_(src, options, None))
|
||||
except AssertionError as e: raise CompileError(e)
|
||||
return library.libraryDataContents().bytes().tobytes()
|
||||
|
||||
class MetalProgram:
|
||||
|
||||
Reference in New Issue
Block a user