Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

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.

None yet

1 participant