---
id: pr-sglang-21104
repo: sgl-project/sglang
pr: 21104
title: 'perf: precompute FA3 scheduler_metadata to eliminate per-layer prepare_varlen_num_blocks'
author: zminglei
date: '2026-04-10'
url: https://github.com/sgl-project/sglang/pull/21104
source_category: upstream-code
architectures:
- sm100
tags:
- attention_kv
- sampling kernel
- scheduler_autotune
techniques:
- autotuning
- cache-policy
- tile-scheduling
hardware_features: []
kernel_types:
- attention
- decode
- sampling
- scheduler
languages:
- cuda-cpp
captured_at: '2026-05-16'
status: merged
merge_sha: 6af34b95b6536d096bc768797c097dc68c432a9c
inclusion_reason: Preserve page/KV/layout and plan-run contracts; profile memory traffic separately from math utilization.
changed_paths:
- python/sglang/srt/layers/attention/flashattention_backend.py
artifact_dir: evidence/pull-bundles/sglang/gh-21104
head_ref_oid: d9c53432c7c3f07a2248eb4aa1ee4433fcca8ecc
---
# perf: precompute FA3 scheduler_metadata to eliminate per-layer prepare_varlen_num_blocks

- Repository: `sgl-project/sglang`
- PR: [21104](https://github.com/sgl-project/sglang/pull/21104)
- Decision: `Preserve page/KV/layout and plan-run contracts; profile memory traffic separately from math utilization.`
- Reason: Preserve page/KV/layout and plan-run contracts; profile memory traffic separately from math utilization.

## Changed Paths

- `python/sglang/srt/layers/attention/flashattention_backend.py`

## Evidence Bundle

`evidence/pull-bundles/sglang/gh-21104`
