vllm.v1.attention.backends.utils
AttentionMetadataBuilder
¶
Source code in vllm/v1/attention/backends/utils.py
build
abstractmethod
¶
build(
common_prefix_len: int,
common_attn_metadata: CommonAttentionMetadata,
) -> M
Central method that builds attention metadata. Some builders (MLA) require reorder_batch to be called prior to build.
Source code in vllm/v1/attention/backends/utils.py
build_for_cudagraph_capture
¶
build_for_cudagraph_capture(
common_attn_metadata: CommonAttentionMetadata,
) -> M
Build attention metadata for CUDA graph capture. Uses build by default. Subclasses that override this method should call self.build or super().build_for_cudagraph_capture.
Source code in vllm/v1/attention/backends/utils.py
can_run_in_cudagraph
¶
can_run_in_cudagraph(
common_attn_metadata: CommonAttentionMetadata,
) -> bool
Can this batch (with given metadata) use CUDA Graphs for attention.
reorder_batch
¶
reorder_batch(
input_batch: InputBatch,
scheduler_output: SchedulerOutput,
) -> bool
This method can reorder the batch if desired by the backend. :return: Has the batch been reordered (default False).
Source code in vllm/v1/attention/backends/utils.py
CommonAttentionMetadata
dataclass
¶
Per-batch attention metadata, shared across layers and backends. AttentionMetadataBuilder instances use it to construct per-layer metadata.
Source code in vllm/v1/attention/backends/utils.py
get_kv_cache_layout
cached
¶
Source code in vllm/v1/attention/backends/utils.py
make_local_attention_virtual_batches
¶
make_local_attention_virtual_batches(
attn_chunk_size: int,
query_start_loc_np: ndarray,
seq_lens_np: ndarray,
block_table: Tensor,
block_size: int = 0,
) -> tuple[ndarray, ndarray, ndarray, Tensor]
Source code in vllm/v1/attention/backends/utils.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|