-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A subgraph of the form `Mul(MatMul(Mul(A, c), Mul(B, d)), e)` where all of the `Mul`s are optional and c, d and e are constants can be rewritten as `MatMul(A, B, alpha = c * d * e)` where `alpha` is the scaling already handled by the `C = alpha * AB + beta * C` result that GEMM already computes. Such scaling is common in transformers as part of attention operations (SDPA). The initial implementation only handles two specific cases of this form which have been seen in real models. This should be generalized to all possible cases.
- Loading branch information
1 parent
ac4b5d1
commit 6654523
Showing
3 changed files
with
189 additions
and
36 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
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
Oops, something went wrong.