nv sync before free for binded commands (#4759)

* nv sync before free for binded commands

* shorter comment
This commit is contained in:
nimlgen 2024-05-28 20:49:29 +03:00 committed by GitHub
commit fe26d3fefe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -86,7 +86,9 @@ class NVCompiler(Compiler):
class HWQueue:
def __init__(self): self.q, self.binded_device, self.next_cmd_index = [], None, 0
def __del__(self):
if self.binded_device is not None: self.binded_device._gpu_free(self.hw_page)
if self.binded_device is not None:
self.binded_device.synchronize() # Synchronize to ensure the buffer is no longer in use.
self.binded_device._gpu_free(self.hw_page)
def ptr(self) -> int: return self.next_cmd_index