Skip to content

Odds and ends: memory controls, contiguous, optional rms_norm weight - #367

Merged
dcvz merged 4 commits into
mainfrom
mlx-rs-odds-ends
Sep 1, 2026
Merged

Odds and ends: memory controls, contiguous, optional rms_norm weight#367
dcvz merged 4 commits into
mainfrom
mlx-rs-odds-ends

Conversation

@dcvz

@dcvz dcvz commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Closes the pre-bump feature gaps flagged by community PRs, through the conformance pipeline:

  • mlx_rs::memory — the complete 9-function allocator family (active/cache/peak observations, clear_cache, reset_peak, memory/cache/wired limits; setters return the previous value like the C API). Serial RAII-restoring integration tests; no oracle corpus since the figures are machine-dependent. Supersedes feat: add memory::set_memory_limit and memory::get_memory_limit #346, thanks @dschulmeist.
  • Array::contiguous() + ContiguousOptions — row-major materialization, and AsSliceError::NotContiguous finally points at a concrete remedy. Exact-bit conformance cases over transposed/sliced/broadcast views incl. signed zero and fixed NaN payloads. Supersedes the op half of feat: add contiguity check, contiguous() op, and core fixes #326, thanks @ymote.
  • fast::rms_norm(x, weight: Option<&Array>, eps) — genuine absence (C passes the empty handle), nn::RmsNorm unchanged as weighted. New fast conformance suite with None/weighted/wrong-shape cases + mutations. Supersedes fast::rms_norm: accept Option<&Array> for weight #347, thanks @Ogilthorp3.
  • Shifts (feat: add element-wise left_shift and right_shift ops #345) deliberately NOT shipped: MLX 0.32.2 performs no shift-count validation and both backends use literal C++ shift operators — invalid counts are UB and the observed behavior is inconsistent across dtypes (int32 wraps the count mod width, uint8 truncates). Blessing that into a typed API would freeze a backend accident. Designed, recorded in ROADMAP.md, blocked on upstream defining the behavior (report drafted).

Evidence: full suite 1080/0, FFI leak gate pass (0 bytes, memory test binary included), verify-ledger + verify-oracle-boundary pass, API baseline blessed.

🤖 Generated with Claude Code

@dcvz
dcvz marked this pull request as ready for review September 1, 2026 05:12
@dcvz
dcvz merged commit 04a722b into main Sep 1, 2026
4 checks passed
@dcvz
dcvz deleted the mlx-rs-odds-ends branch September 1, 2026 05:13
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.

1 participant