Repository navigation
feat(cache): implement --swa-full opt-in to keep every sliding block - #3658
Merged
Merged
Conversation
inureyes
marked this pull request as ready for review
December 1, 2026 21:38
This was referenced Dec 1, 2026
inureyes
added a commit
that referenced
this pull request
Dec 1, 2026
* fix(server): pass swa_full through the diffusing-interval constructor main does not compile since #3658 and #3624 landed together. #3658 threads `swa_full` through `ModelProvider` and passes it to `new_with_full_config_and_diffusing_interval`, while #3624 introduced that constructor without the parameter, so `cargo build` fails with E0425 (`swa_full` not in scope) and E0061 (41 arguments where 40 are expected). Add `swa_full: bool` to the constructor after `context_retention`, where the call from `start` already passes it, and forward it from `new_with_full_config`, which takes it but did not pass it on. The body already uses it. Validated with `cargo build --profile test-fast --features cuda` on Linux (the lib, `mlxcel`, `mlxcel-server`, `mlxcel-bench-decode` and `examples/logit_trace`). * chore(docs): drop a raw JSONL record the binary-assets check rejects #3334 committed `docs/benchmark_results/paged-sliding-decode-gb10-2026-11-23/gemma3-1b-first-run-partial.jsonl`, a partial raw record stream. `scripts/ci/check_benchmark_raw_logs.py` rejects JSONL under benchmark data, so the `binary assets` job fails on main and on every PR based on it. Nothing references the file; the directory keeps its README and JSON results.
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.
Part of #3259
Closes #3257
Summary
Implements
--swa-full(LLAMA_ARG_SWA_FULL, defaultfalse) as an opt-in policy that keeps every sliding-window KV block pinned on live sequences until prompt-cache donation instead of retiring blocks past the window.swa_full: booltoContextCompatResolutionand removes the startup refusal insrc/cli/context_args.rs. Threadsswa_fullthroughServerStartupConfig,ServerConfig,runtime_settings,WorkerSchedulerConfig, andBatchScheduler.mlxcel-core): Addsswa_full: booltoPagedBlockPoolandCachePool(remembered across lazy pool initialization). When enabled,settle_window_before_appendstill advanceslogical_startso attention numerics stay windowed and unchanged, while skippingretire_head_blocks.clone_detached_paged_prefixalso preserves blocks fromblock_base(0) under--swa-fullso multi-turn continuations retain every block until donation.layer_state_kinds()isNoneor has noSlidingentry, or the family is not paged-sliding),BatchScheduler::warn_swa_full_no_effect_oncelogs onewarnnaming the model type per worker (surviving idle sleep/wake rebuilds) without refusing startup.KvSizingwithswa_fullandKvArchEstimatewithsliding_bytes, and addsestimate_sliding_kv_from_config/format_swa_full_startup_logreusingestimate_kv_arch_from_configandestimate_kv_arch_unwindowed_from_config. Startup logs both windowed and full-size sliding KV estimates atinfo, andserve_preflight_kv_mode/prompt_cache_sizing_kv_modefeed the full-size figure into preflight admission so an oversized full-size context is refused rather than silently windowed.docs/llama-server-compat.mdwith thegemma-4-12b-itmemory table (8k / 32k / 128k vs 320 MiB windowed) and notes on prompt-cache-disabled and admission behavior, and updatescompat/llama-server/b10621/runtime-and-context.jsonandpin.jsonto mark--swa-fullassupported.Validation
cargo fmt --all -- --check: passedpython3 scripts/ci/check_llama_compat_manifest.py: passed (249 help entries,supported: 171)python3 scripts/ci/check_cross_repo_refs.py: passedcargo clippy --profile test-fast --features metal,accelerate -p mlxcel-core --lib --tests -- -D warnings: passedcargo clippy --profile test-fast --features metal,accelerate --lib --bins --tests -- -D warnings: passedcargo test --profile test-fast --features metal,accelerate -p mlxcel-core --lib -- --test-threads=1 cache::paged: 156 passed, 0 failed (includingswa_full_advances_logical_start_without_retiring_blocks)cargo test --profile test-fast --features metal,accelerate --lib -- --test-threads=1 context_args kv_arch:: prompt_cache scheduler_paged_sliding gemma3::: 540 passed, 0 failed (includingswa_full_is_accepted_and_defaults_off,swa_full_sliding_kv_estimates_pin_gemma4_12b_at_8k_32k_128k,swa_full_preserves_sliding_blocks_across_divergence_where_windowed_evicts, andswa_full_warns_once_for_model_without_sliding_layers_and_stays_silent_for_gemma3)cargo test --profile test-fast --features metal,accelerate --lib -- --test-threads=1 runtime_settings cli_input: 184 passed, 0 failedcargo test --profile test-fast --features metal,accelerate --test llama_compat_manifest: 4 passed, 0 failed