{"slug": "how-to-optimize-nvfp4-attention-on-nvidia-rtx-blackwell-through-register", "title": "How to Optimize NVFP4 Attention on NVIDIA RTX Blackwell Through Register Recycling", "summary": "NVIDIA detailed a register-recycling technique that accelerates NVFP4 attention on its RTX PRO 6000 Blackwell Series (SM120) GPUs by reclaiming score registers after softmax outputs are packed into NVFP4, letting the next tile's matrix multiplication overlap with remaining softmax work without a second full score buffer. Reactor, a developer platform for real-time video, robotics and world models, integrated the kernel into its production serving stack and reported \"tremendous speedups\" on real customer traffic, though the post did not disclose specific figures. The work matters because BF16 attention on RTX Blackwell is MMA-bound rather than softmax-bound like data center GPUs, and NVFP4's higher Tensor Core throughput can lift attention performance only if softmax, data movement and intermediate storage are scheduled together.", "body_md": "Attention can be a major bottleneck when serving [world foundation models](https://www.nvidia.com/en-us/glossary/world-models/), where long sequences make inference computationally demanding. On [NVIDIA Hopper](https://www.nvidia.com/en-us/data-center/technologies/hopper-architecture/) and [NVIDIA Blackwell](https://www.nvidia.com/en-us/data-center/technologies/blackwell-architecture/) data center GPUs, FlashAttention3 and FlashAttention4 improve attention performance by overlapping matrix multiply-accumulate (MMA) operations through softmax within a thread block.\n\nHowever, these hardware-specific pipelines cannot be applied directly to the [NVIDIA](https://www.nvidia.com/en-us/products/workstations/professional-desktop-gpus/rtx-pro-6000-family/) [RTX PRO 6000](https://www.nvidia.com/en-us/products/workstations/professional-desktop-gpus/rtx-pro-6000-family/) [Blackwell Series](https://www.nvidia.com/en-us/products/workstations/professional-desktop-gpus/rtx-pro-6000-family/) (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.\n\nIntroduced with NVIDIA Blackwell architecture, [NVFP4](https://developer.nvidia.com/blog/introducing-nvfp4-for-efficient-and-accurate-low-precision-inference/) 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.\n\nThis 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.\n\n[Reactor](https://www.reactor.inc/), 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.\n\n## Improving throughput with NVFP4\n\nNVIDIA 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.\n\n### Attention compute\n\nThe general attention computation and the two core matrix multiplications it involves are:\n\n- **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.\n- **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).\n\n### How SageAttention3 accelerates attention using NVFP4\n\n[SageAttention3](https://arxiv.org/pdf/2505.11594) 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$.\n\nNVFP4 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.\n\n### SageAttention3 cooperative thread array stable state design\n\nThe SageAttention3 cooperative thread array (CTA) design is as follows:\n\n- 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.\n- While consumers perform softmax, scaling, and quantization, tensor-core activity has gaps. Video 1 illustrates this sequential execution.\n\n```\n# Current SageAttention 3 CTA Execution (per N tile)\n# CTA Structure: 12 warps total (4 Producer, 8 Consumer)\n\nFor each N tile:\n    # 1. Producer Role: Data Loading\n    # Q is loaded once per M tile\n    AsyncLoad(Q)\n    # K, V, Scale Factors, and delta_s use 3-stage async TMA pipeline\n    AsyncLoad(K, V, Scale_Factors, delta_s)\n\n    # 2. Consumer Role: Dependency Chain (Serial Execution)\n    # 8 Consumer warps (256-thread MMA collective)\n\n    # A. QK Computation\n    Execute_QK_OMMA()\n    Apply_delta_s_correction()\n\n    # B. Softmax & Quantization\n    Apply_Masking()\n    Execute_Online_Softmax()\n    Execute_NVFP4_Probability_Quantization()\n\n    # C. PV Computation\n    Execute_PV_OMMA()\n\n    # Note: Execution is strictly serial per N tile\n    # No overlapping or independent fragments in flight\n```\n\nThe 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:\n\nFirst, TMA Loads are bound to Shapes of 128×128, not utilizing the entire shape would mean underutilizing our GPU bandwidth.\n\nSecond, 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`.\n\nTo 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.\n\nThis 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.\n\nVideo 1 shows the attention-kernel timeline, including sequential $QK$ matrix multiplication, softmax, and $PV$ matrix multiplication.\n\n#### Register constraints\n\nProducer 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.\n\n#### Optimized CTA design\n\nThe 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.\n\nAfter 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.\n\nThe online-softmax state is still updated across the complete N128 score tile before either half is consumed.\n\nVideo 2 shows how this schedule fills gaps in tensor-core activity without allocating a second complete score tile.\n\nThe following pseudocode illustrates the optimized schedule, including the initial score computation, steady-state register reuse, and processing of the final tile.\n\nUnlike 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.\n\n```\n# Optimized CuTe DSL CTA Execution\n# N64/N64 Cross-Block Ping-Pong\n# CTA Structure: 12 warps total (4 Producer, 8 Consumer)\n#\n# All 8 consumer warps remain active.\n# Each N128 score tile is represented by two N64 register slots:\n#   ScoreSlot0 = columns [0:64]\n#   ScoreSlot1 = columns [64:128]\n\n# 1. Producer Role: Three-Stage Data Pipeline\n# Q and its scale factors are loaded once per M128 query tile.\nAsyncLoad(Q, Q_ScaleFactors)\n\n# Producer warps continuously prefetch complete N128 K/V tiles.\n# K and V retain separate three-stage pipelines.\nfor N_tile in traversal_order:\n    AsyncPrefetch(\n          K[N_tile],\n          V[N_tile],\n          K_ScaleFactors[N_tile],\n          V_ScaleFactors[N_tile],\n          delta_s[N_tile],\n      )\n\n# 2. Consumer Prologue: Produce the First Score Tile\nCurrentTile = First_N_Tile()\n\n# Compute one complete QK score tile as two symmetric N64 halves.\nScoreSlot0 = Execute_QK_OMMA_N64(Q, K[CurrentTile, 0:64], delta_s[CurrentTile, 0:64],)\nScoreSlot1 = Execute_QK_OMMA_N64(Q, K[CurrentTile, 64:128], delta_s[CurrentTile, 64:128],)\n\n  # 3. Consumer Steady State: Cross-Block Ping-Pong\n  while HasNextTile(CurrentTile):\n      NextTile = Next_N_Tile(CurrentTile)\n\n      # Calculate the maximum, online-softmax update, and output rescaling\n      # jointly across the complete current N128 score tile.\n      Update_Online_Softmax_State(ScoreSlot0, ScoreSlot1, OnlineMax, OnlineSum,)\n      Rescale_Output_Accumulator(Output, OnlineMax)\n\n      # ---------------------------------------------------------------\n      # Process current N64 half 0.\n      # ---------------------------------------------------------------\n\n      # Convert the current score half into packed NVFP4 probabilities.\n      Probability0 = Exponentiate_And_NVFP4_Quantize(ScoreSlot0)\n\n      # ScoreSlot0 is now dead. Reuse those same registers for QK belonging\n      # to the next N tile-no second complete score allocation is needed.\n      ScoreSlot0 = Execute_QK_OMMA_N64(Q, K[NextTile, 0:64], delta_s[NextTile, 0:64],)\n\n      # Accumulate the current tile's first probability half into the output.\n      Output += Execute_PV_OMMA_N64(Probability0, V[CurrentTile, 0:64],)\n\n      # ---------------------------------------------------------------\n      # Process current N64 half 1.\n      # ---------------------------------------------------------------\n      Probability1 = Exponentiate_And_NVFP4_Quantize(ScoreSlot1)\n      # Reuse the second dead score slot for the next tile.\n      ScoreSlot1 = Execute_QK_OMMA_N64(Q, K[NextTile, 64:128], delta_s[NextTile, 64:128],)\n      Output += Execute_PV_OMMA_N64(Probability1, V[CurrentTile, 64:128],)\n\n      # ScoreSlot0 and ScoreSlot1 now contain the complete score for NextTile,\n      # while PV for CurrentTile has finished.\n      CurrentTile = NextTile\n\n  # 4. Pipeline Drain: Consume the Final Score Tile\n\n  # There is no following tile, so the final score slots are not overwritten\n  # with another QK operation.\n  Update_Online_Softmax_State(ScoreSlot0, ScoreSlot1, OnlineMax, OnlineSum,)\n  Rescale_Output_Accumulator(Output, OnlineMax)\n  Probability0 = Exponentiate_And_NVFP4_Quantize(ScoreSlot0)\n  Output += Execute_PV_OMMA_N64(Probability0, V[CurrentTile, 0:64],)\n  Probability1 = Exponentiate_And_NVFP4_Quantize(ScoreSlot1)\n  Output += Execute_PV_OMMA_N64(Probability1, V[CurrentTile, 64:128],)\n\n  # 5. Epilogue\n  Output = Output / OnlineSum\n  AsyncStore_BF16(Output)\n```\n\n## NVFP4 attention kernel integration latency results\n\nReactor evaluated the optimized kernel on an [NVIDIA RTX PRO 6000 Blackwell Server Edition](https://www.nvidia.com/en-us/data-center/rtx-pro-6000-blackwell-server-edition/) GPU with 96 GB of memory (SM120), measuring its impact across four world-model workloads.\n\n### Attention kernel speedup\n\nTo 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.\n\n| **Workload / mask** | **Original (ms)** | **Optimized (ms)** | **Speedup** | \n|---|---|---|---|\n| LongLive 7,040 / noncausal | 0.75052 | 0.63548 | 1.18x | \n| LongLive 7,040 / causal | 0.44992 | 0.37927 | 1.19x | \n| Synthetic 4,096 / noncausal | 0.28962 | 0.23190 | 1.25x | \n| Synthetic 4,096 / causal | 0.21199 | 0.16087 | 1.32x | \n| Synthetic 8,192 / noncausal | 1.00177 | 0.85648 | 1.17x | \n| Synthetic 8,192 / causal | 0.76466 | 0.46659 | 1.64x | \n| Synthetic 16,384 / noncausal | 3.80862 | 3.25377 | 1.17x | \n| Synthetic 16,384 / causal | 2.20630 | 1.78152 | 1.24x | \n\n*Table 1. Core NVFP4 latency before and after optimization on NVIDIA RTX PRO 6000 Blackwell*\nAll 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\n\nMeasurements used three fresh processes per implementation, alternating run order, active prewarming, and repeated CUDA-event timing blocks.\n\n### End-to-end model inference performance\n\nReactor 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.\n\nLatency 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.\n\nFor 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.\n\n| **Model / scenario** | **Measured output** | **Attention using NVFP4** | **BF16****E2E latency****(s)** | **NVFP4****E2E latency****(s)** | **Latency reduction** | \n|---|---|---|---|---|---|\n| LongLive | 32 frames 704 × 1280 | Self-attention + cached history | 5.13 | 4.79 | 6.70% | \n| Helios | 33 frames 384 × 640 | 11,280-token self-attention only | 5.94 | 5.84 | 1.70% | \n| Helios | 33 frames 384 × 640 | All self-attention calls | 5.94 | 5.87 | 1.11% | \n| OmniDreams – idle | 8 frames 704 × 1280 | Self-attention + cached history | 0.60 | 0.51 | 14.77% | \n| OmniDreams – moving | 8 frames 704 × 1280 | Self-attention + cached history | 0.60 | 0.51 | 14.95% | \n| Cosmos 3 Nano Policy Droid (pilot) | 32 × 8 action prediction | Dense generator attention only | 1.72 | 1.69 | 1.70% | \n| LongLive (long run) | 1,021 frames 32 chunks | Self-attention + cached history | 162.52 | 151.89 | 6.54% | \n| Helios (long run) | 1,056 frames 32 chunks | Largest self-attention calls only | 190.88 | 187.48 | 1.78% | \n| Helios (long run) | 1,056 frames 32 chunks | All supported self-attention | 190.88 | 188.36 | 1.32% | \n| OmniDreams – idle (long run) | 1,021 frames 128 chunks | Self-attention + cached history | 77.34 | 65.79 | 14.94% | \n| OmniDreams – moving (long run) | 1,021 frames 128 chunks | Self-attention + cached history | 77.77 | 65.95 | 15.20% | \n| OmniDreams – idle (long run) | 2,045 frames 256 chunks | Self-attention + cached history | 155.44 | 131.84 | 15.18% | \n| OmniDreams – moving (long run) | 2,045 frames 256 chunks | Self-attention + cached history | 155.92 | 132.00 | 15.34% | \n\n*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*\nLong-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.\n\n## Get started accelerating NVFP4 attention\n\nThe 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](https://github.com/flashinfer-ai/flashinfer/pull/4502).\n\nTo learn how Reactor integrated this kernel into production to serve real customer traffic, refer to [Integrating NVFP4 Attention into Real-Time Models on Reactor](https://www.reactor.inc/blog/nvfp4-attention-world-models).\n\nReady to get started accelerating NVFP4 attention?\n\n- [Clone the](https://github.com/flashinfer-ai/flashinfer) [FlashInfer](https://github.com/flashinfer-ai/flashinfer) [main branch](https://github.com/flashinfer-ai/flashinfer) with its submodules and follow the[source installation guide](https://docs.flashinfer.ai/installation.html#install-from-source) .\n- Integrate the [SM120 NVFP4 attention API](https://docs.flashinfer.ai/generated/flashinfer.nvfp4_attention_sm120.nvfp4_attention_sm120_fwd.html) into supported attention layers in your model on NVIDIA RTX Blackwell, then compare end-to-end latency and output quality against your BF16 baseline.\n\n### Acknowledgments\n\n*We thank the Reactor team for sharing their measurements and supporting our evaluation of NVFP4 attention across world models.*", "url": "https://wpnews.pro/news/how-to-optimize-nvfp4-attention-on-nvidia-rtx-blackwell-through-register", "canonical_source": "https://developer.nvidia.com/blog/how-to-optimize-nvfp4-attention-on-nvidia-rtx-blackwell-through-register-recycling/", "published_at": "2026-11-25 19:30:00+00:00", "updated_at": "2026-11-25 19:43:20.368255+00:00", "lang": "en", "topics": ["ai-infrastructure", "ai-chips", "machine-learning", "ai-research"], "entities": ["NVIDIA", "RTX PRO 6000 Blackwell Series", "NVFP4", "SM120", "Reactor", "SageAttention3", "FlashAttention3", "FlashAttention4"], "also_reported_by": [], "takeaway": "Recycle score registers once softmax outputs are packed into NVFP4 so the next tile's MMA overlaps the current tile's remaining softmax, avoiding a second full score buffer and cutting Tensor Core idle time on SM120 RTX Blackwell GPUs.", "recommendation": {"advice": "On RTX Blackwell (SM120), pack softmax outputs to NVFP4 and recycle the freed score registers so the next tile's matmul overlaps remaining softmax, keeping Tensor Cores busy without a second score buffer.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/how-to-optimize-nvfp4-attention-on-nvidia-rtx-blackwell-through-register", "markdown": "https://wpnews.pro/news/how-to-optimize-nvfp4-attention-on-nvidia-rtx-blackwell-through-register.md", "text": "https://wpnews.pro/news/how-to-optimize-nvfp4-attention-on-nvidia-rtx-blackwell-through-register.txt", "jsonld": "https://wpnews.pro/news/how-to-optimize-nvfp4-attention-on-nvidia-rtx-blackwell-through-register.jsonld"}}