Repository navigation
[Bugfix] Run an entry's warm-up sizes largest first to avoid OOM - #28
Merged
Merged
Conversation
Each warm-up call allocates its own torch buffers. Walking the sizes up from the smallest, every buffer is larger than any block the caching allocator holds, so each maps a new segment and the cache grows by the sum of all sizes until the warm-up's empty_cache. Largest first, the later sizes reuse the first size's blocks. The same pattern in vLLM's DeepSeek-V4.1 prefill GEMM warm-up (272 sizes) grew the cache to 180 GiB on a DEP8 rank. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: shen-shanshan <467638484@qq.com>
5 of 6 tasks
shen-shanshan
marked this pull request as ready for review
December 2, 2026 04:32
Fangzhou-Ai
approved these changes
Dec 2, 2026
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
_warmruns an entry at each of its warm-up sizes in the ordersizes(mode)returns them, usually smallest first, and frees the torch cache once at the end. Every call allocates its own buffers, and each is larger than any block the caching allocator already holds, so it maps a new segment and the cache grows by the sum of all sizes. Running the sizes largest first lets every later size reuse the first size's blocks.The same pattern in vLLM's DeepSeek-V4.1 prefill GEMM warm-up (272 sizes, outputs up to 2 GiB) grew the cache to 180 GiB on a DEP8 rank and caused random startup OOMs (fixed on the vLLM side in vllm-project/vllm#71210). The entries here are small: on a DeepSeek-V4.1-Flash DEP8 startup with ba58826, the largest growth of one entry's warm-up was 0.96 GiB (
gemm/bf16_n129280_k5120). This change keeps entries with more or larger prefill sizes from reaching that point.Changes
_warmsorts the sizes largest first. The recording pass, the worker queue, the per-size load pass and the final compile-only pass all follow this order. The set of sizes is unchanged.tests/test_warm_up_order.py: an entry that allocates(n, 8192)at 64 sizes; the cache must grow by less than 2x its largest buffer (8.1 GiB, 16x the limit, smallest first).Validation
MI355X:
pytest tests/test_warm_up_order.py tests/test_entry_convention.py tests/attention/mla_decode_common/test_warm_up.py tests/attention/compressor_insert_d512_idx128_rot64/test_entry_warm_up.py→41 passed in 43.27s.🤖 Generated with Claude Code