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
1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | |
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
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 1393 1394 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 | |
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
1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | |
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
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 | |
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
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 715 716 717 718 719 720 721 | |
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
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 852 853 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 | |
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
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 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 | |
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.