Commit 9f9a6b2
Add fused MoE FFN1: fuse wi_0 and wi_1 into one grouped GEMM
When prefuse_moe_weights=True (requires sparse_matmul=True), the two
FFN1 expert weight matrices [G,K,N] are concatenated into [G,K,2N] and
dispatched as a single grouped GEMM, then split. This halves FFN1
kernel launches and reads input activations from HBM once instead of
twice. Backend-agnostic: works with Megablox, Tokamax, and
jax.lax.ragged_dot. When attention=vllm_rpa the fused tensor is passed
directly to the vLLM-TPU serving kernel.
correct sort kernel convergence1 parent f2917ee commit 9f9a6b2
3 files changed
Lines changed: 21 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
419 | 422 | | |
420 | 423 | | |
421 | 424 | | |
422 | 425 | | |
423 | 426 | | |
424 | 427 | | |
| 428 | + | |
425 | 429 | | |
426 | 430 | | |
427 | 431 | | |
| |||
481 | 485 | | |
482 | 486 | | |
483 | 487 | | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | 488 | | |
490 | 489 | | |
491 | 490 | | |
| |||
533 | 532 | | |
534 | 533 | | |
535 | 534 | | |
| 535 | + | |
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
| |||
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
591 | | - | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| 306 | + | |
| 307 | + | |
306 | 308 | | |
307 | 309 | | |
308 | 310 | | |
| |||
319 | 321 | | |
320 | 322 | | |
321 | 323 | | |
| 324 | + | |
| 325 | + | |
322 | 326 | | |
323 | 327 | | |
324 | 328 | | |
| |||
375 | 379 | | |
376 | 380 | | |
377 | 381 | | |
| 382 | + | |
| 383 | + | |
378 | 384 | | |
379 | 385 | | |
380 | 386 | | |
| |||
392 | 398 | | |
393 | 399 | | |
394 | 400 | | |
| 401 | + | |
| 402 | + | |
395 | 403 | | |
396 | 404 | | |
397 | 405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
918 | 918 | | |
919 | 919 | | |
920 | 920 | | |
921 | | - | |
922 | 921 | | |
923 | 922 | | |
924 | 923 | | |
| |||
0 commit comments