Simulation / Modeling / Design How to Optimize NVFP4 Attention on NVIDIA RTX Blackwell Through Register Recycling Decorative image. Nov 25, 2026 By Atharva Joshi Discuss (0)

AI-Generated Summary

  • NVFP4 enables hardware-accelerated 4-bit matrix multiplication on NVIDIA RTX Blackwell GPUs, offering higher Tensor Core throughput than BF16 for attention workloads.
  • An optimized SageAttention3 kernel splits each N128 score tile into two N64 register slots, reusing registers after softmax quantization to overlap the next tile's QK computation with the current tile's remaining operations.
  • This register-recycling schedule reduces Tensor Core idle time without allocating a second full score buffer, improving NVFP4 attention kernel latency by up to 1.64x on NVIDIA RTX PRO 6000 Blackwell.
  • Reactor integrated the optimized kernel into its production serving stack for world models, achieving end-to-end inference latency reductions of up to 15.34% across LongLive, Helios, OmniDreams, and Cosmos 3 Nano workloads.
  • The core optimization has been merged into the FlashInfer main branch for broader adoption.

Next Steps

Powered by NVIDIA Nemotron. AI-generated content may summarize information incompletely. Verify important information. Learn more

Attention can be a major bottleneck when serving world foundation models, where long sequences make inference computationally demanding. On NVIDIA Hopper and NVIDIA Blackwell data center GPUs, FlashAttention3 and FlashAttention4 improve attention performance by overlapping matrix multiply-accumulate (MMA) operations through softmax within a thread block.

However, these hardware-specific pipelines cannot be applied directly to the NVIDIA RTX PRO 6000 Blackwell Series (SM120), which uses a different Tensor Core architecture. For video generation models using BF16 inference, attention remains primarily MMA-bound on NVIDIA Blackwell RTX GPUs, while softmax is a major bottleneck in forward attention on Blackwell data center GPUs.

Introduced with NVIDIA Blackwell architecture, NVFP4 offers hardware-accelerated 4-bit matrix multiplication, enabling higher Tensor Core throughput and creating an opportunity to accelerate attention beyond BF16. But sustaining high throughput requires careful coordination of softmax, data movement, and intermediate storage. Dependencies between these stages can leave Tensor Cores idle, limiting how effectively the kernel uses the available compute.

This post explains how to accelerate NVFP4 attention on the SM120 architecture through register recycling and improved scheduling. By reclaiming score registers after the softmax outputs have been packed into NVFP4, the next tile’s matrix multiplication can overlap with remaining softmax work on the current tile. This creates a more efficient pipeline that reduces Tensor Core idle time and improves utilization without requiring a second full score buffer.

Reactor, a developer platform that provides global low-latency infrastructure and APIs for deploying and scaling real-time video, robotics, and world models, integrated this kernel in their production serving stack to serve real customer traffic and saw tremendous speedups. Their benchmarks are shared in this post.

Improving throughput with NVFP4

NVIDIA RTX Blackwell has lower BF16 matmul throughput compared to the data center variants. While data center workloads are bounded by softmax (FlashAttention4 tries to solve this through pipelining and exp2 emulation), the NVIDIA RTX Blackwell is bounded by MMA on BF16 Attention. Due to higher TFLOP/s for NVFP4, throughput can be improved to achieve better performance.

Attention compute

The general attention computation and the two core matrix multiplications it involves are:

  • Query-Key matrix multiplication (\(QK\)): The first matmul in attention, \(QKᵀ\), where \(Q\) contains query vectors and \(K\) contains key vectors. It computes the attention scores used by softmax.
  • Attention-Weight Value matrix multiplication (\(PV\)): The second matmul in attention, \(PV\), where \(P\) contains softmax-derived attention weights and \(V\) contains value vectors. It combines the value vectors according to their attention weights to produce the output. In the tiled attention kernel discussed here, \(P\) contains unnormalized softmax weights, and final normalization is applied after the output has been accumulated across tiles (similar to FlashAttention).

How SageAttention3 accelerates attention using NVFP4

SageAttention3 is a native NVFP4 attention mechanism specifically designed for NVIDIA RTX Blackwell streaming multiprocessor (SM) 120. It performs both \(QK\) and \(PV\) using NVFP4​. Its primary innovation came from performing two-level scaling for \(P\).​

NVFP4 quantization generates two tensors: an NVFP4 data tensor and an FP8 scaling tensor. Because ​softmax outputs are bound to a narrow [0, 1] range, they can underutilize the NVFP4 dynamic range, resulting in accuracy degradation. Two-level scaling addresses this by first normalizing the values to fully utilize dynamic range before quantizing the result.

