Skip to content

[WIP] Add fast cuda kernels for one mode#154

Closed
daquexian wants to merge 1 commit intoBlinkDL:mainfrom
daquexian:fast_gemv
Closed

[WIP] Add fast cuda kernels for one mode#154
daquexian wants to merge 1 commit intoBlinkDL:mainfrom
daquexian:fast_gemv

Conversation

@daquexian
Copy link
Contributor

TODO: support seq mode

Add fast gemv kernel (based on https://github.com/wangsiping97/FastGEMV and added kernel fusion. ~10% faster than pytorch gemv) and a fused wkv_forward_one kernel (much faster, ~140 us -> 5us on 2080 1.5B model).


2080, 1.5B Model:

Main branch (blue bars represent CUDA kernels):
image

This branch:

image

FFN time: 359.77us -> 231.29us
ATT time: 291.71us -> 148.45us

Whole one mode time: 0.2487s -> 0.1409s

A100, 7B model:

Whole one mode time: 0.2657s -> 0.184s

Signed-off-by: daquexian <daquexian566@gmail.com>
@daquexian
Copy link
Contributor Author

closing in favor to #157

@daquexian daquexian closed this Jul 25, 2023
@daquexian daquexian deleted the fast_gemv branch July 25, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant