mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
raise CompileError in metal if newLibraryWithSource_options_error_ fails (#4695)
This commit is contained in:
parent
871a3292f4
commit
ce46a7e83f
1 changed files with 3 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue