Skip to content

[BUG] Metal scatter does not support 64bit dtype #4300

Closed

Description

@aaishwarymishra

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

Activity

  1. changed the title [-][BUG] `mlx.core.eye` fails on the Metal GPU when an 8-byte dtype such as `mlx.core.int64` or `mlx.core.uint64`[/-] [+][BUG] Metal scatter does not support 64bit dtype[/+] on Aug 17, 2026
  2. zcbenz commented on Aug 21, 2026

    @zcbenz
    Member

    I'm closing this as won't fix since it is mostly a restriction of Metal not support 64bit atomics. And it does not make sense adding workarounds for very minor cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions