# DSA state update from an fp32 split row (`dsa_fp32_split_state_update`) | ServingStudio Kernel Library

From one fp32 GEMM row per token: q/kv RMSNorm, FP8 MLA cache append, indexer k LayerNorm and the pooled index-cache update, in one launch.

When a DSA layer's hidden-state projections run as one GEMM with an fp32 output (columns \[q latent | kv latent | indexer k | gate score | fp32 head weights\]), this one launch writes every decode state that depends on that row. Row programs round the q latent to bf16 and RMSNorm it into bf16, and round the kv latent to bf16, RMSNorm it and store it as FP8 (divided by the static kv scale) at the token's MLA cache slot. One program per request rounds its next_n indexer-k and gate-score rows to bf16, LayerNorms k (fp32 weight and bias), writes both, stashes each token in the request's tail ring and compresses every pool a token completes (softmax over gate score plus a per-slot bias, Hadamard-128, FP8 with a power-of-two scale) into the page-planar index cache. Positions are read as int64. Request r's first row sits at pool phase pool_size - 1 - (r mod pool_size).

Category: Attention; group: DSA. Interactive page: https://servingstudio.cs.washington.edu/kernels.html?kind=dsa_fp32_split_state_update. All kernel kinds: https://servingstudio.cs.washington.edu/kernels.md.

## Formula

- `qn = RMSNorm(bf16(y[:, :Q])); cache[slot] = FP8(bf16(RMSNorm(bf16(y[:, Q:Q+KV]))) / s)`
- `k = bf16(LayerNorm(bf16(y[:, Q+KV:Q+KV+D]))); gs = bf16(y[:, Q+KV+D:Q+KV+2D]); pooled index update as dsa_pooled_index_cache_update`
- `R = num_requests · next_n; C = completed pools`
- `B = R · [4(Q + KV + 2D) + 2Q + KV + 8D + 20] + C · [(pool_size − 1) · 4D + D + 4]`
- `GB/s = B / time`

## How it is measured

GPU kernel time from CUPTI activity records, averaged over repeated launches in one capture. The L2 cache is flushed before each launch, so the numbers are cold-cache times. One launch per call. Before timing, the launch is checked against the incumbent chain it replaces (the vendored row-split post_a, the vLLM fork's fused_q_kv_rmsnorm, concat_and_cache_mla in fp8 and the fork's kpool_decode_update_and_maybe_write_cache_batched on int32 positions): the normed q, gate scores, MLA cache and index cache / tail ring bit-identical (the fork kpool fed this launch's k), and k within 1 bf16 ulp of post_a.

## Caveats

- The triton backend has its row geometry compiled in (1536 q, 512 kv, 128 indexer columns, 8 warps) and refuses any other.
- Decode rows only: every request has next_n rows and owns a pooled-cache tail block; prefill rows keep the separate launches.
- On SM100-family GPUs the index-cache scale is four equal UE8M0 bytes, elsewhere an FP32; the device picks it, so it is not a key field.

## Arguments

| Argument | Type | Unit | Meaning |
| --- | --- | --- | --- |
| `num_requests` | number | requests | Decode requests in the step (one program each). |
| `next_n` | number | tokens | Rows per request in this step (1 for plain decode). |
| `q_lora_cols` | number | elements | Leading query-latent columns, RMSNormed into bf16. |
| `kv_lora_cols` | number | elements | KV-latent columns, RMSNormed and appended to the FP8 MLA cache. |
| `index_dim` | number | elements | Indexer key columns (LayerNormed) and as many gate-score columns after them. |
| `fp32_tail_cols` | number | elements | Last columns of each row, left in place as fp32 (not read). |
| `pool_size` | number | tokens | Tokens compressed into one cached index key. |
| `tail_ring` | number | tokens | Slots in each request's raw-token tail ring. |
| `block_size` | number | pools | Pooled keys stored in each index-cache page. |

## Metrics

- Time (`time_ms`, ms)
- Throughput (`tflops`, TFLOPS)
- Memory bandwidth (`memory_bandwidth_gbps`, GB/s)
- Energy (`energy_j`, J)

## Backends

- `triton`: A repo-vendored Triton kernel (post_plus): 2·rows row programs for the q/kv norms and cache append, then one program per request for k, gate and the pooled index update; request programs launch first. compute capability 8.9 or newer, GPUs H100-SXM5-80GB, H100-PCIe-80GB, H200-SXM-141GB, B200-SXM-180GB, B300-SXM-288GB, GB200-Superchip, H800-SXM5-80GB, H20-SXM-96GB, L40, L40S, L4.

## Measured rows

26 rows in all.

| GPU | Backend | Precision | Rows |
| --- | --- | --- | --- |
| NVIDIA B200 | `triton` |  | 26 |

## Used by these deployments

- [GLM-5.3-Flash NVFP4: ServingStudio design: DP attention, KDA TP groups, fused EP MoE, DFlash speculative decoding](https://servingstudio.cs.washington.edu/models/GLM-5.3-Flash-NVFP4/glm53_flash_nvfp4_dp_attn_kda_tp_fused_ep_moe_dflash2.md) (`GLM-5.3-Flash-NVFP4/glm53_flash_nvfp4_dp_attn_kda_tp_fused_ep_moe_dflash2`)

## API

- This kind: https://servingstudio.cs.washington.edu/api/public/v1/kernels/dsa_fp32_split_state_update
- Measured rows: https://servingstudio.cs.washington.edu/api/public/v1/kernels/dsa_fp32_split_state_update/rows (filter by any column, such as `?gpu=NVIDIA%20H200`; `format=csv` for CSV)
- Configs the public deployments ask of it: https://servingstudio.cs.washington.edu/api/public/v1/kernels/dsa_fp32_split_state_update/configs

---

This page as Markdown: https://servingstudio.cs.washington.edu/kernels/dsa_fp32_split_state_update.md. A guide to the whole site for AI agents: [llms.txt](https://servingstudio.cs.washington.edu/llms.txt).
