refactor comparison. there's a bug in the method cache

This commit is contained in:
George Hotz
2023-03-02 10:10:16 -08:00
parent 11f257ddf9
commit 0335cb86b9
10 changed files with 41 additions and 35 deletions

View File

@@ -56,6 +56,7 @@ class CLImage(RawBuffer):
def __del__(self): GlobalCounters.mem_used -= self._cl.row_pitch * self._cl.height
@functools.lru_cache(maxsize=None)
class CLProgram:
def __init__(self, name:str, prg:str, binary=False, argdtypes=None):
self.name, self.argdtypes, self.clprogram = name, argdtypes, cl.Program(CL.cl_ctx, CL.cl_ctx.devices, [prg]) if binary else cl.Program(CL.cl_ctx, prg) # type: ignore