Devotd Github
NewAI agents

generated-computers/locals — Preventing chunk copies via MLX cache buffer synchronization

A November 5, 2026 commit in generated-computers/locals fixed the problem where prompt chunks were written before the MLX cache buffer was emptied, causing the entire buffer to be copied.

Repositorygenerated-computers/locals ↗

A November 5, 2026 commit in generated-computers/locals fixed the problem where prompt chunks were written before the MLX cache buffer was emptied, causing the entire buffer to be copied.

GitHub description: Run many AI agents at once on your Mac, about three times faster.

stars
★ 26
Forks
0
Language
Python
License
MIT
Read original source ↗View on GitHub ↗

generated-computers/locals is a local execution tool whose repository description says 'run multiple AI agents on Mac at once, roughly 3x faster.' The November 5, 2026 commit 653394a fixed the problem where prompt chunks were written into a copy of the cache buffer.

The cause is MLX's buffer ownership model. mx.eval returns from the signal of the last command buffer, but the arrays read by the command buffer are later unlocked on another thread in MLX's completion handler. If a chunk writes to the cache buffer in the meantime, it is written into a full buffer copy whose address has changed, and after the GPU discards the chunk, _rewind refuses to read again from that point. The fix is short. _read_chunk in locals/hybrid_batch.py calls mx.synchronize once right before each attempt and waits until the buffer is emptied.

The wait time is about 30 microseconds and the prompt read speed is unchanged, according to the engine documentation (docs/engine/README.md). A test that imitates GPU drops caused by the macOS watchdog had originally been skipped on the original GitHub runner due to MLX buffer copies, but the skip constraint was removed in this commit and it runs again. The code that imitates the drop also synchronizes first, before breaking the buffer, and a new test was added that writes a chunk immediately after finishing eval.

All the numbers are values published in the project documentation. On an M2 Pro running 16 processes, when reading 13 chunks 60 times, 7-15 of them hit the copy, and without the mark it was 3-4 out of 60. After the wait it was 0 out of 600, and Qwen3.5-4B read 4,096 tokens in 256-token units at 576 tokens per second, the same before and after the wait. In the CHANGELOG this fix remains as not yet released in 0.2.3, and the previous version 0.2.2 was released on November 4, 2026. The license and the number of stars were not given. The scope is narrowly limited to the single buffer ownership race that appears on the Mac MLX path, and the basis for claiming that speed is maintained is only the developer's own measurement. Whether the same problem occurs in other GPU environments is difficult to judge from this material alone.