From 9c6850fc012e21998d8570845fd99610073174ec Mon Sep 17 00:00:00 2001 From: Christopher Milan Date: Mon, 29 Dec 2025 12:56:17 -0800 Subject: [PATCH] remove try-catches on llvm import (#13883) --- tinygrad/runtime/support/compiler_cpu.py | 3 +-- tinygrad/runtime/support/compiler_mesa.py | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/tinygrad/runtime/support/compiler_cpu.py b/tinygrad/runtime/support/compiler_cpu.py index fc57930ddc..8b11f3af8e 100644 --- a/tinygrad/runtime/support/compiler_cpu.py +++ b/tinygrad/runtime/support/compiler_cpu.py @@ -2,8 +2,7 @@ import ctypes, platform, sys, subprocess from tinygrad.device import Compiler from tinygrad.helpers import OSX, getenv, capstone_flatdump, DEBUG, unwrap from tinygrad.runtime.support.elf import jit_loader -try: from tinygrad.runtime.autogen import llvm -except (ImportError, FileNotFoundError): llvm = None #type:ignore[assignment] +from tinygrad.runtime.autogen import llvm class ClangJITCompiler(Compiler): def __init__(self, cachekey="compile_clang_jit"): super().__init__(cachekey) diff --git a/tinygrad/runtime/support/compiler_mesa.py b/tinygrad/runtime/support/compiler_mesa.py index 015517baaf..204867ca74 100644 --- a/tinygrad/runtime/support/compiler_mesa.py +++ b/tinygrad/runtime/support/compiler_mesa.py @@ -1,10 +1,8 @@ import base64, ctypes, pathlib, tempfile, hashlib, sys from tinygrad.device import Compiler from tinygrad.helpers import cpu_objdump, system, data64 -from tinygrad.runtime.autogen import mesa +from tinygrad.runtime.autogen import mesa, llvm from tinygrad.runtime.support.compiler_cpu import CPULLVMCompiler, expect, cerr -try: from tinygrad.runtime.autogen import llvm -except (ImportError, FileNotFoundError): llvm = None #type:ignore[assignment] # NB: compilers assume mesa's glsl type cache is managed externally with mesa.glsl_type_singleton_init_or_ref() and mesa.glsl_type_singleton_decref()