跳到正文
研踪PaperTrail
← 研踪 PaperTrail

arXiv:2610.13474 · v2

CompileMask: Bridging the Gap Between Expressiveness and Efficiency in Attention Masking

首次提交 2026-10-09 20:10
版本更新 2026-11-25 17:44
雷达观测 2026-11-26 11:26
arXiv ↗PDF ↗

摘要

Modern attention workloads require diverse masks whose shapes depend on per-sequence parameters, yet efficient attention kernels natively support only a small set of mask patterns. Existing methods for custom masks face an expressiveness-efficiency trade-off. Predicate-based methods are expressive but evaluate a user-defined predicate on every element at substantial cost, whereas interval-based methods execute efficiently but lack the expressiveness for complex masks. We present CompileMask, which bridges this gap by compiling the mask predicate users write into an Execution Descriptor that the attention kernel executes efficiently. We design a compiler that automatically lowers a mask predicate into an intermediate representation and generates a mask-specific preprocessing kernel, which builds the descriptor for each batch with a few expressions per row rather than by evaluating the predicate on every element. We further propose Tile-local Records, a compact representation of row visibility within each tile that lets the attention kernel check every element with a few integer operations, so that masking stays efficient even for complex masks. Experiments show that CompileMask achieves up to 3.3×3.3\times speedup over FlexAttention and up to 1.2×1.2\times over FlashMask in single-operator benchmarks, while supporting complex masks that FlashMask cannot express.

AI 论文解读

基于摘要 · 非全文审阅

此版本尚未生成 AI 解读。解读由后台任务生成并按论文版本保存,登录后共享已有结果。

版本差异

本站首次收录为 v2,暂无更早版本可对照。

观测到的版本

相邻记录可能跳过中间版本;首次发现 v2 及以上也会标为版本更新。

v2 · 2026-11-25 17:44 · 最新观测版本

CompileMask: Bridging the Gap Between Expressiveness and Efficiency in Attention Masking

Modern attention workloads require diverse masks whose shapes depend on per-sequence parameters, yet efficient attention kernels natively support only a small set of mask patterns. Existing methods for custom masks face an expressiveness-efficiency trade-off. Predicate-based methods are expressive but evaluate a user-defined predicate on every element at substantial cost, whereas interval-based methods execute efficiently but lack the expressiveness for complex masks. We present CompileMask, which bridges this gap by compiling the mask predicate users write into an Execution Descriptor that the attention kernel executes efficiently. We design a compiler that automatically lowers a mask predicate into an intermediate representation and generates a mask-specific preprocessing kernel, which builds the descriptor for each batch with a few expressions per row rather than by evaluating the predicate on every element. We further propose Tile-local Records, a compact representation of row visibility within each tile that lets the attention kernel check every element with a few integer operations, so that masking stays efficient even for complex masks. Experiments show that CompileMask achieves up to 3.3×3.3\times speedup over FlexAttention and up to 1.2×1.2\times over FlashMask in single-operator benchmarks, while supporting complex masks that FlashMask cannot express.

查看此版本解读 →查看此版本原文 ↗