[Perf][HiSparse] Reuse pinned host pool after graph profiling (#61668)
Signed-off-by: Itay Etelis <92247226+Etelis@users.noreply.github.com> Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Co-authored-by: Matthew Bonanni <mbonanni@redhat.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Matthew Bonanni
Claude Opus 5.5
parent
105605b8e9
commit
49f944be3e
@@ -223,7 +223,9 @@ class HiSparseHostPool:
|
||||
self.shared_region: SharedOffloadRegion | None = None
|
||||
|
||||
def allocate(self, size: int) -> torch.Tensor:
|
||||
assert self.backing is None, "HiSparse host pool is already allocated."
|
||||
if self.backing is not None:
|
||||
assert self.backing.numel() == size, "HiSparse host pool size changed."
|
||||
return self.backing
|
||||
config = self.kv_cache_config
|
||||
if config.hisparse_shared_host_pool:
|
||||
tensor_sizes = [
|
||||
@@ -253,6 +255,23 @@ class HiSparseHostPool:
|
||||
return self.backing
|
||||
|
||||
|
||||
_host_pools: dict[str, HiSparseHostPool] = {}
|
||||
|
||||
|
||||
def get_hisparse_host_pool(
|
||||
vllm_config: VllmConfig, kv_cache_config: KVCacheConfig
|
||||
) -> HiSparseHostPool:
|
||||
"""Return the engine's host pool, which outlives the profiling KV cache."""
|
||||
instance_id = vllm_config.instance_id
|
||||
if instance_id not in _host_pools:
|
||||
_host_pools[instance_id] = HiSparseHostPool(vllm_config, kv_cache_config)
|
||||
return _host_pools[instance_id]
|
||||
|
||||
|
||||
def drop_hisparse_host_pool(vllm_config: VllmConfig) -> None:
|
||||
_host_pools.pop(vllm_config.instance_id, None)
|
||||
|
||||
|
||||
def use_shared_hisparse_host_pool(vllm_config: VllmConfig) -> bool:
|
||||
"""Whether replicated MLA host KV can share one local mmap."""
|
||||
parallel = vllm_config.parallel_config
|
||||
|
||||
Reference in New Issue
Block a user