From 82a6160ff798afd3aef21db09e260a5533bfe86c Mon Sep 17 00:00:00 2001 From: uuuvn <83587632+uuuvn@users.noreply.github.com> Date: Fri, 9 May 2025 07:31:47 +0500 Subject: [PATCH] Detect metal paravirtualization bug via device name instead of CI (#10225) --- tinygrad/runtime/ops_metal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tinygrad/runtime/ops_metal.py b/tinygrad/runtime/ops_metal.py index c8bbfc72a4..5a8b5f1f32 100644 --- a/tinygrad/runtime/ops_metal.py +++ b/tinygrad/runtime/ops_metal.py @@ -1,6 +1,6 @@ import os, pathlib, struct, ctypes, tempfile, functools, contextlib, decimal, platform from typing import Any, Union, cast -from tinygrad.helpers import prod, to_mv, getenv, round_up, cache_dir, T, init_c_struct_t, PROFILE, CI +from tinygrad.helpers import prod, to_mv, getenv, round_up, cache_dir, T, init_c_struct_t, PROFILE from tinygrad.device import Compiled, Compiler, CompileError, LRUAllocator, cpu_profile, ProfileDeviceEvent, ProfileRangeEvent from tinygrad.renderer.cstyle import MetalRenderer @@ -76,7 +76,7 @@ class MetalDevice(Compiled): # NOTE: GitHub CI macOS runners use paravirtualized metal which is broken with graph. # This can be reproduced locally with any virtualization software (like utm) that can create macOS VMs with apple's own virtualization framework. super().__init__(device, MetalAllocator(self), MetalRenderer(), MetalCompiler() if getenv("METAL_DIRECT", 1) else Compiler(), - functools.partial(MetalProgram, self), MetalGraph if not CI else None) + functools.partial(MetalProgram, self), MetalGraph if 'virtual' not in from_ns_str(msg('name')(self.sysdevice)).lower() else None) def synchronize(self): for cbuf in self.mtl_buffers_in_flight: