remove unused to_struct [pr] (#13973)

This commit is contained in:
chenyu
2026-01-02 08:54:57 -05:00
committed by GitHub
parent ff7853a65a
commit fcbb896e05

View File

@@ -1,5 +1,5 @@
import subprocess, pathlib, struct, ctypes, tempfile, functools, contextlib, decimal, platform, sys
from tinygrad.helpers import prod, to_mv, getenv, round_up, cache_dir, init_c_struct_t, PROFILE, ProfileRangeEvent, cpu_profile, unwrap
from tinygrad.helpers import prod, to_mv, getenv, round_up, cache_dir, PROFILE, ProfileRangeEvent, cpu_profile, unwrap
import tinygrad.runtime.support.objc as objc
from tinygrad.device import Compiled, Compiler, CompileError, LRUAllocator, ProfileDeviceEvent, CompilerSet, CompilerPair
from tinygrad.renderer.cstyle import MetalRenderer
@@ -17,9 +17,6 @@ ctypes.CDLL("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics")
def to_ns_str(s: str): return ctypes.cast(objc.msg("stringWithUTF8String:")(metal.NSString._objc_class_, s.encode()), metal.NSString)
def from_ns_str(s): return bytes(objc.msg("UTF8String", ctypes.c_char_p)(s)).decode()
def to_struct(*t: int, _type: type[ctypes._SimpleCData] = ctypes.c_ulong):
return init_c_struct_t(tuple([(f"field{i}", _type) for i in range(len(t))]))(*t)
def wait_check(cbuf:metal.MTLCommandBuffer):
cbuf.waitUntilCompleted()
error_check(cbuf.error().retained())