Skip to content

Add this in read me - #261

Closed
RiverIsAMovingBodyOfWater wants to merge 41 commits into
ggml-org:masterfrom
antimatter15:master
Closed

RiverIsAMovingBodyOfWater wants to merge 41 commits into
ggml-org:masterfrom
antimatter15:master

Conversation

@RiverIsAMovingBodyOfWater

Copy link
Copy Markdown

Use .\Release\chat.exe -h to view options

antimatter15 and others added 30 commits March 16, 2023 09:16
… default warn_unused_result instead of Makefile -Wunused-result
Windows fixes for CMake & Github CI
process the scanf() output so Ubuntu 22 compiler doesn't error due to…
Also fix a typo of LLaMA's casing in the chat.cpp file, and add cmake's generated files to the gitignore
Compute remaining tokens along the way and exit if over
Fix Makefile and Linux/MacOS CI
add easy Windows install instructions to the readme
…gml-org#242)

* Implement non-greedy tokenizer that tries to maximize token lengths

* Insert single space in front of the prompt

- this is to match original llama tokenizer behavior

---------

Co-authored-by: Jakub Horak <[email protected]>
@Green-Sky

Copy link
Copy Markdown
Collaborator

@RiverIsAMovingBodyOfWater , what is the purpose of this pull request?

@stefanberndtsson

Copy link
Copy Markdown

@RiverIsAMovingBodyOfWater , what is the purpose of this pull request?

Looking at the code changes, it seems like they intended to add a pull request to the alpaca.cpp repo, but added it here instead.

@prusnak prusnak closed this Mar 18, 2023
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
Co-authored-by: Iwan Kawrakow <[email protected]>
UltraRabbit pushed a commit to UltraRabbit/llama.cpp that referenced this pull request Sep 29, 2026
…gml-org#27342) (ggml-org#27816) (ggml-org#261)

* spec : add DFlash2 support (local convolution + candidate selector) (ggml-org#27342)

* support DFlash2

* Add p_min in DFlash2

Assisted-by: Claude Opus 5

* Revert unnecessary changes

Assisted-by: Claude Opus 5

* Revert draft sampling in rejection sampling

Assisted-by: Claude Opus 5

* Refactor code structure

Assisted-by: Claude Opus 5

* Delete embedding scaling

Assisted-by: Claude Opus 5

* Gate output transforms on DFlash2

Assisted-by: Claude Opus 5

* Optimize Dflash 2 cost

Assisted-by: Claude Opus 5

* Avoid using atoi

Assisted-by: Claude Opus 5

* Modify comments

Assisted-by: Claude Opus 5

* Move llama_model_dflash_selector_top_k to llama-ext.h

Assisted-by: Claude Opus 5

* Formatting

Assisted-by: Claude Opus 5

* Apply patch to fix the mrope bug

Assisted-by: Claude Opus 5

* fix ci

Assisted-by: Claude Opus 5

* Fix graph number calculation

Assisted-by: Claude Opus 5

* rename hid and unary

Assisted-by: Claude Opus 5

---------




* revert top-k.cu changes

---------



(cherry picked from commit b10f9ca)

Co-authored-by: Xuan-Son Nguyen <[email protected]>
Co-authored-by: Zihan Zhang <[email protected]>
Co-authored-by: Jian Chen <[email protected]>
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 5, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 7, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 9, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 9, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 9, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
pwilkin pushed a commit to pwilkin/llama.cpp that referenced this pull request Nov 11, 2026
llama-memory-hybrid-idx : no abort on image cells sharing a tail slot when unranked
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 11, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 12, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 13, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 14, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 16, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 20, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 21, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.

(r328 re-base) One conflict, in `tests/test-backend-ops.cpp`, resolved as a union of two independent
additions: upstream's `padded_q` / `permuted_k` layout cases are kept, and the delivery's ninth argument
(`/*n_rs_batch=*/1`) is passed through them; and the gate-tensor range keeps upstream's `correlated`
(-1e-4) special case with the delivery's realistic -0.5 floor in place of the old -20 (which decayed the
state to zero and hid n_seqs > 1 bugs).  Verified: `test-backend-ops -o GATED_DELTA_NET` 76/76 on gfx1201,
4B coherence `1c5d32ac537d`, and the block's own switch moves its own measurement -- chunked prefill ON
6870.1 t/s vs OFF 6314.6 t/s on a 5298-token prompt (+8.8 %), identical text `43 chars sha=aeef162bc0ce`.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 21, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.

