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
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 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
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.