# RMSNorm with MXFP8 cast (`rms_norm_mxfp8`) | ServingStudio Kernel Library

RMSNorm whose output is cast to E4M3 with packed UE8M0 scales in one launch.

Each row is RMS-normalized, scaled by the weight and cast to E4M3 with one rounded UE8M0 scale per 32 elements; the scales are packed four to an int32 in the TMA-aligned column-major layout. Optionally the bf16 normalized row is written too.

Category: Normalization; group: RMSNorm. Interactive page: https://servingstudio.cs.washington.edu/kernels.html?kind=rms_norm_mxfp8. All kernel kinds: https://servingstudio.cs.washington.edu/kernels.md.

## Formula

- `bytes = 2·T·hidden read + T·hidden (+ 2·T·hidden for bf16) + T·hidden/32 written`

## 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.

## Arguments

| Argument | Type | Unit | Meaning |
| --- | --- | --- | --- |
| `num_tokens` | number | tokens | Rows normalized. |
| `hidden` | number | elements | Features normalized per row. |
| `return_bf16` | label |  | Whether the bf16 normalized rows are written too. |
| `dtype` | dtype |  | Input and weight element type (bf16). |

## Metrics

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

## Backends

- `tilelang`: DeepInfer's TileLang norm with get_fp8_cast_params(), checked by DeepInfer's test_norm at the same hidden size and output form. dtypes `bf16`, compute capability 9.0 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.

## Measured rows

179 rows in all.

| GPU | Backend | Precision | Rows |
| --- | --- | --- | --- |
| NVIDIA B200 | `tilelang` | `bf16` | 179 |

## Used by these deployments

- [DeepSeek V4.1 Flash 1017: vLLM or DeepInfer, DP attention, EP MoE](https://servingstudio.cs.washington.edu/models/DeepSeek-V4.1-Flash-1017/deepseek_v41_vllm_dp_attn_ep_moe.md) (`DeepSeek-V4.1-Flash-1017/deepseek_v41_vllm_dp_attn_ep_moe`)
- [DeepSeek V4.1 Flash 1017: vLLM, DP attention, EP MoE, DSpark speculative decoding](https://servingstudio.cs.washington.edu/models/DeepSeek-V4.1-Flash-1017/deepseek_v41_vllm_dp_attn_ep_moe_dspark.md) (`DeepSeek-V4.1-Flash-1017/deepseek_v41_vllm_dp_attn_ep_moe_dspark`)

## API

- This kind: https://servingstudio.cs.washington.edu/api/public/v1/kernels/rms_norm_mxfp8
- Measured rows: https://servingstudio.cs.washington.edu/api/public/v1/kernels/rms_norm_mxfp8/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/rms_norm_mxfp8/configs

---

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