Commit e768c1a
CUDA: route single-column f32 mul_mat through mmvf via transpose-free operand swap
A mul_mat of a single-column f32 weight (ne01 == 1) against a wide activation
(ne11 > MMVF_MAX_BATCH_SIZE) misses the mmvf vector kernel because ne11 is the
batch dimension, and falls back to an f32 cuBLAS/rocBLAS GEMM whose 32x32 macro
tile computes just one useful output column. Since the output is a vector, the
operands can be swapped transpose-free: the activation becomes the matrix and the
single-column weight the lone F32 vector, with dst reinterpreted as [ne11, 1].
This runs the op as a proper GEMV. The graph is unchanged, so LoRA and any other
consumer are unaffected. On Qwen3.6-35B-A3B (gfx1151, pp128) the shared-expert
gate (weight f32[2048,1]) drops from ~78 us/instance on rocBLAS Sgemm to ~3.8 us
on mmvf (~20x), ~3.0 ms saved across the 40 layers.
Adds test-backend-ops regression cases (m=1, n sweeping across MMVF_MAX_BATCH_SIZE)
that validate both the direct and swapped paths against the CPU reference.
Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>1 parent 8ff69ec commit e768c1a
2 files changed
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1759 | 1759 | | |
1760 | 1760 | | |
1761 | 1761 | | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
1762 | 1783 | | |
1763 | 1784 | | |
1764 | 1785 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8555 | 8555 | | |
8556 | 8556 | | |
8557 | 8557 | | |
| 8558 | + | |
| 8559 | + | |
| 8560 | + | |
| 8561 | + | |
| 8562 | + | |
| 8563 | + | |
| 8564 | + | |
| 8565 | + | |
8558 | 8566 | | |
8559 | 8567 | | |
8560 | 8568 | | |
| |||
0 commit comments