vllm.v1.attention.backends.mla.indexer ¶
DeepSeekV32IndexerDecodeMetadata dataclass
¶
Source code in vllm/v1/attention/backends/mla/indexer.py
DeepseekV32IndexerBackend ¶
Bases: AttentionBackend
Source code in vllm/v1/attention/backends/mla/indexer.py
get_builder_cls staticmethod
¶
get_builder_cls() -> type[
DeepseekV32IndexerMetadataBuilder
]
get_kv_cache_shape staticmethod
¶
get_kv_cache_shape(
num_blocks: int,
block_size: int,
num_kv_heads: int,
head_size: int,
cache_dtype_str: str = "auto",
) -> tuple[int, ...]
Source code in vllm/v1/attention/backends/mla/indexer.py
get_kv_cache_stride_order staticmethod
¶
get_metadata_cls staticmethod
¶
get_metadata_cls() -> type[AttentionMetadata]
DeepseekV32IndexerMetadata dataclass
¶
Source code in vllm/v1/attention/backends/mla/indexer.py
decode class-attribute
instance-attribute
¶
decode: Optional[DeepSeekV32IndexerDecodeMetadata] = None
prefill class-attribute
instance-attribute
¶
prefill: Optional[DeepseekV32IndexerPrefillMetadata] = None
__init__ ¶
__init__(
seq_lens: Tensor,
num_reqs: int,
max_query_len: int,
max_seq_len: int,
num_actual_tokens: int,
query_start_loc: Tensor,
slot_mapping: Tensor,
head_dim: int,
num_decodes: int,
num_decode_tokens: int,
num_prefills: int,
num_prefill_tokens: int,
decode: Optional[
DeepSeekV32IndexerDecodeMetadata
] = None,
prefill: Optional[
DeepseekV32IndexerPrefillMetadata
] = None,
) -> None
DeepseekV32IndexerMetadataBuilder ¶
Bases: AttentionMetadataBuilder
Source code in vllm/v1/attention/backends/mla/indexer.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 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 |
|
decode_lens_buffer instance-attribute
¶
decode_lens_buffer = empty(
(max_num_seqs,), dtype=int32, device=device
)
max_prefill_buffer_size instance-attribute
¶
max_prefill_buffer_size = get_max_prefill_buffer_size(
vllm_config
)
num_speculative_tokens instance-attribute
¶
scheduler_metadata_buffer instance-attribute
¶
scheduler_metadata_buffer = empty(
(num_sms + 1, 2), dtype=int32, device=device
)
__init__ ¶
Source code in vllm/v1/attention/backends/mla/indexer.py
build ¶
build(
common_prefix_len: int,
common_attn_metadata: CommonAttentionMetadata,
fast_build: bool = False,
) -> DeepseekV32IndexerMetadata
Source code in vllm/v1/attention/backends/mla/indexer.py
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 |
|
DeepseekV32IndexerPrefillMetadata dataclass
¶
Source code in vllm/v1/attention/backends/mla/indexer.py
get_max_prefill_buffer_size ¶
get_max_prefill_buffer_size(vllm_config: VllmConfig)
Source code in vllm/v1/attention/backends/mla/indexer.py
kv_spans_from_batches ¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_seq_loc | Tensor | 1D long tensor [B+1], cumulative counts of selected tokens per batch. Example: [0, 2, 4, 7] -> batch sizes (selected) [2, 2, 3], N=7 tokens total. | required |
seq_len_per_batch | Tensor | 1D long tensor [B], full sequence length (KV length) of each batch. Example: [5, 9, 4]. | required |
Returns:
Name | Type | Description |
---|---|---|
start_tensor | Tensor | 1D long tensor [N], start offset in the concatenated KV cache for each token's batch. |
end_location | Tensor | 1D long tensor [N], exclusive end = start + token's local position. (So the attended KV slice is kv[start:end].) |
Assumes each batch contributes its full seq_len_per_batch[i]
keys to the KV cache, andthe selected tokens within a batch are the last counts[i]
positions of that sequence.