Decoupling Logical Masks from GPU Execution for Dynamic Block-Sparse Attention
Shanghao Liu, Xiaoyun Yu, Wanting Li, Wenqi Jiang
原文摘要
Attention computation makes inference expensive in video diffusion transformers (vDiTs), which generate videos through iterative denoising. Block-sparse attention (BSA) reduces this cost by computing only blocks selected by a logical mask, which specifies the attention interactions to compute. Existing BSA runtimes either fix one physical execution plan per block geometry, which limits adaptation to varying masks and graphics processing units (GPUs), or plan each mask at runtime, which adds preparation overhead to every request. Because masks change across requests, this per-mask planning must be repeated, so its cost can outweigh the execution-time savings. We present Tessera, a runtime for dynamic BSA that decouples logical masks from GPU execution through two-layer physical execution plans that preserve the specified attention interactions. First, its physical mapping layer retains, combines, or subdivides logical blocks into physical tiles suited to different mask shapes and GPU architectures. Second, its task organization layer groups and schedules tiles within GPU tasks to reuse data, expose parallelism, and overlap data movement with computation. Third, its plan selector chooses a plan for each request with low overhead, through either a plan table built from offline profiling or a calibrated cost model, which extends selection to masks outside the profiled distribution and to a new GPU with about 100 calibration requests. Implemented with specialized CUDA kernels for four NVIDIA GPU generations and evaluated on 2,312 real attention masks and two video diffusion models, Tessera achieves up to $2.88\times$ BSA request speedup over baseline systems in these models and speeds up their 50-step loop by $1.21$--$1.24\times$.
cs.AR