fix(OOM): lower blocks cap 5000→3000 — flash_attn needs ~4GB temp buffer
5000 blocks KV cache fills GPU memory, flash_attn_varlen_func OOMs allocating temp attention buffer on first real request. 3000 blocks × 16 = 48K tokens capacity, leaves room for attention.
This commit is contained in:
@@ -21,11 +21,12 @@ CAPACITY_REPLACEMENT = """\
|
|||||||
num_gpu_blocks = reserve_block_major_gpu_blocks(
|
num_gpu_blocks = reserve_block_major_gpu_blocks(
|
||||||
num_gpu_blocks, cache_block_size)
|
num_gpu_blocks, cache_block_size)
|
||||||
# BI100: profiling with zero-tensor attention underestimates memory.
|
# BI100: profiling with zero-tensor attention underestimates memory.
|
||||||
# Hardcap at 5000 blocks (80K tokens) to prevent runtime OOM.
|
# Hardcap at 3000 blocks (48K tokens) to prevent runtime OOM.
|
||||||
if num_gpu_blocks > 5000:
|
# Must leave ~4GB free for flash_attn_varlen_func temp buffers.
|
||||||
|
if num_gpu_blocks > 3000:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"[BI100] capping num_gpu_blocks: %d -> 5000", num_gpu_blocks)
|
"[BI100] capping num_gpu_blocks: %d -> 3000", num_gpu_blocks)
|
||||||
num_gpu_blocks = 5000
|
num_gpu_blocks = 3000
|
||||||
num_gpu_blocks = max(num_gpu_blocks, 0)
|
num_gpu_blocks = max(num_gpu_blocks, 0)
|
||||||
num_cpu_blocks = max(num_cpu_blocks, 0)
|
num_cpu_blocks = max(num_cpu_blocks, 0)
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user