symbolic_simple does this cast folding now [pr] (#8422)

This commit is contained in:
qazal
2024-12-26 17:16:21 +02:00
committed by GitHub
parent 9defbc7d54
commit 22abd9dc03

View File

@@ -345,7 +345,6 @@ class UOp(MathTrait, metaclass=UOpMetaClass):
if count == 1: return self
return UOp(Ops.VECTORIZE, self.dtype.vec(count), (self,)*count)
def cast(self, dtype:DType, bitcast=False, allow_buffer_view=True):
if self.dtype == dtype: return self # TODO: move this to the scheduler
if bitcast: return self.bitcast(dtype, allow_buffer_view)
if self._device is not None and self._device.startswith("DISK"): raise RuntimeError("CAST isn't supported on DISK")
if getenv("CAST_BEFORE_VIEW", 1) and dtype.itemsize <= self.dtype.itemsize and self is not self.base: