Repository navigation
Studio: emit no legacy load flag when the llama-server --help probe is inconclusive - #15828
Merged
Merged
Conversation
A failed or empty llama-server --help probe reported supports_load_mode=False, which made apply_load_mode_policy fall back to --no-mmap / --mlock. Newer llama.cpp builds removed those flags and exit on them, so a probe timeout on a busy machine turned into a hard load failure. load_mode_support() now returns None for an inconclusive probe and the policy then emits nothing.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
meefs
pushed a commit
to meefs/unsloth
that referenced
this pull request
Oct 28, 2026
… probe is inconclusive (unslothai#15833) ## Summary Follow-up to unslothai#15828. That PR stopped `apply_load_mode_policy` from emitting `--no-mmap` / `--mlock` when the `llama-server --help` probe is inconclusive, but the Model Memory "Keep model in GPU memory" path still did. With an empty capability catalogue, `apply_model_memory_policy` read `supports_load_mode` as `False` and emitted the legacy `--mlock`. Current upstream llama-server has removed that spelling and exits on it, so a probe timeout under load still turned into a failed load whenever Keep resident was on and the weights sat in host RAM. The `--fit on` retry had the same fallback inline. ## Changes - New `keep_resident_lock_flags(support)` in `llama_server_args.py`: `--load-mode mmap+mlock` when `--load-mode` is listed, `--mlock` when a successful probe shows it is missing, nothing when support is unknown. `apply_model_memory_policy` and the `--fit on` retry both use it. When nothing is emitted, the user's extras are left untouched. - New `keep_resident_lock_applicable(host_resident, support)`: a lock is only owed on a build we could spell it for. The initial launch, the `--fit on` retry and the arch-crash retry use it for `_memory_mlock_applicable`, so the reload hint and the duplicate-load comparator do not ask for an mlock this launch skipped (no reload loop on a build whose probe keeps failing). - Every remaining `bool(server_caps.get("supports_load_mode"))` in `llama_cpp.py` now goes through `load_mode_support(server_caps)`. That covers the memory policy call, the DirectIO gate and the two Metal demand-paged embedding estimates. The estimates now model the same command line the launch builds. Before, they assumed the legacy flag on an unknown build even after unslothai#15828 stopped emitting it. Builds with `--load-mode`, and builds whose probe positively lacks it, get the same flags and bookkeeping as before. ## Tests `test_load_mode_caps_unknown.py` gets new cases: the lock spelling for each probe outcome, a typed `--mlock` kept on an unknown build, fake binaries that fail `--help` or print nothing producing no lock and no reload demand, and a source check that no launch site reads the raw cap. On main, 9 of them fail; on this branch they pass. Across `test_load_mode_caps_unknown.py`, `test_model_memory_settings.py`, `test_load_mode_fit_matrix.py`, `test_server_tuning_flags.py`, `test_launch_flags_are_capability_gated.py`, `test_llama_cpp_placement.py` and `test_metal_explicit_context_guard.py`, the only other failures are the same five `test_llama_cpp_placement.py` drafter and header-scan tests that already fail on main. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.
Summary
When the
llama-server --helpcapability probe fails (a timeout on a busy machine, a nonzero exit, or empty output),supports_load_modecomes backFalse.apply_load_mode_policyread that as "this build predates--load-mode" and fell back to the legacy spellings (--no-mmap,--mlock). Current upstream llama.cpp removed those flags, so the server exits witherror: invalid argument: --no-mmapand/api/inference/loadreturns 500.Seen in a Studio run against upstream
llama-server: one load loggedLoad mode: --no-mmapand failed. The same model on the same binary loggedLoad mode: --load-mode noneon every other run and loaded fine. The failing launch was also missing--kv-unified,--metrics,--fit-ctxand the video flags, and dropped to--parallel 1. That is what an empty capability catalogue looks like. The smaller fit estimate in that run (0.5 GB vs 1.2 GB) comes from the same cause: one slot instead of four.Changes
llama_server_args.load_mode_support(caps)returnsTruewhen--load-modeis listed,Falseonly when a successful probe returned a non-empty catalogue without it, andNoneotherwise.apply_load_mode_policytakessupports_load_mode=Noneto mean unknown and emits no load flag, so llama-server uses its default. A build that positively lacks--load-modestill gets the legacy spellings.llama_cpp.pythat reachapply_load_mode_policynow passload_mode_support(server_caps).apply_model_memory_policytreatsNonethe same asFalse, so nothing else changes.The Model Memory "keep resident" path (
--mlock) still falls back to the legacy flag when support is unknown. I left it alone here because it also drives the memory state bookkeeping.Tests
New
studio/backend/tests/test_load_mode_caps_unknown.py: policy with unknown support, plus end to end with fake binaries that fail--help, print nothing, list only the old flags, or list--load-mode. It fails 8 of 9 cases on main and passes on this branch. Acrosstest_server_tuning_flags.py,test_load_mode_fit_matrix.py,test_model_memory_settings.py,test_launch_flags_are_capability_gated.py,test_llama_cpp_placement.pyandtest_ctx_checkpoint_host_budget.py, the failing IDs match on main and on this branch. Fivetest_llama_cpp_placement.pydrafter and header-scan tests already fail on main and are unrelated.