# FP32-accumulate GEMM (`gemm_fp32_accumulate`) | ServingStudio Kernel Library

Add a bf16 matrix product into an existing fp32 matrix in place.

DeepInfer's DFlash draft head adds a rank-k Markov correction to each draft step's fp32 logits: C += A·Bᵀ with the step's token embeddings as A and the vocabulary projection as B. m is the rows (requests), n the vocabulary, k the Markov rank.

Category: GEMM. Interactive page: https://servingstudio.cs.washington.edu/kernels.html?kind=gemm_fp32_accumulate. All kernel kinds: https://servingstudio.cs.washington.edu/kernels.md.

## Formula

- `C[m, n] += A[m, k] · B[n, k]ᵀ, C fp32`
- `TFLOPS = 2·m·n·k / time`
- `GB/s = [bytes(input_dtype)·(m·k + n·k) + 8·m·n] / 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. Every launch of the call is counted.

## Caveats

- C is contiguous; DeepInfer accumulates into every fifth row of the draft logits (a strided view), measured within 4% of contiguous.

## Arguments

| Argument | Type | Unit | Meaning |
| --- | --- | --- | --- |
| `m` | number | tokens | Rows of the activation and of the accumulated matrix. |
| `n` | number | elements | Output features in the weight. |
| `k` | number | elements | Input features, the reduction dimension. |
| `input_dtype` | dtype |  | Element type of the activation and weight; the accumulator is fp32. |

## Metrics

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

## Backends

- `deepgemm_cublaslt`: DeepGEMM bf16_gemm_nt(a, b, d, c=d) into an fp32 d, as DeepInfer's ReplicatedLinear(out_acc=...) calls it; cuBLASLt with beta = 1. dtypes `bf16`, any CUDA GPU. Source: https://github.com/deepseek-ai/DeepGEMM

## Measured rows

55 rows in all.

| GPU | Backend | Precision | Rows |
| --- | --- | --- | --- |
| NVIDIA B200 | `deepgemm_cublaslt` | `bf16` | 55 |

## Used by these deployments

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

---

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