vllm.compilation.passes.fusion.allreduce_rms_fusion ¶
Classes:
-
AiterAllreduceFusedAddRMSNormGroupQuantFP8Pattern–fused_addvariant ofAiterAllreduceFusedRMSNormGroupQuantFP8Pattern. -
AiterAllreduceFusedAddRMSNormGroupQuantWithIndexerPattern–Indexer-fan-out variant of
AiterAllreduceFusedAddRMSNormGroupQuantFP8Pattern. -
AiterAllreduceFusedRMSNormGroupQuantFP8Pattern–Fuse AllReduce + RMSNorm + per-group FP8 quant into a single AITER
-
AllReduceFusedAddGemmaRMSNormPattern–Gemma-style variant of AllReduceFusedAddRMSNormPattern (with residual).
-
AllReduceFusedAddRMSNormPattern–This pattern replaces the allreduce + rms norm (with residual)
-
AllReduceFusedAddRMSNormStaticQuantFP8Pattern–This pattern replaces the allreduce + rms norm (with residual)
-
AllReduceFusedAddRMSNormStaticQuantNVFP4Pattern–This pattern replaces the allreduce + rms norm (with residual)
-
AllReduceFusedRMSNormStaticQuantFP8Pattern–This pattern replaces the allreduce + rms norm (without residual)
-
AllReduceFusedRMSNormStaticQuantNVFP4Pattern–This pattern replaces the allreduce + rms norm (without residual)
-
AllReduceGemmaRMSNormPattern–Gemma-style variant of AllReduceRMSNormPattern (no residual).
-
AllReduceRMSNormPattern–This pattern replaces the allreduce + rms norm (without residual)
-
FlashInferFusedAllReduceParams–Parameters for FlashInfer fused allreduce operations.
AiterAllreduceFusedAddRMSNormGroupQuantFP8Pattern ¶
Bases: BasePattern, VllmPatternReplacement
fused_add variant of AiterAllreduceFusedRMSNormGroupQuantFP8Pattern.
Targets the dominant DSv3.2-style post-attention / post-MLP path: all_reduce -> fused_add_rms_norm -> group_fp8_quant. Returns the FP8 quant output, the residual carry-over, and the per-group scale.
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 | |
AiterAllreduceFusedAddRMSNormGroupQuantWithIndexerPattern ¶
Bases: BasePattern, VllmPatternReplacement
Indexer-fan-out variant of AiterAllreduceFusedAddRMSNormGroupQuantFP8Pattern.
Targets the DSv3.2 post-attention / post-MLP path where the post-AR normed activation has two consumers: a per-group FP8 quant for fused_qkv_a_proj and a bf16 rocm_unquantized_gemm for the indexer wk_weights_proj. The single-consumer pattern above cannot fire when this fan-out is present, so without this pattern the standalone FP8 quant kernel survives unfused (~535us / decode step on DSv3.2 MI355X TP4).
Lowers to rocm_aiter_fused_allreduce_rmsnorm_quant_per_group_with_bf16_norm (the emit_bf16=True variant of the AR+RMS+QUANT launcher, which returns FP8 quant + scales + bf16 normed activations in one kernel) and rewires the indexer GEMM onto the emitted bf16 norm output. The RMS output is also a graph output in DSv3.2's residual carry; it is returned as a pattern output so the matcher can substitute the bf16 norm in its place.
The trailing FP8 group-quant is matched via MatcherQuantFP8 (consistent with the sibling patterns above), which traces both QuantFP8.forward_hip and forward_native paths and so matches whichever op the call site lowers to (vllm.triton_per_token_group_quant_fp8 or vllm.rocm_aiter_group_fp8_quant).
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 | |
AiterAllreduceFusedRMSNormGroupQuantFP8Pattern ¶
Bases: BasePattern, VllmPatternReplacement
Fuse AllReduce + RMSNorm + per-group FP8 quant into a single AITER custom op.
Matches the AR-side analogue of AiterRMSFp8GroupQuantPattern in rocm_aiter_fusion.py: all_reduce -> rms_norm -> group_fp8_quant fans out into rocm_aiter_fused_allreduce_rmsnorm_quant_per_group.
Without this pattern, RocmAiterAllReduceFusionPass would fuse the all_reduce + rms_norm half (PR #41825 wires that), but the trailing rocm_aiter_group_fp8_quant would still launch as a separate kernel. That standalone quant accounts for ~535us / decode step on DSv3.2 MI355X TP4 -- this pattern eliminates it by absorbing the quant into the AR epilogue. Group size 128 matches the FP8 block-scaled MM kernel used by DSv3.2's linear weights.
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 | |
AllReduceFusedAddGemmaRMSNormPattern ¶
Bases: BasePattern
Gemma-style variant of AllReduceFusedAddRMSNormPattern (with residual).
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
AllReduceFusedAddRMSNormPattern ¶
Bases: BasePattern
This pattern replaces the allreduce + rms norm (with residual) with fused flashinfer implementation. Applies to o_proj + rmsnorm after attn and mlp + rmsnorm before attn.
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
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 | |
AllReduceFusedAddRMSNormStaticQuantFP8Pattern ¶
Bases: BasePattern
This pattern replaces the allreduce + rms norm (with residual) + static fp8 quant with fused flashinfer implementation. Applies to o_proj + rmsnorm after attn + quant and mlp + rmsnorm + quant before attn.
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | |
AllReduceFusedAddRMSNormStaticQuantNVFP4Pattern ¶
Bases: BasePattern
This pattern replaces the allreduce + rms norm (with residual) + static nvfp4 quant with fused flashinfer implementation. Applies to o_proj + rmsnorm after attn + quant and mlp + rmsnorm + quant before attn.
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 | |
AllReduceFusedRMSNormStaticQuantFP8Pattern ¶
Bases: BasePattern
This pattern replaces the allreduce + rms norm (without residual) + static fp8 quant with fused flashinfer implementation. Applies to allreduce + rmsnorm + quant before attn in the first Transformer block.
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
AllReduceFusedRMSNormStaticQuantNVFP4Pattern ¶
Bases: BasePattern
This pattern replaces the allreduce + rms norm (without residual) + static nvfp4 quant with fused flashinfer implementation. Applies to allreduce + rmsnorm + quant before attn in the first Transformer block.
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | |
AllReduceGemmaRMSNormPattern ¶
Bases: BasePattern
Gemma-style variant of AllReduceRMSNormPattern (no residual).
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
AllReduceRMSNormPattern ¶
Bases: BasePattern
This pattern replaces the allreduce + rms norm (without residual) with fused flashinfer implementation. Applies to allreduce + rmsnorm before attn in the first Transformer block.
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
FlashInferFusedAllReduceParams ¶
Parameters for FlashInfer fused allreduce operations.
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
_norm_input_weight_dtype_match(match) ¶
Prevent fusion when the norm input and weight dtypes differ (e.g. a Gemma fp32 weight.float()+1 gamma), covering rms_norm and fused_add_rms_norm.
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
_view_flashinfer_nvfp4_scale_out_as_int32(scale_out) ¶
View FlashInfer's NVFP4 scale buffer back as vLLM's int32 format.
Source code in vllm/compilation/passes/fusion/allreduce_rms_fusion.py
_view_nvfp4_scale_out_for_flashinfer(scale_out) ¶
View vLLM's packed NVFP4 scale buffer as FP8 for FlashInfer.