CompileMask: Bridging the Gap Between Expressiveness and Efficiency in Attention Masking
Hongzheng Li, Jiacheng Wan, Zhaolong Xing, Zhida Jiang, Yuanhang Yang, Junhua Shu, Jiaxing Wang, Xupeng Miao,
Key points
From the paper's conclusion- We present CompileMask, which addresses this trade-off by connecting expressive mask specifications with efficient attention execution.
Abstract
Modern attention workloads require diverse masking patterns whose boundaries depend on runtime metadata, yet efficient attention kernels natively support only a small set of patterns. Existing methods for supporting custom masks in these kernels face an expressiveness-efficiency trade-off. Predicate-based methods are expressive but incur substantial preprocessing and execution overhead, whereas interval-based methods execute efficiently but restrict expressiveness through a predefined interval count. We present CompileMask, which addresses this trade-off by connecting expressive mask specifications with efficient attention execution. We design a compiler that analyzes visibility rules during the offline stage and generates a mask-specific preprocess kernel. We further propose MaskSpec, a region-based DSL that lets users express these rules. During the online stage, the generated kernel reads batch metadata and produces a compact Execution Descriptor that lets the attention kernel efficiently check visibility by comparing element indices against precomputed endpoints. Experiments show that CompileMask achieves up to $3.8\times$ speedup over state-of-the-art methods.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- DexAttention: Distributed Sparse Attention through Rapid Online Planning and Persistent GPU ExecutionarXiv · 2026
- LampAttention: Look-Ahead Mixed-Precision FlashAttention for Dedicated AcceleratorsarXiv · 2026
- TileMix: Tile-Centric Mixed-Precision Attention for LLM Inference AccelerationarXiv · 2026
- GroupMask: Layer-Adaptive Group-wise Sparsity for Semi-Structured LLM PruningarXiv · 2026
- An Empirical Study of Issues in GPU Kernel Libraries for LLM SystemsarXiv · 2026
- Prism Attention: Proposal-Refined Index Sharing Mechanism for Efficient LLMs InferencearXiv · 2026