Skip to content

update for mlx v0.30.6#353

Merged
davidkoski merged 6 commits intomainfrom
v0.30.6
Feb 10, 2026
Merged

update for mlx v0.30.6#353
davidkoski merged 6 commits intomainfrom
v0.30.6

Conversation

@davidkoski
Copy link
Collaborator

@davidkoski davidkoski commented Feb 6, 2026

Proposed changes

Update for mlx v0.30.6

- one new API that allows a caller to pass ownership of a buffer to MLX + manage lifetime (delayed until next release)

Note: this is waiting for tags on mlx-c and references a branch right now. Cmake builds expected to fail.

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)

@davidkoski davidkoski requested a review from awni February 6, 2026 19:14
@@ -3,9 +3,9 @@
#include <Cmlx/mlx-c-linalg.h>
#include <Cmlx/mlx-c-fast.h>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Automated generation of public headers for Xcode build. Changes are all just copies from mlx

/// - shape: shape of the data in the rawPointer
/// - dtype: data type
/// - finalizer: closure that will release the associated resource
public convenience init(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

New function, very exciting!

}

#if canImport(IOSurface)
func testIOSurface() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Test of new function -- hopefully this is guarded properly. This doesn't really compute anything of use but I can make sure it builds the way I expect and the logs show the calls are as expected.

C3CBF1832EAC22110029A645 /* MAINTENANCE.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = MAINTENANCE.md; path = ../MAINTENANCE.md; sourceTree = SOURCE_ROOT; };
C3CBF1842EAC22110029A645 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = SOURCE_ROOT; };
C3CBF1852EAC22110029A645 /* README.xcodeproj.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.xcodeproj.md; path = ../README.xcodeproj.md; sourceTree = SOURCE_ROOT; };
C3CBF1852EAC22110029A645 /* README.xcodeproj.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.xcodeproj.md; sourceTree = SOURCE_ROOT; };
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was a dangling ref before (harmless but annoying to see the red file).

guard limit >= 0 else { return false }
var previous: size_t = 0
let result = mlx_set_wired_limit(&previous, size_t(limit))
let result = evalLock.withLock {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@robertmsale FYI while debugging another issue I was looking at what this hits internally and it is not thread safe. I think we are ok anyway since this is inside the actor, but this is harmless and I like the documentation :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Aw man! I see that is the standard lock used elsewhere 😅 like at the bottom of Memory.swift for cache clearing. Thank you for pointing that one out!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't think of it either until I was looking at the code in mlx::core for something else. The old code wasn't guarded either :-)

/// - dtype: data type
/// - finalizer: closure that will release the associated resource
// TODO: disabled per issue on mlx side -- buffer enters residency set but
// not removed -- enable in next release. Also testIOSurface
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Specifically ml-explore/mlx#3108

@davidkoski
Copy link
Collaborator Author

@awni ready to go 🚀

Copy link
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.

LGTM!

@davidkoski davidkoski merged commit 6ba4827 into main Feb 10, 2026
7 checks passed
@davidkoski davidkoski deleted the v0.30.6 branch February 10, 2026 18:20
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.

3 participants