Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Rebind BatchKVCache offset instead of mutating in place. - #1848

Merged
zcbenz merged 1 commit into
ml-explore:mainfrom
gyanu2507:batch-kv-cache-rebind-offset
Sep 10, 2026
Merged

Rebind BatchKVCache offset instead of mutating in place.#1848
zcbenz merged 1 commit into
ml-explore:mainfrom
gyanu2507:batch-kv-cache-rebind-offset

Conversation

@gyanu2507

Copy link
Copy Markdown
Contributor

mx.array += updates the existing handle, so a model that captures cache.offset before update_and_fetch (gemma3n) RoPEs at the new value. Assign a new array so the captured handle stays frozen.

Fixes #1806

  • ☑️ I understand it is strictly prohibited to use AI to write PR description
  • AI usage disclosure:

mx.array += updates the existing handle, so a model that captures
cache.offset before update_and_fetch (gemma3n) RoPEs at the new
value. Assign a new array so the captured handle stays frozen.

Fixes ml-explore#1806
@zcbenz
zcbenz marked this pull request as ready for review September 10, 2026 10:42
@zcbenz
zcbenz merged commit 9b0063e into ml-explore:main Sep 10, 2026
2 checks passed
adurham pushed a commit to adurham/mlx-lm that referenced this pull request Sep 11, 2026
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.

BatchKVCache/BatchRotatingKVCache mutate offset in place, breaking gemma3n batched decode

2 participants