SageAttention3 cooperative thread array stable state design

The SageAttention3 cooperative thread array (CTA) design is as follows:

  • The CTA uses four producer warps and eight consumer warps. For each N128 tile, consumers execute \(QK\), softmax and probability quantization, and \(PV\) in sequence.
  • While consumers perform softmax, scaling, and quantization, tensor-core activity has gaps. Video 1 illustrates this sequential execution.
# Current SageAttention 3 CTA Execution (per N tile)
# CTA Structure: 12 warps total (4 Producer, 8 Consumer)

For each N tile:
    # 1. Producer Role: Data Loading
    # Q is loaded once per M tile
    AsyncLoad(Q)
    # K, V, Scale Factors, and delta_s use 3-stage async TMA pipeline
    AsyncLoad(K, V, Scale_Factors, delta_s)

    # 2. Consumer Role: Dependency Chain (Serial Execution)
    # 8 Consumer warps (256-thread MMA collective)

    # A. QK Computation
    Execute_QK_OMMA()
    Apply_delta_s_correction()

    # B. Softmax & Quantization
    Apply_Masking()
    Execute_Online_Softmax()
    Execute_NVFP4_Probability_Quantization()

    # C. PV Computation
    Execute_PV_OMMA()

    # Note: Execution is strictly serial per N tile
    # No overlapping or independent fragments in flight

The following observations can be drawn from this CTA design and the parallel thread execution (PTX) and instruction set architecture (ISA) for NVIDIA RTX Blackwell GPUs:

First, TMA Loads are bound to Shapes of 128×128, not utilizing the entire shape would mean underutilizing our GPU bandwidth.

Second, the NVIDIA Blackwell RTX OMMA operation remains constrained to m16, n8, k64 (where m and n represent LHS/RHS free dimensions, while k is the contraction axis), as specified by the PTX instruction mma.sync.aligned.kind::mxf4nvf4.block_scale.scale_vec::4X.m16n8k64.​

To cover the full contraction dimension of k=128, two MMA instructions with k=64 must be issued. The current CTA design issues these instructions for \(QK\) in succession. Because MMA execution is synchronous, the issuing consumer warps wait for completion before proceeding to online softmax and intermediate quantization.

This means that the operations within the stable loop are sequentially pipelined. There is a large gap in MMA activity, as there is no compute scheduled on the tensor cores. The warps are busy computing the softmax, scaling, and quantization operations.

Video 1 shows the attention-kernel timeline, including sequential \(QK\) matrix multiplication, softmax, and \(PV\) matrix multiplication.

Video 1. CTA timeline for original CTA design of SageAttention3

Register constraints

Producer warps use 3,072 registers, and consumer warps use 59,392 registers. The total of 62,464 registers occupies approximately 95.3% of the SM’s register capacity. This leaves little room to hold an additional score tile while processing the current tile.

Optimized CTA design

The design retains four producer warps, eight consumer warps, and complete N128 K/V tile loads. The change is in how consumers compute and store attention scores. Each N128 score tile is split into two N64 halves, and each occupies a separate register slot.

After one half has been exponentiated and quantized, its score registers are reused to compute the corresponding \(QK\) half of the next tile. This interleaves the next tile’s \(QK\) to work with the current tile’s remaining softmax, quantization, and \(PV\) operations.

The online-softmax state is still updated across the complete N128 score tile before either half is consumed.

Video 2 shows how this schedule fills gaps in tensor-core activity without allocating a second complete score tile.

Video 2. CTA Timeline for optimized SageAttention3

The following pseudocode illustrates the optimized schedule, including the initial score computation, steady-state register reuse, and processing of the final tile.

Unlike the original design, which completes \(QK\), softmax, quantization, and \(PV\) sequentially for each N128 tile, the optimized design splits the score tile into two N64 register slots. When half is quantized, its score registers are reused for the next tile’s \(QK\) computation. This allows work from adjacent tiles to be interleaved without allocating a second complete score tile, while retaining the same four producer warps and eight consumer warps.

# Optimized CuTe DSL CTA Execution
# N64/N64 Cross-Block Ping-Pong
# CTA Structure: 12 warps total (4 Producer, 8 Consumer)
#
# All 8 consumer warps remain active.
# Each N128 score tile is represented by two N64 register slots:
#   ScoreSlot0 = columns [0:64]
#   ScoreSlot1 = columns [64:128]

# 1. Producer Role: Three-Stage Data Pipeline
# Q and its scale factors are loaded once per M128 query tile.
AsyncLoad(Q, Q_ScaleFactors)

# Producer warps continuously prefetch complete N128 K/V tiles.
# K and V retain separate three-stage pipelines.
for N_tile in traversal_order:
    AsyncPrefetch(
          K[N_tile],
          V[N_tile],
          K_ScaleFactors[N_tile],
          V_ScaleFactors[N_tile],
          delta_s[N_tile],
      )


# 2. Consumer Prologue: Produce the First Score Tile
CurrentTile = First_N_Tile()

# Compute one complete QK score tile as two symmetric N64 halves.
ScoreSlot0 = Execute_QK_OMMA_N64(Q, K[CurrentTile, 0:64], delta_s[CurrentTile, 0:64],)
ScoreSlot1 = Execute_QK_OMMA_N64(Q, K[CurrentTile, 64:128], delta_s[CurrentTile, 64:128],)

  # 3. Consumer Steady State: Cross-Block Ping-Pong
  while HasNextTile(CurrentTile):
      NextTile = Next_N_Tile(CurrentTile)

      # Calculate the maximum, online-softmax update, and output rescaling
      # jointly across the complete current N128 score tile.
      Update_Online_Softmax_State(ScoreSlot0, ScoreSlot1, OnlineMax, OnlineSum,)
      Rescale_Output_Accumulator(Output, OnlineMax)

      # ---------------------------------------------------------------
      # Process current N64 half 0.
      # ---------------------------------------------------------------

      # Convert the current score half into packed NVFP4 probabilities.
      Probability0 = Exponentiate_And_NVFP4_Quantize(ScoreSlot0)

      # ScoreSlot0 is now dead. Reuse those same registers for QK belonging
      # to the next N tile-no second complete score allocation is needed.
      ScoreSlot0 = Execute_QK_OMMA_N64(Q, K[NextTile, 0:64], delta_s[NextTile, 0:64],)

      # Accumulate the current tile's first probability half into the output.
      Output += Execute_PV_OMMA_N64(Probability0, V[CurrentTile, 0:64],)

      # ---------------------------------------------------------------
      # Process current N64 half 1.
      # ---------------------------------------------------------------
      Probability1 = Exponentiate_And_NVFP4_Quantize(ScoreSlot1)
      # Reuse the second dead score slot for the next tile.
      ScoreSlot1 = Execute_QK_OMMA_N64(Q, K[NextTile, 64:128], delta_s[NextTile, 64:128],)
      Output += Execute_PV_OMMA_N64(Probability1, V[CurrentTile, 64:128],)

      # ScoreSlot0 and ScoreSlot1 now contain the complete score for NextTile,
      # while PV for CurrentTile has finished.
      CurrentTile = NextTile

  # 4. Pipeline Drain: Consume the Final Score Tile

  # There is no following tile, so the final score slots are not overwritten
  # with another QK operation.
  Update_Online_Softmax_State(ScoreSlot0, ScoreSlot1, OnlineMax, OnlineSum,)
  Rescale_Output_Accumulator(Output, OnlineMax)
  Probability0 = Exponentiate_And_NVFP4_Quantize(ScoreSlot0)
  Output += Execute_PV_OMMA_N64(Probability0, V[CurrentTile, 0:64],)
  Probability1 = Exponentiate_And_NVFP4_Quantize(ScoreSlot1)
  Output += Execute_PV_OMMA_N64(Probability1, V[CurrentTile, 64:128],)

  # 5. Epilogue
  Output = Output / OnlineSum
  AsyncStore_BF16(Output)

NVFP4 attention kernel integration latency results

Reactor evaluated the optimized kernel on an NVIDIA RTX PRO 6000 Blackwell Server Edition GPU with 96 GB of memory (SM120), measuring its impact across four world-model workloads.

Attention kernel speedup

To isolate the scheduling optimization, the original and optimized NVFP4 kernels were compared using identical \(Q/K/V\) inputs, packed tensors, and log-sum-exp settings.

Workload / maskOriginal (ms)Optimized (ms)Speedup
LongLive 7,040 / noncausal0.750520.635481.18x
LongLive 7,040 / causal0.449920.379271.19x
Synthetic 4,096 / noncausal0.289620.231901.25x
Synthetic 4,096 / causal0.211990.160871.32x
Synthetic 8,192 / noncausal1.001770.856481.17x
Synthetic 8,192 / causal0.764660.466591.64x
Synthetic 16,384 / noncausal3.808623.253771.17x
Synthetic 16,384 / causal2.206301.781521.24x
Table 1. Core NVFP4 latency before and after optimization on NVIDIA RTX PRO 6000 Blackwell

