NVIDIA says register reuse speeds 4-bit attention up to 1.64x

In short

The problem: Tensor Cores waiting their turn

Attention is the step in a transformer model where every token looks at every other token. It is two matrix multiplications with a softmax in between. The first, written QKᵀ, multiplies query vectors by key vectors to give a tile of scores. Softmax turns those scores into weights. The second, PV, uses the weights to mix the value vectors into the output. (Our summary of the post's definitions.)

For world models, which generate video or robot actions over long sequences, the post calls attention "a major bottleneck". On NVIDIA's data-centre Blackwell chips the slow part is softmax. On the RTX PRO 6000 Blackwell, which has lower 16-bit matrix throughput, the post says BF16 attention is limited by the matrix multiplications themselves. That is the opening for NVFP4, Blackwell's hardware 4-bit number format, which gives the Tensor Cores (the GPU's matrix-multiply units) more operations per second.

The starting point is SageAttention3, an existing NVFP4 attention kernel for SM120 that does both QK and PV in 4-bit. Because softmax outputs lie between 0 and 1, it rescales them in two levels before packing them into 4 bits, per the post.

In SageAttention3's design, each block of threads has four "producer" warps that load data and eight "consumer" warps that do the maths. For every 128-column score tile the consumers run QK, then softmax and 4-bit packing, then PV, strictly one after another. The 4-bit matrix instruction on this chip is synchronous, the post explains, so while the warps do softmax there is no work on the Tensor Cores.

Computing the next tile's scores during softmax would need room for a second score tile. The post says there is no room: producer warps use 3,072 registers and consumer warps 59,392, a total of 62,464, or about 95.3% of the streaming multiprocessor's register capacity.

The fix: split the tile, recycle the registers

The new schedule keeps the same four producer and eight consumer warps and still loads full 128-column key and value tiles. What changes is how the scores are held. Each 128-column score tile is split into two 64-column halves, each in its own register slot.

The softmax running maximum and sum are still updated across the whole 128-column tile first. Then:

When the loop comes round, both slots already hold the next tile's scores.

The numbers

1.64x best kernel speedup (8,192 tokens, causal mask); 1.17x smallest kernel speedup in the table; 15.34% largest end-to-end latency cut, vs BF16 (OmniDreams); 95.3% share of the register file already in use

Reactor ran the tests on an RTX PRO 6000 Blackwell Server Edition GPU with 96 GB of memory. For the kernel comparison, the original and optimized NVFP4 kernels got identical inputs. All cases used batch size 1, 24 heads and head dimension 128. The 7,040-token input was captured from the LongLive model; the rest are synthetic. The timings leave out the 4-bit quantization of Q, K and V.

Source: Table 1 of the NVIDIA post (five of its eight rows).

The end-to-end table measures something different: whole-model latency with NVFP4 attention against BF16 attention (native cuDNN attention for the video-chunk and action-prediction rows, the post says), so it includes the gain from 4-bit itself, not only the new schedule. Only the attention operations listed in each row use NVFP4; the other attention calls and the model weights stay BF16.

Source: Table 2 of the NVIDIA post (four of its 13 rows).

Reading the two tables: the 1.64x is the best of eight kernel cases, and most were between 1.17x and 1.32x. The 15.34% is the best of 13 end-to-end rows and compares 4-bit attention with 16-bit attention. On Helios and Cosmos 3 Nano the end-to-end gain was under 2%. (Our reading of the post's tables.)

The OmniDreams rows come from one process per scenario; LongLive and Helios report the median of three runs, per the post.

Terms in plain English

Where things stand

The post says the core optimization is merged into FlashInfer's main branch. It tells developers to install FlashInfer from source, use the SM120 NVFP4 attention API, and compare both latency and output quality against a BF16 baseline. The post gives no output-quality figures, all timings were measured on one GPU model, the RTX PRO 6000 Blackwell (SM120), and none were checked independently of NVIDIA and Reactor.

Official channels of NVIDIA: Website · LinkedIn · X · YouTube

Sources

Sources

Related stories

More from Debug Duck

All stories from Debug Duck