(r328 re-base) One conflict, in `tests/test-backend-ops.cpp`, resolved as a union of two independent
additions: upstream's `padded_q` / `permuted_k` layout cases are kept, and the delivery's ninth argument
(`/*n_rs_batch=*/1`) is passed through them; and the gate-tensor range keeps upstream's `correlated`
(-1e-4) special case with the delivery's realistic -0.5 floor in place of the old -20 (which decayed the
state to zero and hid n_seqs > 1 bugs).  Verified: `test-backend-ops -o GATED_DELTA_NET` 76/76 on gfx1201,
4B coherence `1c5d32ac537d`, and the block's own switch moves its own measurement -- chunked prefill ON
6870.1 t/s vs OFF 6314.6 t/s on a 5298-token prompt (+8.8 %), identical text `43 chars sha=aeef162bc0ce`.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 22, 2026
Sources: old 02 (whole block).

Fold (r91): fold every ubatch into the per-sequence rollback tracker (issue ggml-org#131).
`prepare()` recorded each sequence's last-batch shape from `ubatches.back()` only, so a
sequence that ran in a non-final ubatch of a multi-ubatch call kept an older count -- typically
its own prefill chunk.  The guard then compared a rejection rollback against a completed
prefill and warned about a batch boundary that never happened (observed 4571-token case,
reproduced on gfx1201: 1 warning -> 0 with this fix).  Every ubatch is now folded in, oldest
first.  Also adds the `LLAMA_RS_ROLLBACK_DEBUG` RSPREP/RSROLL instrumentation that proved it.
Text-identical pre/post on gfx1151 and gfx1201.  Record: archive/work/rs-rollback-boundary/.

Fold (r195): a cell that find_slot moves keeps its rollback snapshot planes.  build_rs
relocates the "extra states" (the cells inside [head, head+n_rs) that no sequence of this
ubatch uses) by copying plane 0 only, so a moved cell's planes 1..n_rs_seq stay at the old
index, where the cells that take their place overwrite them -- and that sequence's next
rollback then reads another sequence's snapshot (or zeroed rows).  From 3 cells on,
find_slot's gather-and-reorder moves a live cell whenever a multi-sequence ubatch's cell range
spans a third cell, so a 3- or 4-slot server with speculative decoding hits it.  build_rs now
also copies planes 1..n_rs_seq of the extra states, gathered through a new input
`s_copy_extra` before this ubatch writes its snapshots; the source ids use `s_src()`, not
`s_copy()`, because `s_copy()` consumes the sequence's pending rollback index.  Where no extra
state exists (n_rs == n_seqs, i.e. every single-sequence batch and a 2-cell cache) the graph
does not change.  The defect is upstream's (6050b46 and master 0ec4027 carry the same
build_rs); both copies are in upstream/recurrent-moved-cell-snapshots/.  Contribution by
overdoingism (PR ggml-org#261).  Record: archive/work/recurrent-moved-cell-snapshots/.

(r328 re-base) One conflict, in `tests/test-backend-ops.cpp`, resolved as a union of two independent
additions: upstream's `padded_q` / `permuted_k` layout cases are kept, and the delivery's ninth argument
(`/*n_rs_batch=*/1`) is passed through them; and the gate-tensor range keeps upstream's `correlated`
(-1e-4) special case with the delivery's realistic -0.5 floor in place of the old -20 (which decayed the
state to zero and hid n_seqs > 1 bugs).  Verified: `test-backend-ops -o GATED_DELTA_NET` 76/76 on gfx1201,
4B coherence `1c5d32ac537d`, and the block's own switch moves its own measurement -- chunked prefill ON
6870.1 t/s vs OFF 6314.6 t/s on a 5298-token prompt (+8.8 %), identical text `43 chars sha=aeef162bc0ce`.
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.