Repository navigation
Xsn/glm dsa - #13
Merged
Merged
Xsn/glm dsa#13
Conversation
danielhanchen
pushed a commit
that referenced
this pull request
May 31, 2026
* spec: support MTP * fix batch size * rename files * cont : simplify (#7) * MTP: clean-up (#9) * MTP: clean-up * review: use llama_context_type instead of llama_graph_type * review: remove llama_model_has_mtp * review: fix convert issues * convert: fix pycheck * review: formatting * use `mtp-` for identifying mtp models * convert: fix mtp conversion * mtp -> draft-mtp * remove unused llama_arch * add need_embd in speculative * llama: allow partial seq_rm for GDN models for speculative decoding Currently speculative checkpoint needs to restart from a checkpoint after some draft tokens are not accepted, this leads to some wastage in running the target again. This PR adds the ability to rollback upto `draft_max` by storing the GDN intermediates. * fix pending state * vulkan: add GDN partial rollback * meta: extend check to axis 1 * metal: add GDN partial rollback Extend the gated delta net kernel to store intermediate states for partial rollback support on the Metal backend. - Add K (snapshot slot count) as a function constant - Read input state from slot 0 of the 3D state tensor - Write intermediate states to different slots during token loop - For K=1, maintain backward-compatible single-slot behavior Ref: ggml-org@8c05923 Assisted-by: llama.cpp:local pi * delta_net_base: use ggml_pad instead of new_tensor * review: add need_rs_seq * review: rename part_bounded to n_rs * review: deslop comments * review: rename, add asserts * server : adjust checkpoint logic (#11) * server : adjust checkpoint logic * cont : rm asserts * server-context: fix early exit * spec : fix compatibility with n-gram and add TODOs (#13) * metal : cleanup * llama : fix faulty bitwise check in recurrent memory * server : disable RS-based MTP in combination with other spec types * spec : add TODOs * cont : fix comment * cont : update comment * common : fix logic for ngram + mtp compat * llama-memory: enable checkpointing with partial rollback * cont: add test-case for loading into a dirty ctx * llama-memory-recurrent: clear rs_idx in clear * download: fix mtp path * llama-arch: fix enorm op * docs: update docs * conversion: fix type annotations --------- Co-authored-by: Georgi Gerganov <[email protected]>
danielhanchen
added a commit
that referenced
this pull request
Sep 9, 2026
…tructor
common_state_buffer_pool::instance() returned a function-local static, which is destroyed in
reverse order of completion of construction. A common_prompt_checkpoint with static storage
duration constructed before it would therefore be destroyed after it, and ~common_prompt_checkpoint
would call put() on a destroyed object. [basic.start.term]/5 makes that undefined outright, and the
try/catch in the destructor does not help, because it is not an exception.
Reproduced under AddressSanitizer with a namespace-scope checkpoint, as a pair, because whether it
fires depends only on whether the pool still holds a buffer when it is destroyed:
pool at exit result
empty exit 0, 0 ASan reports
holding 96 MiB exit 1, heap-use-after-free
ERROR: AddressSanitizer: heap-use-after-free
READ of size 8 thread T0
#13 common_state_buffer_pool::put(std::vector<unsigned char>&&) common/common.cpp:2364
#14 common_prompt_checkpoint::~common_prompt_checkpoint() common/common.cpp:2406
#15 __run_exit_handlers stdlib/exit.c:108
common.cpp:2364 is free_bufs.push_back(). ~vector deallocates and leaves its pointers dangling; an
empty pool is the case that hides it, because trim()'s shrink_to_fit() nulls them and the same
push_back merely allocates afresh.
This is latent today, not live: every checkpoint holder in the tree has automatic storage duration,
including server_context ctx_server in main(). It is a constraint this feature silently creates for
anyone who later gives a checkpoint static storage duration, and a leaky singleton removes it for
the cost of one deliberate leak of a process-wide object at exit.
After this commit the same ASan run is clean, 0 reports, with 43 of 43 pool assertions still
passing under both ASan and ThreadSanitizer (0 data races, 0 lock-order inversions).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make sure to read the contributing guidelines before submitting a PR