Merge upstream mlx-swift main into prism (15 commits; mlx-c fork retired)#5
Merged
Conversation
* break init order dependency - fix ml-explore#224 - lazily built _items and _setters after init is complete
* update for mlx 0.31.1 - clean up some build settings (c++ version, warnings) - set mlx version (see ml-explore#370 and ml-explore#373)
- fixes xcode 26.4 build issue - fixes ml-explore#375
* Implement L2 normalization extension for MLXArray Adds an extension method to MLXArray for L2 normalization.
- fix ml-explore#378 - save functions call eval internally and must be run under evalLock
* Add doc comment verification script and CI step * Fix doc comments * Discover doc verification targets dynamically and report all failures
…xplore#384) QuantizedLinear.init(weight:...) called MLX.quantized() without forwarding the mode parameter, so weights were always quantized as affine regardless of the specified mode. This produced spurious biases for non-affine modes like mxfp4. Fix: pass mode: mode to MLX.quantized(), matching QuantizedEmbedding which already does this correctly. Note: no updateMissing() override is needed — when biases is nil, Module.build(value:) wraps it as .value(.other(...)), and the (.value(.other(_)), .none) case in update() already breaks silently. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ml-explore#394) - this should cover _most_ cases - there is still ([MLXArray]) -> [MLXArray] as a fallback
* add missing functions - eig - eigenvalues and eigenvectors - eigh - eigenvalues/eigenvectors of symmetric/Hermitian matrix - eigvals - eigenvalues only - eigvalsh - eigenvalues of symmetric/Hermitian matrix - pinv - pseudo-inverse * add remaining functions: - logcumsumexp - segmentedMm (segmented_mm) - permutation - fftshift - ifftshift
…-explore#398) mlx_detail_compile and mlx_closure_apply both return int (0=success, 1=failure) but their return values were silently ignored. When an error fires inside a withError scope the MLX error handler stores the error in an ErrorBox instead of calling fatalError; execution then continues past the failed call, innerCall returns an empty result vector, and the single/two/three-array compile overloads crash with a Swift 'Index out of range' trap — bypassing withError entirely. Fix: capture both return values and early-return [] from innerCall on failure. The placeholder return from the compile overloads is never observed by the caller because withError throws before the value is used. Adds three regression tests covering the single-array, two-array, and [MLXArray]->[MLXArray] compile overloads.
* hold evalLock while computing tostring - tostring internally calls eval, which is not thread safe * remove show-sdk-version -- ci breakage
Brings in 15 upstream commits (compile overloads up to arity 8, AdamW bias correction, linalg nuclear norm, evalLock fixes, l2-normalized extension, fmt 12.1.0, doc CI). Resolution notes: - Source/Cmlx/mlx stays on the PrismML fork (1/2-bit Metal kernel stack). - Source/Cmlx/mlx-c moves to upstream 0.6.0 and the PrismML mlx-c fork is retired: upstream now passes std::nullopt for global_scale natively, so the one-patch fork and patches/mlx-c-global-scale-nullopt.patch are superseded (patch file removed). - include-framework vendored headers taken from upstream (0.31.1): every prism-side hand-edit (global_scale, global_scale_x/w) now exists natively. - NAX generated files taken from upstream (toolchain-path comment churn only). - 1/2-bit kernel content in mlx-generated/quantized.* verified intact (17 one-bit sites in both the JIT source and the metal mirror).
khosravipasha
approved these changes
Jun 11, 2026
khosravipasha
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Okay to merge for now.
Later on if our 1-bit kernels merge in mlx need to clean up this branch (and usually they make changes on mlx first and just pick up form that)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Merges upstream
ml-explore/mlx-swiftmainintoprism(15 commits): compile() overloadsup to arity 8, AdamW bias-correction parameter, linalg nuclear norm, evalLock fixes around
tostring/save_safetensors, l2-normalized array extension, fmt 12.1.0, doc-verification CI.
Done as a merge, not a rebase — deliberately: a cherry-pick/rebase replay of the prism
stack silently lost the 1-bit kernel content in the regenerated
mlx-generated/*mirrors(verified: 17
bits == 1sites dropped to 0 after a clean-looking pick). The 3-way mergekeeps the regenerated files correct, preserves history, and advances
prismby fast-forward.Resolution policy
Source/Cmlx/mlx— stays on the PrismML fork (d90771c): the 1/2-bit Metal kernelstack lives there, and it is already a strict superset of upstream's pin (
ce45c52,54 ahead / 0 behind).
Source/Cmlx/mlx-c— moves to upstream 0.6.0 and the PrismML mlx-c fork is retired:upstream now passes
std::nulloptforglobal_scalenatively, so the one-patch fork andpatches/mlx-c-global-scale-nullopt.patchare superseded (patch removed,.gitmodulesback to
ml-explore/mlx-c).include-frameworkvendored headers — upstream (0.31.1): every prism hand-edit(
global_scale,global_scale_x/w) now exists natively; ours were stale 0.30.7.mlx-generated/quantized.*verified intact post-merge(17 one-bit sites in both the JIT source and the metal mirror).
Deferred
.github/workflows/pull_request.ymlis kept at the current prism version (upstream's CItweak deferred) — pushing workflow-file changes needs a
workflow-scoped token; can followas a trivial commit once pushed from a scoped session.
Verification (M5, xcodebuild → real metallib)
Metal, not stubbed)
swift buildclean (known FMT_CONSTEVAL warning only)