[Fix] Account resident weight memory in KV sizing (#34053)
Signed-off-by: Schwinn Saereesitthipitak <schwinns@nvidia.com>
This commit is contained in:
@@ -844,6 +844,24 @@ class ModelRunner:
|
||||
max_rows = max(max_rows, max(capture_bs) * num_tokens_per_req)
|
||||
return max_rows
|
||||
|
||||
@property
|
||||
def preloaded_weights_bytes(self) -> int:
|
||||
value = self.loader.preloaded_weights_bytes
|
||||
if isinstance(value, bool) or not isinstance(value, int) or value < 0:
|
||||
raise ValueError(
|
||||
"ModelLoader.preloaded_weights_bytes must be a non-negative int, "
|
||||
f"got {value!r}"
|
||||
)
|
||||
return value
|
||||
|
||||
def account_preloaded_weights(self, preloaded_weights_bytes: int) -> None:
|
||||
# Dist-init sampled B after the daemon already held weights, so slack
|
||||
# (B * (1 - mem_fraction_static)) is too small. Add those bytes back
|
||||
# onto the existing MIN'd baseline. Skip when nothing was preloaded.
|
||||
if preloaded_weights_bytes == 0:
|
||||
return
|
||||
self.pre_model_load_memory += preloaded_weights_bytes / (1 << 30)
|
||||
|
||||
def alloc_memory_pool(self, memory_pool_config: Optional[MemoryPoolConfig] = None):
|
||||
"""Allocate KV cache memory pools only (no backends or cuda graphs)."""
|
||||
if memory_pool_config is not None:
|
||||
|
||||
Reference in New Issue
Block a user