From 7930c6ab5cadd5047fa6aa7da607cfce3312acc4 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Sun, 5 Mar 2023 16:32:05 -0800 Subject: [PATCH] CLImage backing bug + test_vec_mul --- test/test_specific_conv.py | 3 ++- tinygrad/runtime/ops_gpu.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_specific_conv.py b/test/test_specific_conv.py index 678ad6fe67..84fc7e6009 100644 --- a/test/test_specific_conv.py +++ b/test/test_specific_conv.py @@ -10,7 +10,8 @@ class TestSpecific(unittest.TestCase): x.conv2d(w).permute(0,2,3,1).reshape(32, 384, 4).contiguous().realize() def test_vec_mul(self): - x = Tensor.randn(1, 2048) + # this forces it to be an image... + x = Tensor.ones(1, 512, 4).contiguous().reshape(1, 2048) w = Tensor.randn(2048, 512) (x @ w).reshape(1, 128, 4).contiguous().realize() diff --git a/tinygrad/runtime/ops_gpu.py b/tinygrad/runtime/ops_gpu.py index 38a0558cd1..6c84e4f199 100644 --- a/tinygrad/runtime/ops_gpu.py +++ b/tinygrad/runtime/ops_gpu.py @@ -25,7 +25,7 @@ class _CL: def cl_queue(self) -> cl.CommandQueue: return cl.CommandQueue(CL.cl_ctx, properties=cl.command_queue_properties.PROFILING_ENABLE) # this is an in-order command queue CL = _CL() - + class CLBuffer(RawBufferCopyInOut): # TODO: this can be in RawBuffer generically BUFFER_CACHE : ClassVar[Dict[int, List[cl.Buffer]]] = defaultdict(list) @@ -97,7 +97,7 @@ class GPUBuffer(CompiledBuffer): # override this method for image @classmethod def create_raw_buffer(cls, shape, backing) -> RawBuffer: - if len(shape) == 3 and shape[2] == 4 and IMAGE >= 2 and not backing: return CLImage(shape) + if len(shape) == 3 and shape[2] == 4 and IMAGE >= 2 and backing is None: return CLImage(shape) else: return super().create_raw_buffer(shape, backing) codegen_type = CLCodegen runtime_type = CLProgram