[6/N][KV-Cache Layout Refactor] Standardize KV cache layout (#51718)

Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
This commit is contained in:
Lucas Wilkinson
2026-08-21 17:47:49 -07:00
committed by GitHub
parent 9ff7041b55
commit 8bdc70ec7b
150 changed files with 4006 additions and 5815 deletions
+13 -8
View File
@@ -310,18 +310,23 @@ def test_aiter_mha_backend_contract():
def test_aiter_mha_backend_validates_kv_cache_block_size():
"""The backend should reject KV cache shapes that cannot be gathered
"""The backend should reject KV cache specs that cannot be gathered
correctly by the ROCm kernel."""
from vllm.v1.attention.backends.rocm_aiter_fa import AiterFlashAttentionBackend
from vllm.v1.kv_cache_interface import FullAttentionSpec
assert AiterFlashAttentionBackend.get_kv_cache_shape(8, 16, 8, 128) == (
8,
8,
16,
256,
)
with pytest.raises(ValueError, match="Block size must be a multiple of 16"):
AiterFlashAttentionBackend.get_kv_cache_shape(8, 15, 8, 128)
AiterFlashAttentionBackend.customize_spec(
FullAttentionSpec(
block_size=15, num_kv_heads=8, head_size=128, dtype=torch.bfloat16
)
)
# block_size == 1 is the per-token page-size probe and must pass through.
AiterFlashAttentionBackend.customize_spec(
FullAttentionSpec(
block_size=1, num_kv_heads=8, head_size=128, dtype=torch.bfloat16
)
)
def test_aiter_mha_backend_supports_compute_capability_matches_mi3xx_probe():