Skip to content

[Bugfix] Run an entry's warm-up sizes largest first to avoid OOM - #28

Merged
Fangzhou-Ai merged 1 commit into
Inferact:mainfrom
shen-shanshan:warm-up-largest-first
Dec 2, 2026
Merged

Fangzhou-Ai merged 1 commit into
Inferact:mainfrom
shen-shanshan:warm-up-largest-first

Conversation

@shen-shanshan

@shen-shanshan shen-shanshan commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Overview

_warm runs an entry at each of its warm-up sizes in the order sizes(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

  • _warm sorts 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

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>
@shen-shanshan
shen-shanshan marked this pull request as ready for review December 2, 2026 04:32
@shen-shanshan shen-shanshan changed the title warm_up: run an entry's warm-up sizes largest first [Bugfix] Run an entry's warm-up sizes largest first to avoid OOM Dec 2, 2026
@Fangzhou-Ai
Fangzhou-Ai merged commit 5f73434 into Inferact:main Dec 2, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants