Describe the bug
mx.eye fails on the Metal GPU when an 8-byte dtype such as mx.int64 or mx.uint64 is requested. This happens because eye uses scatter internally, and Metal scatter does not support 8-byte output types.
To Reproduce
import mlx.core as mx
x = mx.eye(3, dtype=mx.int64)
mx.eval(x)
The operation fails with an error similar to:
[Scatter::eval_gpu] Does not support int64
The same issue occurs with mx.uint64.
Expected behavior
mx.eye should return an identity matrix with the requested dtype:
mx.array(
[[1, 0, 0],
[0, 1, 0],
[0, 0, 1]],
dtype=mx.int64,
)
Since eye only produces zeros and ones, it could safely construct the matrix using a scatter-supported dtype such as int32, then cast the result to the requested dtype without data loss.
Desktop (please complete the following information):
- OS Version: macOS 26.6.1
- MLX Version: 0.32.0
Describe the bug
mx.eyefails on the Metal GPU when an 8-byte dtype such asmx.int64ormx.uint64is requested. This happens becauseeyeusesscatterinternally, and Metal scatter does not support 8-byte output types.To Reproduce
The operation fails with an error similar to:
The same issue occurs with
mx.uint64.Expected behavior
mx.eyeshould return an identity matrix with the requested dtype:Since
eyeonly produces zeros and ones, it could safely construct the matrix using a scatter-supported dtype such asint32, then cast the result to the requested dtype without data loss.Desktop (please complete the following information):