suppress_finalizing in hip (#14189)

This commit is contained in:
Christopher Milan
2026-01-16 15:56:29 -08:00
committed by GitHub
parent 9302ab003a
commit 3960e2758c

View File

@@ -1,5 +1,5 @@
import ctypes, functools
from tinygrad.helpers import mv_address, getenv
from tinygrad.helpers import mv_address, getenv, suppress_finalizing
from tinygrad.device import Compiled, LRUAllocator, BufferSpec, CompilerSet, CompilerPair
from tinygrad.runtime.autogen import hip
from tinygrad.renderer.cstyle import HIPRenderer
@@ -28,6 +28,7 @@ class HIPProgram:
self.module = init_c_var(hip.hipModule_t, lambda x: check(hip.hipModuleLoadData(ctypes.byref(x), lib)))
self.prg = init_c_var(hip.hipFunction_t, lambda x: check(hip.hipModuleGetFunction(ctypes.byref(x), self.module, name.encode("utf-8"))))
@suppress_finalizing
def __del__(self):
if hasattr(self, 'module'): check(hip.hipModuleUnload(self.module))