[5/N] Share HiSparse host cache across TP ranks (reopens #52760) (#56629)

Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Chao Lei <leichao139636@163.com>
Signed-off-by: Lucas Wilkinson <lwilkinson@neuralmagic.com>
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
Co-authored-by: Chao Lei <leichao139636@163.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Matthew Bonanni <mbonanni@redhat.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
This commit is contained in:
Lucas Wilkinson
2026-09-12 19:48:25 -04:00
committed by GitHub
co-authored by Chao Lei Claude Fable 5 Matthew Bonanni OpenAI Codex OpenAI Codex
parent ebe1dec2da
commit e19a3e172e
14 changed files with 878 additions and 85 deletions
@@ -367,6 +367,42 @@ def test_hisparse_offloads_only_indexer_group():
assert [group.group_idx for group in scheduler_config.kv_group_configs] == [1]
def test_hisparse_partial_group_size_survives_scheduler_flattening():
"""Worker and scheduler representations must produce identical mmap rows."""
layer_specs = {name: _full_attention_spec() for name in ("indexer.0", "indexer.1")}
wrapped = UniformTypeKVCacheSpecs.from_specs(layer_specs)
assert wrapped is not None
source = KVCacheGroupSpec(
["source"],
_full_attention_spec(),
host_resident=True,
role=KVCacheGroupRole.HISPARSE_SOURCE,
)
worker_indexer = KVCacheGroupSpec(
list(layer_specs), wrapped, role=KVCacheGroupRole.HISPARSE_INDEXER
)
scheduler_indexer = KVCacheGroupSpec(
list(layer_specs),
next(iter(layer_specs.values())),
role=KVCacheGroupRole.HISPARSE_INDEXER,
)
def make_config(indexer: KVCacheGroupSpec) -> KVCacheConfig:
return KVCacheConfig(
num_blocks=4,
kv_cache_tensors=[],
kv_cache_groups=[source, indexer],
hisparse_host_num_blocks=4,
)
config = _make_vllm_config()
worker = build_offloading_config(config, make_config(worker_indexer))
scheduler = build_offloading_config(config, make_config(scheduler_indexer))
assert worker.worker_kv_bytes_per_block == scheduler.worker_kv_bytes_per_block
assert worker.worker_kv_bytes_per_block == wrapped.page_size_bytes
def test_zero_blocks_skips_tensor_layout_validation():
kv_cache_config = _make_sizing_kv_cache_config(packed=False)
kv_cache_config.num_blocks = 0