All cases use batch size 1, 24 heads, head dimension 128, and equal query/key lengths. The 7,040-token input was captured from LongLive; the other inputs are synthetic. Core timing excludes Q/K/V quantization and output-stride restoration

Measurements used three fresh processes per implementation, alternating run order, active prewarming, and repeated CUDA-event timing blocks.

End-to-end model inference performance

Reactor integrated this NVFP4 attention kernel into its production serving infrastructure and used it to serve real customer traffic across several models. Table 2 shows the impact on end-to-end model inference latency on NVIDIA RTX PRO 6000 Blackwell.

Latency was measured for the complete model path per video chunk, full generation, or action prediction. The table specifies which attention operations use NVFP4; other attention operations and model weights remain BF16. The terms idle and moving refer to camera scenarios with the same NVFP4 coverage.

For the video-chunk and action-prediction benchmarks, the BF16 baseline uses native cuDNN attention. Timings include quantization, layout conversion, and decoded CPU-frame or action output, but exclude model loading, warmup, networking, queueing, and client pacing.

Model / scenarioMeasured outputAttention using NVFP4BF16
E2E latency
(s)
NVFP4
E2E latency
(s)
Latency reduction
LongLive32 frames
704 × 1280
Self-attention +
cached history
5.134.796.70%
Helios33 frames
384 × 640
11,280-token
self-attention only
5.945.841.70%
Helios33 frames
384 × 640
All self-attention calls5.945.871.11%
OmniDreams – idle8 frames
704 × 1280
Self-attention +
cached history
0.600.5114.77%
OmniDreams – moving8 frames
704 × 1280
Self-attention +
cached history
0.600.5114.95%
Cosmos 3 Nano
Policy Droid (pilot)
32 × 8 action
prediction
Dense generator attention only1.721.691.70%
LongLive
(long run)
1,021 frames
32 chunks
Self-attention +
cached history
162.52151.896.54%
Helios
(long run)
1,056 frames
32 chunks
Largest self-attention
calls only
190.88187.481.78%
Helios
(long run)
1,056 frames
32 chunks
All supported
self-attention
190.88188.361.32%
OmniDreams – idle
(long run)
1,021 frames
128 chunks
Self-attention +
cached history
77.3465.7914.94%
OmniDreams – moving
(long run)
1,021 frames
128 chunks
Self-attention +
cached history
77.7765.9515.20%
OmniDreams – idle
(long run)
2,045 frames
256 chunks
Self-attention +
cached history
155.44131.8415.18%
OmniDreams – moving
(long run)
2,045 frames
256 chunks
Self-attention +
cached history
155.92132.0015.34%
Table 2. End-to-end inference latency on NVIDIA RTX PRO 6000 Blackwell with BF16 and NVFP4 attention, measured for the output listed in each row

Long-run rows measure complete warmed generations through decoded CPU frames, excluding model loading and transport. LongLive and Helios report medians of three independent process runs per arm using eager execution; OmniDreams reports one process per arm/scenario. Latency reductions are calculated from unrounded measurements.

Get started accelerating NVFP4 attention

The scheduling and score-register reuse techniques described in this post improve NVFP4 attention performance on NVIDIA RTX Blackwell. This approach helps accelerate world model inference. The core optimization has been merged into the FlashInfer main branch.

To learn how Reactor integrated this kernel into production to serve real customer traffic, refer to Integrating NVFP4 Attention into Real-Time Models on Reactor.

Ready to get started accelerating NVFP4 attention?

Acknowledgments

We thank the Reactor team for sharing their measurements and supporting our evaluation of NVFP4 attention across world models.

Discuss (0)

Tags

Agentic AI / Generative AI | Developer Tools & Techniques | Simulation / Modeling / Design | General | Blackwell | Hopper | Intermediate Technical | Tutorial | AI Inference | Inference Performance | NVFP4 | RTX GPU

About the Authors

Avatar photo About Atharva Joshi
Atharva Joshi is a deep learning algorithms engineer at NVIDIA, focused on kernel performance and inference optimization for world foundation models, including NVIDIA Cosmos. His expertise and technical interests span GPU kernel development, ML accelerator architectures, and hardware-aware optimization for efficient training and inference. He holds a master’s degree in Computer Science from the University of Southern California. View all posts by Atharva Joshi

Comments