[PR #15845] [MERGED] Update MLX and MLX-C with threading fixes #77619

Closed
opened 2026-05-05 10:17:33 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15845
Author: @dhiltgen
Created: 4/27/2026
Status: Merged
Merged: 5/3/2026
Merged by: @dhiltgen

Base: mainHead: mlx-bump-threading


📝 Commits (5)

  • 2914549 Update MLX and MLX-C
  • 8517013 Run MLX CGO work on a locked OS thread
  • 20db72d mlx: use common status writer
  • 864b2c2 mlx: bundle missing libjaccl on arm64
  • 524bc22 review comments

📊 Changes

29 files changed (+2119 additions, -276 deletions)

View changed files

📝 CMakeLists.txt (+8 -0)
📝 MLX_C_VERSION (+1 -1)
📝 MLX_VERSION (+1 -1)
📝 llm/status.go (+17 -6)
📝 llm/status_test.go (+42 -18)
📝 scripts/build_darwin.sh (+4 -2)
📝 x/imagegen/mlx/mlx.c (+339 -49)
📝 x/imagegen/mlx/mlx.h (+146 -30)
x/internal/mlxthread/thread.go (+183 -0)
x/internal/mlxthread/thread_affinity_test.go (+32 -0)
x/internal/mlxthread/thread_test.go (+351 -0)
x/internal/mlxthread/threadid_darwin_test.go (+10 -0)
x/internal/mlxthread/threadid_linux_test.go (+9 -0)
📝 x/mlxrunner/client.go (+6 -62)
📝 x/mlxrunner/mlx/array_test.go (+30 -39)
📝 x/mlxrunner/mlx/generated.c (+158 -5)
📝 x/mlxrunner/mlx/generated.h (+391 -25)
📝 x/mlxrunner/mlx/include/mlx/c/compile.h (+1 -0)
📝 x/mlxrunner/mlx/include/mlx/c/distributed_group.h (+23 -9)
📝 x/mlxrunner/mlx/include/mlx/c/fft.h (+20 -0)

...and 9 more files

📄 Description

MLX now relies on OS-thread-local execution state for streams, encoders, and caches. Add an mlxthread executor backed by runtime.LockOSThread and route runner initialization, model load, inference, status memory reads, and cleanup through the worker so Go goroutine migration cannot split MLX state across native threads.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15845 **Author:** [@dhiltgen](https://github.com/dhiltgen) **Created:** 4/27/2026 **Status:** ✅ Merged **Merged:** 5/3/2026 **Merged by:** [@dhiltgen](https://github.com/dhiltgen) **Base:** `main` ← **Head:** `mlx-bump-threading` --- ### 📝 Commits (5) - [`2914549`](https://github.com/ollama/ollama/commit/291454953decc5884d7243830ad8ded24355fc67) Update MLX and MLX-C - [`8517013`](https://github.com/ollama/ollama/commit/85170131e8a21196d21a2ea6963512faf1a4c684) Run MLX CGO work on a locked OS thread - [`20db72d`](https://github.com/ollama/ollama/commit/20db72d14247f524a0877c5796b5adf91eeccd07) mlx: use common status writer - [`864b2c2`](https://github.com/ollama/ollama/commit/864b2c2e6c625df2ce0c8e641285432a2a489c95) mlx: bundle missing libjaccl on arm64 - [`524bc22`](https://github.com/ollama/ollama/commit/524bc223767a00b065eae582068351084126767a) review comments ### 📊 Changes **29 files changed** (+2119 additions, -276 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+8 -0) 📝 `MLX_C_VERSION` (+1 -1) 📝 `MLX_VERSION` (+1 -1) 📝 `llm/status.go` (+17 -6) 📝 `llm/status_test.go` (+42 -18) 📝 `scripts/build_darwin.sh` (+4 -2) 📝 `x/imagegen/mlx/mlx.c` (+339 -49) 📝 `x/imagegen/mlx/mlx.h` (+146 -30) ➕ `x/internal/mlxthread/thread.go` (+183 -0) ➕ `x/internal/mlxthread/thread_affinity_test.go` (+32 -0) ➕ `x/internal/mlxthread/thread_test.go` (+351 -0) ➕ `x/internal/mlxthread/threadid_darwin_test.go` (+10 -0) ➕ `x/internal/mlxthread/threadid_linux_test.go` (+9 -0) 📝 `x/mlxrunner/client.go` (+6 -62) 📝 `x/mlxrunner/mlx/array_test.go` (+30 -39) 📝 `x/mlxrunner/mlx/generated.c` (+158 -5) 📝 `x/mlxrunner/mlx/generated.h` (+391 -25) 📝 `x/mlxrunner/mlx/include/mlx/c/compile.h` (+1 -0) 📝 `x/mlxrunner/mlx/include/mlx/c/distributed_group.h` (+23 -9) 📝 `x/mlxrunner/mlx/include/mlx/c/fft.h` (+20 -0) _...and 9 more files_ </details> ### 📄 Description MLX now relies on OS-thread-local execution state for streams, encoders, and caches. Add an mlxthread executor backed by runtime.LockOSThread and route runner initialization, model load, inference, status memory reads, and cleanup through the worker so Go goroutine migration cannot split MLX state across native threads. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 10:17:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#77619