Manuscript Offprint

arXiv:2610.28096

KPage: Cross-Block Page Compaction for Hardware-Efficient Sparse Attention

Junwei Feng, Qiaorui Chen, Chenyu Liang, Zhen Guo, Jingyi Yang, Xiaoling Zhou, Jiahao Zhang, Dongliang Huang, Yiqiao Liao, Chengru Song

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Junwei Feng ∗^{*} †^{\dagger}

fengjunwei@kuaishou.com

KlingAI Research

Beijing, China

Zhen Guo

jemiryg@nvidia.com

NVIDIA

Shanghai, China

Jiahao Zhang

zhangjiahao09@kuaishou.com

KlingAI Research

Beijing, China

Kling Infra Team

KlingAI Research

Beijing, China

Qiaorui Chen ∗^{*}

cjerry@nvidia.com

NVIDIA

Shanghai, China

Jingyi Yang

sopyang@nvidia.com

NVIDIA

Beijing, China

Dongliang Huang

huangdongliang@kuaishou.com

KlingAI Research

Beijing, China

Chengru Song †^{\dagger}

songchengru@kuaishou.com

KlingAI Research

Beijing, China

Chenyu Liang

liangchenyu03@kuaishou.com

KlingAI Research

Beijing, China

Xiaoling Zhou

zhouxiaoling03@kuaishou.com

KlingAI Research

Beijing, China

Yiqiao Liao †^{\dagger}

liaoyiqiao@kling.ai

KlingAI Research

Beijing, China

Abstract

Sparse attention reduces the algorithmic cost of long-sequence video Transformers, but three-dimensional token layouts can leave selected block-sparse regions only partially occupied. As a result, eliminating unselected blocks does not necessarily eliminate unused capacity inside the physical tiles that remain.

We present KPage, a page-compacted execution scheme for block-sparse attention. KPage decomposes selected K/V blocks into 16-row pages and packs valid pages across logical-block boundaries into large physical attention tiles. The packed tiles are assembled directly during K/V loading, without materializing an intermediate compacted tensor in high-bandwidth memory. KPage further routes partially occupied query blocks between M64×N256M64 \times N256 and M128×N128M128 \times N128 forward kernels, and uses exact score masking to preserve the original sparse-attention semantics. For backward, KPage constructs a K/V-owned paged layout and restores the original sparse adjacency after packing both Q and K/V.

Across five representative sparse-attention workload cases, KPage achieves 1.35×−2.06×1.35\times-2.06\times bare forward-kernel speedup over NVIDIA Block-Sparse Attention (BSA), with a geometric mean of 1.77×1.77\times. On controlled workloads with fully occupied logical blocks, KPage is effectively on par with BSA ( 1.03×1.03\times geometric mean). Under matched-scale 3D layouts containing partial blocks, the geometric-mean speedup increases to 2.29×2.29\times. Execution-capacity analysis shows that Page16 K/V compaction and query-adaptive execution reduce physical query-key pair capacity from 334.1G to 177.5G positions while preserving 160.6G useful interactions. Across eight layouts reconstructed from the open-source Selective and Sliding Tile Attention (SSTA), Sliding Tile Attention (STA), and Video Sparse Attention (VSA) systems, the same KPage kernel has the lowest forward time in every case: 1.13−4.25×1.13-4.25\times faster than the strongest exact baseline. The corresponding forward-plus-backward ratios are 1.02−2.71×1.02-2.71\times. We further extend the metadata interface to independent Q/K partitions and evaluate the paper-matched Sparse VideoGen2 (SVG2) Wan 14B/720p configuration. KPage is 1.49×1.49\times faster than the strongest exact sparse baseline and 1.57×1.57\times faster than NVIDIA BSA. After compliance review, we will open-source KPage and submit a PR to NVIDIA cuDNN Frontend.

Keywords

Video Diffusion, Block-Sparse Attention, GPU Kernel Optimization, Long-Sequence Attention

References (11)