vllm.model_executor.layers.fused_moe.oracle.fp8 ¶
Functions:
-
make_fp8_moe_quant_config–Create FusedMoEQuantConfig for the specified FP8 Backend.
-
map_fp8_backend–Map user's MoEBackend to Fp8MoeBackend.
-
refine_fp8_moe_block_shape–Compute a refined block shape for block-quantized FP8 MoE weights whose
-
select_fp8_moe_backend–Select the primary FP8 MoE backend
_get_priority_backends(moe_config, weight_key, activation_key) ¶
Get available backends in priority order based on platform and config.
This function can be extended to become more complex as needed.
Source code in vllm/model_executor/layers/fused_moe/oracle/fp8.py
_humming_fp8_weight_schema(layer, weight, weight_scale) ¶
Build the humming weight schema from the canonical on-device fp8/mxfp8 tensors (scale dtype/shape, block size), not the producing quant method.
Source code in vllm/model_executor/layers/fused_moe/oracle/fp8.py
make_fp8_moe_quant_config(fp8_backend, w1_scale, w2_scale, a1_scale, a2_scale, w1_bias=None, w2_bias=None, block_shape=None, per_act_token_quant=False, per_out_ch_quant=False, swiglu_limit=None, gemm1_alpha=None, gemm1_beta=None, layer=None) ¶
Create FusedMoEQuantConfig for the specified FP8 Backend. The FusedMoEQuantConfig holds the scales that are used at runtime by the Modular Kernel abstraction.
Note that certain kernels (e.g. Flashinfer CUTLASS) need special Quant configs to handle non-standard inputs to their kernel interfaces.
In a future PR, we will have this function should be a method of the modular kernel itself.
Source code in vllm/model_executor/layers/fused_moe/oracle/fp8.py
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | |
map_fp8_backend(runner_backend) ¶
Map user's MoEBackend to Fp8MoeBackend.
Source code in vllm/model_executor/layers/fused_moe/oracle/fp8.py
refine_fp8_moe_block_shape(config, weight_block_size) ¶
Compute a refined block shape for block-quantized FP8 MoE weights whose checkpoint blocks cannot be sharded exactly across TP ranks.
TP shards the intermediate dim of the expert weights, so a per-shard size that is not a multiple of the checkpoint's block size makes the checkpoint's block scales impossible to shard exactly. When a finer block size (>= 32) divides both the checkpoint blocks and all involved dims, the weight scales can be refined to that granularity at load time (a lossless upsampling, since the refined block divides the checkpoint block). Only Triton-based kernels can consume the refined block shape: they take it as a runtime argument, while the other backends require the native 128x128 blocks. The refined shape is encoded in the QuantKey used for backend selection, so backends that only support 128x128 blocks are rejected by the oracle automatically.
Returns the refined [block_n, block_k] shape, or None if no refinement is needed or possible.
Source code in vllm/model_executor/layers/fused_moe/oracle/fp8.py
select_fp8_moe_backend(config, weight_key, activation_key, allow_vllm_cutlass=False) ¶
Select the primary FP8 MoE backend Note: Shape-specific fallbacks may still occur at runtime.
Source code in vllm/model_executor/layers/fused_moe/oracle/fp8.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 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 438 439 440 441 442 443 444 445 446 447 | |