forked from iree-org/iree
-
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.
[LinalgExt] Reland QK scaling for attention decomp and further optimi…
…zations of it. (iree-org#18293) This PR relands original QK scaling and optimizing it further for attention decomposition. Addditionally, we Re-order QK scaling to run pre-exp2 S.T we can use linear offset instead of multiplication (`scale * exp(y) == exp(y+x)`). To further optimize, we move said linear scaling to before reduce<max>, since linear offset from max will be canceled out ( `oldMax - newMax == (oldMax + f8_linear_offset) - (oldMax + f8_linear_offset)`. --------- Signed-off-by: Stanley Winata <stanley.winata@amd.com> Co-authored-by: Rob Suderman <rob.suderman@gmail.com> Co-authored-by: Kunwar Grover <groverkss@gmail.com>
- Loading branch information
1 parent
ab0d4c6
commit 5ba9a89
Showing
2 changed files
with
54 additions
and
81 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