Conversation
dcadeaf to
b4b2572
Compare
| let description = mlx_tostring(UnsafeMutableRawPointer(ptr))! | ||
| defer { mlx_free(description) } | ||
| return String(cString: mlx_string_data(description)) | ||
| } |
There was a problem hiding this comment.
These no longer take opaque pointers -- the callers can use the mlx_ functions directly and don't need helpers.
| // ctx is a +1 object, the array takes ownership | ||
| let ctx = mlx_vector_array_get(vector_array, index)! | ||
| var ctx = mlx_array_new() | ||
| mlx_vector_array_get(&ctx, vector_array, index) |
There was a problem hiding this comment.
99% of the changes in this PR are of this nature: adopt the new API
| MLXArray(mlx_zeros(shape.map { Int32($0) }, shape.count, T.dtype.cmlxDtype, stream.ctx)) | ||
| var result = mlx_array_new() | ||
| mlx_zeros(&result, shape.map { Int32($0) }, shape.count, T.dtype.cmlxDtype, stream.ctx) | ||
| return MLXArray(result) |
There was a problem hiding this comment.
This is a typical operation:
- create the result (
mlx_array_new()) - call the function (
mlx_zeros) - return the result, transfer ownership to it (
MLXArray(result))
| This comes from https://developer.apple.com/metal/cpp/ specifically: | ||
|
|
||
| - https://developer.apple.com/metal/cpp/files/metal-cpp_macOS14.2_iOS17.2.zip | ||
| - https://developer.apple.com/metal/cpp/files/metal-cpp_macOS15_iOS18-beta.zip |
There was a problem hiding this comment.
Picked up the current version of metal-cpp (per mlx requirements)
5d7cf03 to
dd0cc30
Compare
|
I'm a bit daunted by the size of the diff 😅 . I can peruse but (other than you inline comments) is there anything specific that would be good to have reviewed? |
It is mostly mechanical -- I was able to do a good chunk of the work with creative search and replace. The metal kernel code is the biggest change because the structure of the back end changed (and it is complicated anyway). It is big but mostly uninteresting. |
awni
left a comment
There was a problem hiding this comment.
Tests clear, LGTM. Thanks for getting this one done!!
Awesome, thanks for looking! I will merge and tag it in the morning. |
Adopt new API from ml-explore/mlx-c#38 and move to mlx v0.21.0 (just adopting API, not picking up new ops yet)
This is complete (now that mlx-c is tagged)