Skip to content

build: update pmetal bindings to MLX 0.32 - #360

Draft
ilblackdragon wants to merge 17 commits into
oxiglade:mainfrom
ilblackdragon:perf/mlx-032-laguna
Draft

build: update pmetal bindings to MLX 0.32#360
ilblackdragon wants to merge 17 commits into
oxiglade:mainfrom
ilblackdragon:perf/mlx-032-laguna

Conversation

@ilblackdragon

Copy link
Copy Markdown

Summary

  • advance the published pmetal binding lineage from MLX 0.30.6 to official MLX 0.32.0
  • preserve mlx-c 0.5 ABI while supplying MLX 0.32 FFT-normalization and quantization global-scale defaults
  • make implicit Rust RNG state thread-local to match MLX 0.32 thread-affine streams
  • add a cross-thread regression test for leaked RNG stream handles

The branch is based on the commits used to publish pmetal-mlx-rs 0.25.8 / pmetal-mlx-sys 0.2.4, which are newer than the current default branch.

Validation

  • cargo test -p pmetal-mlx-rs random::tests:: -- --test-threads=1 (32 passed)
  • downstream HoloNear MLX backend suite (550 passed, 23 ignored)
  • confirmed staged native source fetches exact tag v0.32.0

nicholasjpaterno and others added 17 commits February 28, 2026 16:50
- Patch MLX device.cpp via FetchContent PATCH_COMMAND to check
  PMETAL_METALLIB_PATH env var and ~/.cache/pmetal/lib/ before
  existing fallback chain
- Stage mlx-c source to OUT_DIR before cmake to avoid modifying
  the git submodule
- Auto-cache mlx.metallib to ~/.cache/pmetal/lib/ during build
  (critical for cargo install where build dir is cleaned up)
- Bump pmetal-mlx-sys to 0.2.2, pmetal-mlx-rs to 0.25.5
Cargo defaults MACOSX_DEPLOYMENT_TARGET to 10.13 which causes the
cmake crate to inject -mmacosx-version-min=10.13 into CFLAGS. MLX's
CMakeLists.txt then rejects the build with "MLX requires macOS >= 14.0".

Set MACOSX_DEPLOYMENT_TARGET and CMAKE_OSX_DEPLOYMENT_TARGET to 14.0
(or user override) before cmake runs. Fixes builds from Tauri and
other frameworks that don't set their own deployment target.

Bumps pmetal-mlx-sys 0.2.2 → 0.2.3, pmetal-mlx-rs 0.25.5 → 0.25.6.
resolve_deployment_target() now enforces a floor of 14.0 instead of
blindly using MACOSX_DEPLOYMENT_TARGET. Cargo/Tauri default this to
10.13 which MLX's CMakeLists.txt rejects. Higher values (e.g. 15.0)
are preserved.

Bumps pmetal-mlx-sys 0.2.3 → 0.2.4, pmetal-mlx-rs 0.25.6 → 0.25.7.
Add mlx_rs::memory module wrapping mlx_sys FFI calls for:
- get_active_memory, get_peak_memory, get_cache_memory
- get_memory_limit, set_memory_limit
- set_cache_limit, set_wired_limit
- clear_cache, reset_peak_memory

Bump version to 0.25.8.
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