diff --git a/tinygrad/dtype.py b/tinygrad/dtype.py index 60ca8f8981..09d00bab0c 100644 --- a/tinygrad/dtype.py +++ b/tinygrad/dtype.py @@ -221,9 +221,9 @@ def can_safe_cast(dt0:DType, dt1:DType) -> bool: if dt0 == dt1 or dt0 == dtypes.bool: return True match dt1: case dtypes.index: return dt0 in dtypes.ints - case dtypes.double: return dt0 in (dtypes.float, dtypes.half, dtypes.bfloat16, + case dtypes.double: return dt0 in (dtypes.float, dtypes.half, dtypes.bfloat16, *dtypes.fp8s, dtypes.uint32, dtypes.uint16, dtypes.uint8, dtypes.int32, dtypes.int16, dtypes.int8) - case dtypes.float: return dt0 in (dtypes.half, dtypes.bfloat16, dtypes.uint16, dtypes.uint8, dtypes.int16, dtypes.int8) + case dtypes.float: return dt0 in (dtypes.half, dtypes.bfloat16, *dtypes.fp8s, dtypes.uint16, dtypes.uint8, dtypes.int16, dtypes.int8) case dtypes.uint64: return dt0 in (dtypes.uint32, dtypes.uint16, dtypes.uint8) case dtypes.uint32: return dt0 in (dtypes.uint16, dtypes.uint8) case dtypes.int64: return dt0 in (dtypes.uint32, dtypes.uint16, dtypes.uint8, dtypes.int32, dtypes.int16, dtypes.int8)