Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added mlx::core::version() returning std::string(MLX_VERSION) #1819

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stemann
Copy link
Contributor

@stemann stemann commented Feb 1, 2025

Proposed changes

Added function for getting the MLX version built.

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)

@awni
Copy link
Member

awni commented Feb 2, 2025

Just curious, what do you use this for?

I'm not opposed to making the version available in the C++ API. I'm just wondering if we should make it a constexpr or a preprocessor macro so that it can be used at compile time as well. Either way it might be good to change the format to be a single number like MAJORMINORPATCH rather than MAJOR.MINOR.PATCH so it can easily be used in conditionals.

@stemann
Copy link
Contributor Author

stemann commented Feb 2, 2025

It’s mostly for convenience, e.g. for a user of MLX.jl (Julia),

  • where the user is using MLX.jl version X
  • dependent on MLX C version Y,
  • where MLX.jl has an indirect dependency via MLX C version Y on MLX version Z,

that the user can more easily check the version (Z - and Y would also be nice) - or write version dependent code (if that should be necessary) - without importing the Julia package manager (Pkg.jl) as a dependency.

@stemann
Copy link
Contributor Author

stemann commented Feb 2, 2025

Regarding the format, I was actually considering to do it like LibTorch, with separate identifiers for major, minor, and patch - in addition to the string version ("MAJOR.MINOR.PATCH") - and the numeric MAJORMINORPATCH.

It one puts the version in the CMake project, CMake should take care of splitting it up into major, minor, and patch.

@awni
Copy link
Member

awni commented Feb 3, 2025

I think that's a good idea! Those should be macros and can be used at compile time. I like their naming scheme also we could adapt to MLX. Do you want to do that in this diff?

@stemann
Copy link
Contributor Author

stemann commented Feb 3, 2025

I'll look into it :-)

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