fix linter and force allocation on hostbuf
MODIFY
accel/llvm/ops_llvm.py
accel/llvm/ops_llvm.py
@@ -195,7 +195,7 @@ class LLVMBuffer(ExplicitExecAST):
k.process()
if DEBUG >= 2:
- print(ast)
+ print(k.ast)
print("old:", k.shapes)
print("old:", k.strides)
@@ -342,7 +342,7 @@ class LLVMBuffer(ExplicitExecAST):
phi.add_incoming(reduce_result, loop_exit[store_loop+1+i]._block)
# do the late ast
- result = ast_parse(loop_exit[store_loop], ast, store_loop, reduce_result=reduce_result)
+ result = ast_parse(loop_exit[store_loop], k.ast, store_loop, reduce_result=reduce_result)
# store result
builder = loop_exit[store_loop]

MODIFY
tinygrad/llops/ops_gpu.py
tinygrad/llops/ops_gpu.py
@@ -198,6 +198,7 @@ class GPUBuffer(ExplicitExecAST):
def __init__(self, shape:Union[ShapeTracker, Tuple[int, ...]], hostbuf:Optional[GPUBuffer]=None, backing:Optional[np.ndarray]=None):
super().__init__(shape, hostbuf)
+ if hostbuf is not None: hostbuf.cl # does the allocation, pylint: disable=W0104
self._buf : Optional[CLBuffer] = hostbuf._buf if hostbuf is not None else None
self._base_shape : Tuple[int, ...] = hostbuf._base_shape if hostbuf is not None else self.shape
self._backing : Optional[np.ndarray] = hostbuf._backing if hostbuf is not None else backing

MODIFY
tinygrad/ops.py
tinygrad/ops.py
@@ -118,7 +118,6 @@ class ASTKernel:
# create the buffer we are returning (as the same type as the input buffers) and add it as the first buffer
self.ret = type(self.bufs[0])(output_shape if output_shape else self.info.shape)
- self.ret.cl # does the allocation
self.bufs = [type(self.ret)(self.info.shape, hostbuf=self.ret)] + self.bufs
# check valid AST kernel

fix linter and force allocation on hostbuf