Skip to content

fix: support 64-bit eye on GPU - #4301

Open
aaishwarymishra wants to merge 1 commit into
ml-explore:mainfrom
aaishwarymishra:eye-bug
Open

fix: support 64-bit eye on GPU#4301
aaishwarymishra wants to merge 1 commit into
ml-explore:mainfrom
aaishwarymishra:eye-bug

Conversation

@aaishwarymishra

@aaishwarymishra aaishwarymishra commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

Please include a description of the problem or feature this PR is addressing. If there is a corresponding issue, include the issue #.
This pull request updates the eye function to improve support for 64-bit data types and adds corresponding tests to ensure correct behavior. The main changes include handling for 64-bit integer types in the implementation and new test cases for these types.

Enhanced dtype support:

  • Updated the eye function in mlx/ops.cpp to handle 64-bit data types by constructing the eye matrix as float32 and then converting it to the requested 64-bit type. This ensures compatibility with int64 and uint64 dtypes.

Testing improvements:

  • Added test cases in python/tests/test_ops.py to verify that mx.eye correctly returns arrays of int64 and uint64 dtypes.

closes #4300

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] mlx.core.eye fails on the Metal GPU when an 8-byte dtype such as mlx.core.int64 or mlx.core.uint64

1 participant