Skip to content

[Temporary Workaround] Fix pipelined sampling corruption: use per-call execution descriptor#121

Merged
stikves merged 1 commit into
apple:mainfrom
stikves:fix/pipelined-sampler-corruption
Jul 22, 2026
Merged

[Temporary Workaround] Fix pipelined sampling corruption: use per-call execution descriptor#121
stikves merged 1 commit into
apple:mainfrom
stikves:fix/pipelined-sampler-corruption

Conversation

@stikves

@stikves stikves commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

The MPSGraphCompositeSampler reused a single
MPSGraphExecutableExecutionDescriptor across all pipelined steps. Under pipelined execution (depth > 1), overlapping runAsync calls on the same executable corrupt intermediate scratch buffers when sharing a descriptor, producing garbled output (word repetitions, doubled punctuation) with temperature > 0.

Create a fresh descriptor per encode() call, matching the pattern MPSGraphArgmaxSampler already uses.

@stikves
stikves force-pushed the fix/pipelined-sampler-corruption branch from a40e4f6 to d59a574 Compare July 22, 2026 03:24
The MPSGraphCompositeSampler reused a single
MPSGraphExecutableExecutionDescriptor across all pipelined steps.
Under pipelined execution (depth > 1), overlapping runAsync calls
on the same executable corrupt intermediate scratch buffers when
sharing a descriptor, producing garbled output (word repetitions,
doubled punctuation) with temperature > 0.

Create a fresh descriptor per encode() call, matching the pattern
MPSGraphArgmaxSampler already uses.
@stikves
stikves force-pushed the fix/pipelined-sampler-corruption branch from d59a574 to d665c19 Compare July 22, 2026 03:25
@stikves
stikves marked this pull request as ready for review July 22, 2026 14:41
@stikves stikves changed the title Fix pipelined sampling corruption: use per-call execution descriptor [Temporary Workaround] Fix pipelined sampling corruption: use per-call execution descriptor Jul 22, 2026
@stikves
stikves merged commit aff0bb2 into apple:main Jul 22, 2026
3 checks passed
@stikves
stikves deleted the fix/pipelined-sampler-corruption branch July 22, 2026 17:23
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