hotfix: put that assign hack back

This commit is contained in:
George Hotz
2024-03-18 09:25:05 -07:00
parent 0183a05f0a
commit 7fe08fa5a0

View File

@@ -59,7 +59,10 @@ class LazyBuffer:
shape = self.shape if shape is None else shape
return LazyBuffer.loadop(LoadOps.CONST, tuple(), self.dtype, self.device, arg=cast_scalar(val, self.dtype)).reshape((1,)*len(shape)).expand(shape)
def assign(self, x:LazyBuffer) -> LazyBuffer: return LazyBuffer.loadop(LoadOps.ASSIGN, self.shape, self.dtype, self.device, src=(x, self))
def assign(self, x:LazyBuffer) -> LazyBuffer:
if self.base.realized is not None or self is not self.base: new_self = self
else: new_self = create_lazybuffer(self.device, self.st, self.dtype, self.op, self.arg, self.srcs, enable_cache=False)
return LazyBuffer.loadop(LoadOps.ASSIGN, self.shape, self.dtype, self.device, src=(x, new_self))
def contiguous(self):
if not self.st.contiguous or self.size != self.base.size or self.is_unrealized_const():
ret = self.e(LoadOps.CONTIGUOUS)