grouped gemm microbenchmark: use te.GroupedLinear#639
Conversation
- matches the gemm benchmark more closely (which uses te.Linear) - makes it possible to use triton backend - now that we can profile the kernels in the benchmark, no need to run the lower-level API directly
|
What are benchmarks results comparing to baseline? |
Despite the different methodology, results are remarkably similar:
|
|
If grouped linear is slower, shouldn't its usage be discouraged? |
It's not slower, the table in my comment compared the prior Grouped GEMM microbenchmark implementation (which just called |
I understand that but ~6% is quite big overhead that may make te.GroupedLinear usage undesired. Are those 'Lite' shapes expected to demonstrate such sensitivity? |
Yes, this is expected, it's specifically a smallest-shape effect. Raw kernel times (measured with --kernel-profile) are identical between te.GroupedLinear and general_grouped_gemm, so the difference is on the host side. Profiling the host side shows that general_grouped_gemm itself costs ~0.1–0.5 ms/call on the host (three grouped-GEMM launches for fwd + dgrad + wgrad). te.GroupedLinear adds ~0.3 ms of framework work on top (autograd Function apply/backward, per-group split/cast, save_for_backward, allocations, grad-zeroing), independent of GEMM size. Whether that fixed cost surfaces in wall time depends on the GPU work per call. On the smallest 'Lite' config (M=512) the GEMM is small so it's a meaningful fraction, which is where the ~6% comes from; as M grows and on the larger DSV2/DSV3/Grok shapes the GEMMs are big enough to hide it, so the slowdown shrinks towards zero. |
Description
the lower-level API directly
Type of change
Changes
Please list the changes introduced in this PR:
Checklist: