vllm.model_executor.layers.fused_moe.experts.rocm_aiter_moe
¶
Classes:
-
AiterExperts– -
AiterFp8BlockExperts–128x128 block-quantized weight scale, 128-grouped dynamic
-
AiterFp8ChannelExperts–Per-output-channel static weight scale, per-token dynamic
-
AiterFp8TensorExperts–Per-tensor static weight scale, either per-tensor static or
-
AiterMxfp4Experts–MXFP4-quantized weights, with either unquantized (bf16/fp16) or
-
AiterUnquantizedExperts–Unquantized (bf16/fp16) weights and activations.
Functions:
-
aiter_moe_pads–Round the padding deltas to what AITER's MoE dispatch expects.
-
derive_aiter_quant_method–AiterExperts._AITER_QUANT_METHODfor callers that bypass the leaves. -
inject_shared_expert_weights–Merge routed topk results with the shared expert buffer and inject
-
mxfp4_w4a16_extra_kwargs–AiterMxfp4Experts._extra_fused_moe_kwargsfor callers that bypass it. -
rocm_aiter_fused_experts–ROCm AITER fused MoE expert computation.
AiterExperts
¶
Bases: FusedMoEExpertsModular
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
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 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | |
AiterFp8BlockExperts
¶
Bases: AiterExperts
128x128 block-quantized weight scale, 128-grouped dynamic activation scale.
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
AiterFp8ChannelExperts
¶
Bases: AiterExperts
Per-output-channel static weight scale, per-token dynamic activation scale.
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
AiterFp8TensorExperts
¶
Bases: AiterExperts
Per-tensor static weight scale, either per-tensor static or per-tensor dynamic activation scale.
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
AiterMxfp4Experts
¶
Bases: AiterExperts
MXFP4-quantized weights, with either unquantized (bf16/fp16) or MXFP4-quantized dynamic activations. gfx950-only (not gfx1250), except for Kimi-K3's MXFP4 experts requantized to packed int4 at load on gfx942.
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
AiterUnquantizedExperts
¶
Bases: AiterExperts
Unquantized (bf16/fp16) weights and activations.
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
_resolve_aiter_activation(activation)
¶
Map a vLLM activation to AITER's activation_method, plus a gate/up interleave hint (only SWIGLUOAI_UNINTERLEAVE sets it).
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
aiter_moe_pads(hidden_pad, intermediate_pad, activation, use_mxfp4_w4a4, tp_size)
¶
Round the padding deltas to what AITER's MoE dispatch expects.
SITU's A16W4 FlyDSL kernel pads per gate/up half, so its pads pass through unrounded. Otherwise the pads are rounded to AITER's CK/FlyDSL tile granularity, and at tp_size == 1 the intermediate pad is doubled for the fused gate/up weight. The W4A4 SiLU path doubles it inside AITER, so it is passed undoubled; doubling it here as well masks live intermediate rows.
Where AITER doubles it (v0.1.24.post1):
- CK-Tile stage 1, aiter/fused_moe.py:
n_pad_zeros=intermediate_pad // 64 * 64 * (2 if use_g1u1 else 1).
- FlyDSL stage 1 takes inter_dim_pad unchanged and doubles it in the
kernel, aiter/ops/flydsl/kernels/mixed_moe_gemm_2stage_common.py:
inter_dim_pad_total = 2 * inter_dim_pad is subtracted from the fused
gate/up width. Stage 2 masks the K tail with the undoubled value
(base_k < inter_dim - inter_dim_pad).
So both stage 1 kernels expect the undoubled pad. Recheck these lines on an
AITER bump.
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
derive_aiter_quant_method(quant_config)
¶
AiterExperts._AITER_QUANT_METHOD for callers that bypass the leaves.
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
inject_shared_expert_weights(topk_weights, topk_ids, topk, num_fused_shared_experts, shared_expert_weights=None)
¶
Merge routed topk results with the shared expert buffer and inject dynamic per-token shared expert gate values for AITER fusion.
For routers that already return the combined buffer (e.g. GroupedTopKRouter via rocm_aiter_grouped_topk), only the dynamic weight injection is needed. For routers that return only routed slots (e.g. FusedTopKRouter), this also copies the routed results into the pre-allocated combined buffer.
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
mxfp4_w4a16_extra_kwargs(quant_config, moe_config)
¶
AiterMxfp4Experts._extra_fused_moe_kwargs for callers that bypass it.
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
rocm_aiter_fused_experts(hidden_states, w1, w2, topk_weights, topk_ids, moe_config, quant_method, activation=MoEActivation.SILU, apply_router_weight_on_input=False, expert_mask=None, quant_config=None, a1q_scale=None, num_local_tokens=None, output_dtype=None, moe_sorting_dispatch_policy=0, gate_mode_override=None, bias1=None, bias2=None, q_dtype_a=None, shared_w1=None, shared_w2=None, shared_w1_scale=None, shared_w2_scale=None, shared_expert_id=-1)
¶
ROCm AITER fused MoE expert computation.
Source code in vllm/model_executor/layers/fused_moe/experts/rocm_aiter_moe.py
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 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 | |