-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add support for qk hidden dim different from v hidden dim #1166
base: main
Are you sure you want to change the base?
Conversation
c5ec69d
to
4c3462a
Compare
hi~ @smallscientist1 QKHeadDim=32, VHeadDim=64 Which one stands out in terms of computational efficiency and model quality? |
In terms of model quality, it's too early to make a definitive assessment since the work is still in progress. However, several teams we've collaborated with expressed a need for this combination, so we implemented it. Additionally, anticipating that others might find it useful, we created this PR to benefit the broader community. |
* create bench headdim * update bench result * update Readme * reorg code to reduce compile time * update (128,256) config * add (192,128) * add config (192,128) * fix bug * fix bug backward * fix bug
Support different num_head of k and v
Dim autotuner
merge to dim_pr
We add support for
For different hidden dimension between qk and v, we have supported:
For headdim not supported, you can use the autotuner to generate the implementation. Details are in
autotuner.md
.Performance
We test the performance speedup compare to padding qk&v hidden_dim to the same length.
Test
We add unittest in
tests/test_flash_attn_headdim.py
tests/test_flash_attn_head.py
.