vllm.v1.attention.ops.rocm_aiter_mla_sparse ¶
fp8_mqa_logits_torch ¶
fp8_mqa_logits_torch(
q: Tensor,
kv: tuple[Tensor, Tensor],
weights: Tensor,
cu_seqlen_ks: Tensor,
cu_seqlen_ke: Tensor,
) -> Tensor
Compute FP8 MQA logits for a single sequence without KV paging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q | Tensor | Query tensor of shape [M, H, D]. Casted to | required |
kv | tuple[Tensor, Tensor] | Tuple | required |
weights | Tensor | weights of shape [M, H], dtype | required |
cu_seqlen_ks | Tensor | Start indices (inclusive) for valid K per query position, shape [M], dtype int32. | required |
cu_seqlen_ke | Tensor | End indices (exclusive) for valid K per query position, shape [M], dtype int32. | required |
Returns:
| Type | Description |
|---|---|
Tensor | Logits tensor of shape [M, N], dtype |
Source code in vllm/v1/attention/ops/rocm_aiter_mla_sparse.py
rocm_fp8_mqa_logits ¶
rocm_fp8_mqa_logits(
q: Tensor,
kv: tuple[Tensor, Tensor],
weights: Tensor,
cu_seqlen_ks: Tensor,
cu_seqlen_ke: Tensor,
) -> Tensor
Compute FP8 MQA logits for a single sequence without KV paging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q | Tensor | Query tensor of shape [M, H, D]. Casted to | required |
kv | tuple[Tensor, Tensor] | Tuple | required |
weights | Tensor | weights of shape [M, H], dtype | required |
cu_seqlen_ks | Tensor | Start indices (inclusive) for valid K per query position, shape [M], dtype int32. | required |
cu_seqlen_ke | Tensor | End indices (exclusive) for valid K per query position, shape [M], dtype int32. | required |
Returns:
| Type | Description |
|---|---|
Tensor | Logits tensor of shape [M, N], dtype |
Source code in vllm/v1/attention/ops/rocm_aiter_mla_sparse.py
rocm_fp8_paged_mqa_logits ¶
rocm_fp8_paged_mqa_logits(
q_fp8: Tensor,
kv_cache_fp8: Tensor,
weights: Tensor,
context_lens: Tensor,
block_tables: Tensor,
schedule_metadata: Tensor,
max_model_len: int,
) -> Tensor
Compute FP8 MQA logits using paged KV-cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q_fp8 | Tensor | Query tensor of shape [B, next_n, H, D]. Casted to | required |
kv_cache_fp8 | Tensor | Paged KV-cache in packed FP8+scale layout with shape [num_blocks, block_size, 1, D+4], dtype | required |
weights | Tensor | Tensor of shape [B * next_n, H], dtype | required |
context_lens | Tensor | Tensor of shape [B], dtype int32; effective context length for each batch element. | required |
block_tables | Tensor | Tensor of shape [B, max_blocks], dtype int32; maps logical block indices to physical blocks in the paged cache. | required |
schedule_metadata | Tensor | Returned by | required |
max_model_len | int | Maximum sequence length used to size the logits output. | required |
Returns:
| Type | Description |
|---|---|
Tensor | Logits tensor of shape [B * next_n, max_model_len], dtype |
Tensor |
|
Source code in vllm/v1/attention/ops/rocm_aiter_mla_sparse.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
rocm_inv_rope_einsum ¶
rocm_inv_rope_einsum(
rotary_emb: Module,
o: Tensor,
positions: Tensor,
rope_head_dim: int,
n_local_groups: int,
o_lora_rank: int,
wo_a: Module,
) -> Tensor
Reference inverse-RoPE + WO_A einsum path used on ROCm.