common : reject non-positive batch size (#28525) - #28639
Closed
goodruyas wants to merge 1 commit into
Closed
Conversation
Author
|
Thanks for taking a look. I noticed this PR was closed without comments — could you point me to the preferred direction for fixing #28525? If someone is already handling it, I'll leave it to them. I'm new to this repo and want to learn the right way to contribute |
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
Currently, if you pass --batch-size 0 or a negative number to llama-server, it triggers a GGML assertion crash deep inside context initialization – not a great user experience. This PR fixes that by:
Adding validation in the CLI parser (common/arg.cpp) to reject non-positive values outright, with a clear error message.
Strengthening the check inside llama_init_from_model so it now explicitly rejects n_batch == 0, instead of only complaining when both n_batch and n_ubatch are zero.
Adding a regression test (test-arg-parser).
Fixes Eval bug: --batch-size 0 reaches an uncaught GGML assertion #28525
Additional information
--ubatch-size 0is left unchanged because it already means "follow n_batch" in llama_init_from_model.Test Plan
Build: CPU backend, commit 304665f, GCC 16.2.1, Arch Linux x86_64
ctest --test-dir build -R test-arg-parser --output-on-failure: 1/1 passed
Manual: llama-server --batch-size 0 exits with a clean argument error; no GGML_ASSERT.
Requirements