From 159ee044898886ecb445e75cfff03b6a2893d160 Mon Sep 17 00:00:00 2001 From: nimlgen <138685161+nimlgen@users.noreply.github.com> Date: Fri, 11 Oct 2024 01:10:51 +0300 Subject: [PATCH] include qcom in view_supported_devices (#6985) * include qcom in view_supported_devices * ignore images --- tinygrad/engine/lazy.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tinygrad/engine/lazy.py b/tinygrad/engine/lazy.py index 6a9a155709..3868dccf7d 100644 --- a/tinygrad/engine/lazy.py +++ b/tinygrad/engine/lazy.py @@ -1,6 +1,6 @@ from __future__ import annotations from typing import Union, Optional, Any, Tuple, List, get_args -from tinygrad.dtype import dtypes, DType, ConstType, to_dtype +from tinygrad.dtype import dtypes, DType, ConstType, to_dtype, ImageDType from tinygrad.helpers import prod, getenv, all_int, all_same, DEBUG, _METADATA, Metadata, SPLIT_REDUCEOP from tinygrad.ops import MetaOps, UnaryOps, BinaryOps, TernaryOps, ReduceOps, Op, exec_alu, python_alu, REDUCE_ALU from tinygrad.ops import identity_element, MathTrait, resolve, UOp @@ -23,7 +23,7 @@ def create_lazybuffer(device:str, st:ShapeTracker, dtype:DType, op:Optional[Op]= if enable_cache: lazycache[cache_key] = ret return ret -view_supported_devices = {"LLVM", "CLANG", "CUDA", "NV", "AMD", "METAL", "DSP", "DISK"} +view_supported_devices = {"LLVM", "CLANG", "CUDA", "NV", "AMD", "METAL", "QCOM", "DSP", "DISK"} class LazyBuffer(MathTrait): def __init__(self, device:str, st:ShapeTracker, dtype:DType, op:Optional[Op]=None, arg:Any=None, srcs:Tuple[LazyBuffer, ...]=(), @@ -83,7 +83,9 @@ class LazyBuffer(MathTrait): assert x.size == self.size, f"assign target must have same size {self.size=} != {x.size=}" return LazyBuffer.metaop(MetaOps.ASSIGN, self.shape, self.dtype, self.device, arg=() if self.st.contiguous else (self.st,), src=(x, self.base)) - def can_view(self): return self.st.consecutive and not self.is_unrealized_const() and self.device.split(":")[0] in view_supported_devices + def can_view(self): + return (self.st.consecutive and not self.is_unrealized_const() and not isinstance(self.dtype, ImageDType) and + self.device.split(":")[0] in view_supported_devices) def contiguous(self, allow_buffer_view=True): if not self.st.contiguous or self.size != self.base.size or self.is_unrealized_const():