# Indexer candidate block scores (`candidate_block_max`) | ServingStudio Kernel Library

Reduce each row's indexer logits to per-block maxima for candidate selection.

Row i's valid logits are its key window; every block of block_size keys scores its maximum (capped at the largest finite bf16), the last valid block scores +inf so selection always keeps it.

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

## Formula

- `bytes = 2 · P + 2 · P / block_size + 8 · num_queries, P = valid logits`

## 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. Both launches count. Checked against DeepInfer's candidate_block_max_ref first.

## Arguments

| Argument | Type | Unit | Meaning |
| --- | --- | --- | --- |
| `num_queries` | number | tokens | Logits rows of the chunk. |
| `context_len` | number | tokens | Context of the request, the rows included; the rows are its last tokens. |
| `compress_ratio` | number | tokens | Context tokens per compressed index key. |
| `block_size` | number | tokens | Keys per scored block. |
| `dtype` | dtype |  | Element type of the logits and block scores (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 candidate_block_max (two launches). 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

169 rows in all.

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

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

---

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