forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BlasKernel: Improve gemm's inner dot product when a is transposed (py…
…torch#80977) `gemm_transab_` accumulates the sum in the output, despite the inner loop being over a single output element. This changes it to accumulate in a register, which also avoids early truncation for bfloat16. I've also factored out a generic `sum` function that can be shared with `gemm_transa_` to handle unrolling and multiple accumulators. I have benchmarked addmm for bfloat16 with shapes (320,600) X (600,320) and for both layouts I see a significant speedup. | layout | Before (ms) | After (ms) | |----------|-------------|------------| | transa | 71.5 | 31 | | transab | 249 | 35 | Pull Request resolved: pytorch#80977 Approved by: https://github.com/ngimel
- Loading branch information
1 parent
a45fead
commit 753536b
Showing
1 changed file
with
42 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters