FlashMask-3 brings mask-aware attention to Hopper GPUs and context parallelism

Long-context training of large language and multimodal models often combines structured attention masks (document, prefix-LM, share-question, sliding-window, block-sparse) with multi-node context parallelism. The paper behind FlashMask-3 says that combination makes the mask a dominant bottleneck.
It builds on FlashMask, whose column-wise sparse mask compresses masks from O(n^2) to O(n) using four query-axis boundary vectors and covers a broad range of structured patterns. FlashMask was implemented for Ampere GPUs. It does not exploit FlashAttention-3's TMA/WGMMA warp-specialized pipeline on Hopper, and it does not support distribution. The mask is indexed by key positions but stores query-axis interval boundaries.
FlashMask-3 has two parts. The first is a mask-aware Hopper kernel with three-role warp specialization, built on top of FlashAttention-3's TMA/WGMMA pipeline. The second is a mask-aware distributed extension with three pieces: zero-communication mask localization, a sparsity-aware load balancer called HCC-IPO, and a mask-aware compute-communication overlap that uses mask-driven communication pruning. The forward all-gather in that overlap uses topology-aware hierarchical routing. For the localization step, the authors say that under any multi-chunk context-parallel assignment, per-rank mask localization reduces to a provably zero-communication clip-shift-max operation on the boundary vectors, which stays compatible with the single-GPU kernel.
Results come in three settings. On a single H100, across 12 masks at 4K to 128K context, FlashMask-3 improves achieved TFLOPs over FlashMask, FlexAttention and MagiAttention by 45 to 141%, 34 to 71%, and 2 to 44% respectively. At context-parallel degrees 4 to 32 with 8K sequence per device, it reaches 31 to 75% compute-communication overlap efficiency. Throughput there improves over Megatron-Core CP ring, Megatron-Core CP all-gather and MagiAttention by 1.80x to 3.71x, 1.71x to 2.92x, and 1.09x to 1.46x. In end-to-end training of a 118B-A14B MoE at 128K context on 128 H100 GPUs, it raises throughput by 7.3 to 11.0% over a Dual Chunk all-gather baseline, with attention forward plus backward 24.5 to 44.9% faster.
Key facts
- FlashMask-3 adds a mask-aware Hopper kernel with three-role warp specialization on FlashAttention-3's TMA/WGMMA pipeline, plus a distributed extension; the earlier FlashMask targeted Ampere and had no distribution support.
- On a single H100 across 12 masks at 4K to 128K context, achieved TFLOPs rise by 45 to 141% over FlashMask, 34 to 71% over FlexAttention and 2 to 44% over MagiAttention.
- At context-parallel degrees 4 to 32 with 8K sequence per device, throughput is 1.80x to 3.71x that of Megatron-Core CP ring, 1.71x to 2.92x that of CP all-gather and 1.09x to 1.46x that of MagiAttention, with 31 to 75% overlap efficiency.
- Per-rank mask localization is described as a provably zero-communication clip-shift-max on the boundary vectors, paired with a sparsity-aware load balancer (HCC-IPO) and mask-driven communication pruning.
- In end-to-end training of a 118B-A14B MoE at 128K on 128 H100 GPUs, throughput rises 7.3 to 11.0% over a Dual Chunk all-gather baseline, with attention forward plus backward 24.5 to 44.9% faster.
Why it matters
The paper's starting point is that structured masks plus multi-node context parallelism make the mask a dominant bottleneck in long-context training. FlashMask already stored such masks compactly, from O(n^2) down to O(n), but only for Ampere GPUs and a single device. FlashMask-3 carries that idea onto Hopper's FlashAttention-3 pipeline and across multiple devices, which is where the reported gains over FlexAttention, MagiAttention and Megatron-Core context-parallel baselines come from.
Who it affects
Teams training large language and multimodal models at long context on H100-class clusters, especially with document, prefix-LM, share-question, sliding-window or block-sparse masks and context parallelism across nodes. The authors of competing attention kernels and context-parallel frameworks named as baselines (FlexAttention, MagiAttention, Megatron-Core) are the ones being compared against.
How to use it
The abstract describes a kernel and a distributed scheme, not a product. No release date, code release, or open-source availability is stated. For now the practical use is as a reference: the abstract spells out the design pieces (three-role warp specialization, clip-shift-max localization on boundary vectors, HCC-IPO load balancing, communication pruning, hierarchical all-gather routing) and the benchmark settings to compare against.
How solid is it
The claims come from the paper's own abstract, which lists benchmarks at three levels: single H100, context-parallel degrees 4 to 32, and a 128-GPU MoE training run. The abstract names no authors or institutions and does not say whether results were peer reviewed. It gives only relative improvements, not absolute TFLOPs or throughput. It does not say which of the 12 masks produce the smallest or largest gains, and the ranges are wide (2 to 44% against MagiAttention, for example), so the gain depends heavily on the mask and baseline.
Risks and caveats
Only H100 hardware is evaluated here, with Ampere mentioned only for the earlier FlashMask. The end-to-end gain is much smaller than the kernel-level ones: 7.3 to 11.0% in throughput against a Dual Chunk all-gather baseline, even though attention itself is 24.5 to 44.9% faster. No cost, energy or wall-clock training time savings are given for the 118B-A14B run. The overlap efficiency of 31 to 75% also leaves a wide spread across the tested degrees.