Repository navigation
tests : refactor test-recurrent-state-rollback - #29426
Merged
Merged
Conversation
ggerganov
force-pushed
the
gg/tests-recurrent-refactor
branch
from
September 27, 2026 14:19
b899b86 to
dfdc64f
Compare
Replace raw llama_context pointers with llama_context_ptr and drop the manual llama_free calls and cleanup lambda. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL
Add a --models DIR mode that mirrors test-save-load-state: iterate every dummy model, report PASS/FAIL/SKIP in a table and fail only when a model fails. Register a single ctest entry with ARGS --models instead of the four per-model registrations. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL
…pendent The fusion packing in ggml_metal_fusion_max excluded 0-element tensors and the topk_moe/moe_reduce checks rejected n_tokens == 0, so graphs decoding batches with no outputs packed differently from the worst-case reserved graph. The Metal optimizer then reordered the nodes differently and ggml_gallocr_needs_realloc failed on the layout mismatch, forcing an unexpected graph re-reserve (caught by GGML_SCHED_DEBUG_REALLOC). Treat empty tensors like their non-empty counterparts: match them in the pattern sequence and only reject genuinely malformed shapes. Fused kernels dispatch zero threadgroups for empty graphs, which is a legal no-op. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL
test_multi_seq_split_replay was invoked at the end of test_rollback, so its result was folded into the rollback status and it only ran when the rollback part passed. Give it its own test_status return, run both tests independently over both cache fills via a shared run_tests helper, and report them as separate rollback / split replay columns in the --models table with per-test summaries. The exit code fails when either test fails. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL
ggerganov
force-pushed
the
gg/tests-recurrent-refactor
branch
from
September 28, 2026 07:24
d1d98a3 to
1e20fe5
Compare
test-generate-models seeds its weights from std::random_device, and some generated lfm2 models drift up to ~1.7e-5 nmse on the split replay due to rounding noise, tripping the previous 1e-5 bound. Raise the bound to 1e-4 so the random generations stop flaking. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL
ggerganov
marked this pull request as ready for review
September 28, 2026 10:31
Member
Author
|
@ggml-org/ggml-vulkan There seems to be a SEGFAULT after the refactor of Might be some issue during the tear-down phase since the tests are all successful. Probably something to look into if it continues happening. I don't have a suitable CM2 env to try to reproduce. |
The single-model path duplicated the model init and the non-recurrent check from run_tests_for_model; route it through the shared helper instead. Model load failures now return FAIL rather than SKIP so that --model with a broken file still exits non-zero, and the helper loads with model_only like the --models loop does since the tests create their own contexts. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL
Contributor
|
I managed to reproduce it once, it seems to be another spurious nvidia driver cleanup bug, something similar was fixed in the driver before. |
pwilkin
added a commit
to timkhronos/llama.cpp
that referenced
this pull request
Sep 28, 2026
Bring the PR current with ggml-org master (f00a64c). The only conflict was in tests/CMakeLists.txt: master's ggml-org#29426 refactored test-recurrent-state-rollback to run across every generated model via --models, which already covers glm5-next (it is generated by test-llama-archs and is recurrent, so not skipped, and the runner fails if any model fails). The PR's separate per-arch glm5-next invocation was therefore redundant and dropped; glm5-next rollback is still exercised by the all-archs run.
edwardyoon
pushed a commit
to edwardyoon/focus-llama
that referenced
this pull request
Oct 7, 2026
* tests : use llama_context_ptr in test-recurrent-state-rollback Replace raw llama_context pointers with llama_context_ptr and drop the manual llama_free calls and cleanup lambda. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL * tests : run test-recurrent-state-rollback over all dummy models Add a --models DIR mode that mirrors test-save-load-state: iterate every dummy model, report PASS/FAIL/SKIP in a table and fail only when a model fails. Register a single ctest entry with ARGS --models instead of the four per-model registrations. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL * cont : fix typo * metal : allow fusing 0-element nodes to keep graph packing shape-independent The fusion packing in ggml_metal_fusion_max excluded 0-element tensors and the topk_moe/moe_reduce checks rejected n_tokens == 0, so graphs decoding batches with no outputs packed differently from the worst-case reserved graph. The Metal optimizer then reordered the nodes differently and ggml_gallocr_needs_realloc failed on the layout mismatch, forcing an unexpected graph re-reserve (caught by GGML_SCHED_DEBUG_REALLOC). Treat empty tensors like their non-empty counterparts: match them in the pattern sequence and only reject genuinely malformed shapes. Fused kernels dispatch zero threadgroups for empty graphs, which is a legal no-op. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL * tests : run test_multi_seq_split_replay as a separate test test_multi_seq_split_replay was invoked at the end of test_rollback, so its result was folded into the rollback status and it only ran when the rollback part passed. Give it its own test_status return, run both tests independently over both cache fills via a shared run_tests helper, and report them as separate rollback / split replay columns in the --models table with per-test summaries. The exit code fails when either test fails. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL * tests : loosen the split replay nmse bound to 1e-4 test-generate-models seeds its weights from std::random_device, and some generated lfm2 models drift up to ~1.7e-5 nmse on the split replay due to rounding noise, tripping the previous 1e-5 bound. Raise the bound to 1e-4 so the random generations stop flaking. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL * tests : reuse run_tests_for_model in single-model mode The single-model path duplicated the model init and the non-recurrent check from run_tests_for_model; route it through the shared helper instead. Model load failures now return FAIL rather than SKIP so that --model with a broken file still exits non-zero, and the helper loads with model_only like the --models loop does since the tests create their own contexts. Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-RL (cherry picked from commit d77dd08)
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.
Overview
Refactor
tests/test-recurrent-state-rollback.cppto hold contexts inllama_context_ptr(unique_ptr withllama_context_deleter) instead of rawllama_context *pointers. The manualllama_freecalls and thecleanup()lambda are removed; contexts are released automatically on scope exit, including all early-return error paths.Add a
--models DIRmode that mirrorstest-save-load-state: iterate every generated dummy model, report PASS/FAIL/SKIP per model in a table, and fail only when a model fails. Register a single ctest entry withARGS --modelsinstead of four per-model registrations, covering all architectures that support recurrent rollback.Run
test_multi_seq_split_replayas a separate test instead of calling it at the end oftest_rollback: it returns its own status, both tests run independently over both cache fills through a sharedrun_testshelper, and the--modelstable reportsrollbackandsplit replaycolumns with per-test summaries. The exit code fails when either test fails.Fix the unexpected graph reallocations reported by
GGML_SCHED_DEBUG_REALLOC(hit byqwen4exp): decoding batches with no outputs leaves the last layer's MoE tensors empty, the Metal fusion logic excluded 0-element nodes, so the optimizer packed and reordered the graph differently from the worst-case reserved graph andggml_gallocr_needs_reallocfailed on the layout mismatch.ggml_metal_fusion_maxand the topk-moe/moe-reduce checks now match 0-element tensors like their non-empty counterparts; the fused kernels dispatch zero threadgroups for them, which is a legal no-op. The reserved graph and the no-output decode now produce identical node order and no longer trigger a re-reserve.Verified with
GGML_SCHED_DEBUG_REALLOC=1over all dummy models (no reallocations, 10 passed / 117 skipped / 0 failed), thetest-fusionbaseline check (264 ok, 0 failed, counts unchanged), and the full ctest suite.Note:
test-generate-modelsseeds fromstd::random_device, and some generated lfm2 models drift up to ~1.7e-5 nmse on the split replay; the bound is raised to1e-4fhere so the random generations no longer flake, verified over 4 full model-set seeds plus targeted lfm2 seeds.Requirements