Patch SlidingWindowSpec.real_page_size_bytes for nvfp4 kv (#42464)

Signed-off-by: Shiyang Chen <shiychen@nvidia.com>
This commit is contained in:
sychen52
2026-05-13 01:46:30 -07:00
committed by GitHub
parent 92def124bc
commit a8c13d2837
+11
View File
@@ -435,6 +435,17 @@ class SlidingWindowSpec(AttentionSpec):
@property
def real_page_size_bytes(self) -> int:
# Mirror ``FullAttentionSpec.real_page_size_bytes`` for NVFP4 KV cache.
if self.kv_quant_mode.is_nvfp4:
last_dim = nvfp4_kv_cache_full_dim(
self.head_size
) + nvfp4_kv_cache_full_dim(self.head_size_v)
return (
self.block_size
* self.num_kv_heads
* last_dim
* get_dtype_size(self.dtype)
)
return (
self.block_size
* self.num_kv_heads