vllm.model_executor.layers.fused_moe.rocm_aiter_fused_moe ¶
ActivationMethod ¶
Bases: IntEnum
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
QuantMethod ¶
Bases: IntEnum
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
init_aiter_topK_meta_data cached
¶
init_aiter_topK_meta_data(
n_routed_experts: int,
n_shared_experts: int,
top_k: int,
tp_rank: int,
tp_size: int,
shared_experts_score: float = 1.0,
max_num_tokens: int = 32768,
is_EP: bool = False,
)
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
is_rocm_aiter_fusion_shared_expert_enabled cached
¶
is_rocm_aiter_fusion_shared_expert_enabled() -> bool
rocm_aiter_asm_moe_tkw1_fake ¶
rocm_aiter_asm_moe_tkw1_fake(
hidden_states: Tensor,
w1: Tensor,
w2: Tensor,
topk_weights: Tensor,
topk_ids: Tensor,
fc1_scale: Tensor | None = None,
fc2_scale: Tensor | None = None,
fc1_smooth_scale: Tensor | None = None,
fc2_smooth_scale: Tensor | None = None,
a16: bool = False,
per_tensor_quant_scale: Tensor | None = None,
expert_mask: Tensor | None = None,
activation_method: int = value,
) -> Tensor
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
rocm_aiter_asm_moe_tkw1_impl ¶
rocm_aiter_asm_moe_tkw1_impl(
hidden_states: Tensor,
w1: Tensor,
w2: Tensor,
topk_weights: Tensor,
topk_ids: Tensor,
fc1_scale: Tensor | None = None,
fc2_scale: Tensor | None = None,
fc1_smooth_scale: Tensor | None = None,
fc2_smooth_scale: Tensor | None = None,
a16: bool = False,
per_tensor_quant_scale: Tensor | None = None,
expert_mask: Tensor | None = None,
activation_method: int = value,
) -> Tensor
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
rocm_aiter_biased_grouped_topk_fake ¶
rocm_aiter_biased_grouped_topk_fake(
gating_output: Tensor,
correction_bias: Tensor,
topk_weights: Tensor,
topk_ids: Tensor,
num_expert_group: int,
topk_group: int,
need_renorm: bool,
routed_scaling_factor: float = 1.0,
) -> None
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
rocm_aiter_biased_grouped_topk_impl ¶
rocm_aiter_biased_grouped_topk_impl(
gating_output: Tensor,
correction_bias: Tensor,
topk_weights: Tensor,
topk_ids: Tensor,
num_expert_group: int,
topk_group: int,
need_renorm: bool,
routed_scaling_factor: float = 1.0,
) -> None
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
rocm_aiter_fused_experts ¶
rocm_aiter_fused_experts(
hidden_states: Tensor,
w1: Tensor,
w2: Tensor,
topk_weights: Tensor,
topk_ids: Tensor,
activation: str = "silu",
apply_router_weight_on_input: bool = False,
expert_map: Tensor | None = None,
quant_config: FusedMoEQuantConfig | None = None,
) -> Tensor
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
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 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
|
rocm_aiter_fused_moe_fake ¶
rocm_aiter_fused_moe_fake(
hidden_states: Tensor,
w1: Tensor,
w2: Tensor,
topk_weight: Tensor,
topk_ids: Tensor,
expert_mask: Tensor | None = None,
activation_method: int = value,
quant_method: int = value,
doweight_stage1: bool = False,
w1_scale: Tensor | None = None,
w2_scale: Tensor | None = None,
a1_scale: Tensor | None = None,
a2_scale: Tensor | None = None,
) -> Tensor
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
rocm_aiter_fused_moe_impl ¶
rocm_aiter_fused_moe_impl(
hidden_states: Tensor,
w1: Tensor,
w2: Tensor,
topk_weight: Tensor,
topk_ids: Tensor,
expert_mask: Tensor | None = None,
activation_method: int = value,
quant_method: int = value,
doweight_stage1: bool = False,
w1_scale: Tensor | None = None,
w2_scale: Tensor | None = None,
a1_scale: Tensor | None = None,
a2_scale: Tensor | None = None,
) -> Tensor
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
rocm_aiter_grouped_topk ¶
rocm_aiter_grouped_topk(
hidden_states: Tensor,
gating_output: Tensor,
topk: int,
renormalize: bool,
num_expert_group: int = 0,
topk_group: int = 0,
scoring_func: str = "softmax",
routed_scaling_factor: float = 1.0,
e_score_correction_bias: Tensor | None = None,
num_fused_shared_experts: int = 0,
) -> tuple[Tensor, Tensor]
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
rocm_aiter_grouped_topk_fake ¶
rocm_aiter_grouped_topk_fake(
gating_output: Tensor,
topk_weights: Tensor,
topk_ids: Tensor,
num_expert_group: int,
topk_group: int,
need_renorm: bool,
scoring_func: str = "softmax",
routed_scaling_factor: float = 1.0,
) -> None
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
rocm_aiter_grouped_topk_impl ¶
rocm_aiter_grouped_topk_impl(
gating_output: Tensor,
topk_weights: Tensor,
topk_ids: Tensor,
num_expert_group: int,
topk_group: int,
need_renorm: bool,
scoring_func: str = "softmax",
routed_scaling_factor: float = 1.0,
) -> None
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
rocm_aiter_topk_softmax ¶
rocm_aiter_topk_softmax(
topk_weights: Tensor,
topk_indices: Tensor,
token_expert_indices: Tensor,
gating_output: Tensor,
renormalize: bool,
) -> tuple[Tensor, ...]
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
rocm_aiter_topk_softmax_fake ¶
rocm_aiter_topk_softmax_impl ¶
rocm_aiter_topk_softmax_impl(
topk_weights: Tensor,
topk_indices: Tensor,
token_expert_indices: Tensor,
gating_output: Tensor,
renormalize: bool,
) -> None
Source code in vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py
shuffle_weights ¶
Applies shuffle_weight function from AITER to each input tensor and returns them.
Rearranges (shuffles) the input tensor/s into a specified block layout for optimized computation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*tensors | Tensor | Variable number of torch.Tensor objects. | () |
layout | tuple[int, int] | A pair of integers specifying the block sizes used to divide the tensors during shuffling. Default is (16, 16). | (16, 16) |
Returns: A Tuple of shuffled tensors.