[Bugfix][HiSparse] Drop the unaccounted, write-only prefill mirror staging buffer (#60429)

Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Matthew Bonanni
2026-10-08 14:00:49 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 194da61de1
commit 4ed4c4433b
6 changed files with 5 additions and 81 deletions
+1 -11
View File
@@ -2578,7 +2578,7 @@ def test_hisparse_multi_step_writes_request_major_output():
@requires_hisparse_ops
def test_hisparse_kv_update_writes_resident_and_staging_caches():
def test_hisparse_kv_update_writes_resident_cache():
device = torch.device(DEVICE_TYPE)
block_size = 4
row_width = 8
@@ -2597,18 +2597,11 @@ def test_hisparse_kv_update_writes_resident_and_staging_caches():
block_table=torch.tensor([[1]], dtype=torch.int32, device=device),
slot_mapping=resident_slots,
)
cache_handle.mirror_staging_cache = torch.empty(
(1, block_size, row_width), dtype=torch.float32, device=device
)
cache_handle.mirror_staging_slots = torch.arange(
block_size, dtype=torch.int64, device=device
)
slots = torch.tensor([3, 7, -1], dtype=torch.int64, device=device)
kv_c = torch.randn(8, row_width - 2, device=device)
k_pe = torch.randn(8, 1, 2, device=device)
cache_handle.num_actual_tokens = slots.numel()
cache_handle.decode_batch = False
cache_handle.host_mirror_required = True
source_cache = torch.zeros_like(cache_handle.view.cache)
impl = object.__new__(FlashMLASparseImpl)
layer = SimpleNamespace(
@@ -2635,9 +2628,6 @@ def test_hisparse_kv_update_writes_resident_and_staging_caches():
expected.to(device),
)
torch.testing.assert_close(source_cache, torch.zeros_like(source_cache))
staged = cache_handle.mirror_staging_cache.view(-1, row_width)
staged_expected = torch.cat([kv_c[:3], k_pe[:3, 0]], dim=-1)
torch.testing.assert_close(staged[:3], staged_expected)
@requires_hisparse_ops
+1 -1
View File
@@ -434,7 +434,7 @@ def test_init_hisparse_rolls_back_shared_region(monkeypatch, failure_phase):
cache_config=SimpleNamespace(
get_resolved_kv_cache_layout=lambda: KVCacheLayout.BLHNC
),
scheduler_config=SimpleNamespace(max_num_seqs=1, max_num_batched_tokens=1),
scheduler_config=SimpleNamespace(max_num_seqs=1),
)
def allocate(*args):