PoC UnaryOps before expand (#3319)

* PoC cast before expand

* maybe also do unaryops before expand?

* undo unaryops change
This commit is contained in:
David Hou
2024-02-06 19:05:13 -08:00
committed by GitHub
parent d9ef8e25b3
commit 6478ee5c75

View File

@@ -70,6 +70,7 @@ class LazyBuffer:
def cast(self, dtype:DType, bitcast:bool=False):
if self.dtype == dtype: return self
if dtype.itemsize <= self.dtype.itemsize and self != self.base: return self.base.cast(dtype, bitcast)._view(self.st)
return create_lazybuffer(self.device, ShapeTracker.from_shape(self.shape), dtype, UnaryOps.CAST, (dtype, bitcast), (self,))
def is_unrealized_const(self): return not self.base.realized and self.base.op is LoadOps.CONST