Runtime CUDA Memory Expanding to OOM#2044
Open
glaziermag wants to merge 3 commits intoEricLBuehler:masterfrom
Open
Runtime CUDA Memory Expanding to OOM#2044glaziermag wants to merge 3 commits intoEricLBuehler:masterfrom
glaziermag wants to merge 3 commits intoEricLBuehler:masterfrom
Conversation
… queue Signed-off-by: glaziermag <glaziermag@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.
Resolves #1589 and Resolves #1637.
This pull request addresses a memory fragmentation and tracking leak occurring during sequence preemption and termination within both
PagedAttentionand CPU/GPU split layer topologies.Changes Made
mistralrs-core/src/paged_attention/scheduler.rs: Updatedfree_finished_sequence_groupsto also purge aborted sequences from thewaitingarray, ensuring KV blocks are systematically reclaimed.mistralrs-core/src/scheduler/default_scheduler.rs: Inherited the identical.retain()garbage-collection loop forself.waiting. This targets legacy topology allocations like CPU/GPU layout splits, preventing structural matrix alignment fragmentation when tracking sequence timeouts natively.Empirical Load Testing
Environment A: PagedAttention Engine
Before Log (Baseline Crash): The HTTP continuous load test consistently raised an
OutOfMemorytracking fault due to orphaned context sequences occupying KV pools indefinitely withinmistralrs-server.After Log (Patched Run): The KVCache cleanly garbage-collected the dropped queue allocations recursively, averting memory capacity exhaustion.
Environment B: Legacy Layer-Split Engine (Fallback Scheduler)
Tested natively with
mistralrs-server --no-paged-attnsimulating a cross-device CPU/GPU fallback configuration.Before Log (Baseline Crash): The timeout explicitly fragmented the
VecDequearray slices matching the Issue's shape mismatch symptoms exactly:After Log (Patched Run): The updated patch stabilized the abandoned queue elements gracefully, executing the dropped load tests perfectly seamlessly without hitting Shape Mismatches: