Skip to content

Fix irregular_strides benchmark shape type#2754

Merged
awni merged 1 commit intoml-explore:mainfrom
wrmsr:wrmsr_20251111_irregular_strides_benchmark_shape
Nov 11, 2025
Merged

Fix irregular_strides benchmark shape type#2754
awni merged 1 commit intoml-explore:mainfrom
wrmsr:wrmsr_20251111_irregular_strides_benchmark_shape

Conversation

@wrmsr
Copy link
Copy Markdown
Contributor

@wrmsr wrmsr commented Nov 11, 2025

Proposed changes

#2454 changed shapes to SmallVector which broke this benchmark:

/Users/spinlock/src/ml-explore/mlx/benchmarks/cpp/irregular_strides.cpp:79:12: error: no matching function for call to 'uniform'
   79 |   auto a = mx::random::uniform(shape);
      |            ^~~~~~~~~~~~~~~~~~~
/Users/spinlock/src/ml-explore/mlx/mlx/random.h:88:14: note: candidate function not viable: no known conversion from 'std::vector<int>' to 'const Shape' (aka 'const SmallVector<int>') for 1st argument
   88 | inline array uniform(
      |              ^
   89 |     const Shape& shape,
      |     ~~~~~~~~~~~~~~~~~~

I saw #2493 added some std::vector interop but it also says shapes are always SmallVectors.

Would auto shape = mx::Shape{...}; be preferred?

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)

Copy link
Copy Markdown
Member

@awni awni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing that!

@awni awni merged commit 3fe2250 into ml-explore:main Nov 11, 2025
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.

2 participants