ggml-alloc: avoid splitting on zero-size view tensors - #13
Merged
Merged
Conversation
When buffer splitting is driven only by the accumulated buffer size, a view tensor with zero allocation size can trigger a split. That resets the running size at the view and can leave trailing view tensors outside the final allocated range. Require the current tensor to have a nonzero allocation size before it can start a new backend buffer chunk. Ported semantically from historical private-fork commit 00d5452.
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.
Ports the allocator correctness fix from historical private-fork commit
00d54526e24e3aba4c76474e3147cbf9c7cc034c.The old split condition could fire while iterating a view tensor whose allocation size is zero, purely because the already-accumulated buffer size exceeded the backend maximum. That resets the running chunk at a view tensor and can leave trailing views outside the final allocated range.
This port is intentionally minimal: require
this_size > 0before a tensor can trigger a new buffer chunk.No diagnostics, model-specific logic, or unrelated allocator changes are included.