Skip to content

Conversation

lshAlgorithm
Copy link

@lshAlgorithm lshAlgorithm commented May 13, 2025

Support the AVX2 on Linux.
Main change: In rwkv_operators_wkv_v7.inc, it is straightforward, we just need to add things up in vector and reduce then to sum out of loop using horizontal_sum.
Reproduce: I've added the compile option, so just compile it using ./script.sh, and run generate_completion.py following README.
Remaining issues: Because the reduction of AVX vector is instrinsics-depedent, and my pc doesn't support avx512, let alone arm, the code support AVX2 ONLY; and it seems that ggml doesn't fully support AVX2, and doesn't include <immintrin.h>. (Maybe I don't get it right, I just add the header in the code.)
Outcome: Test on Fedora40 with Intel(R) Core(TM) Ultra 9 185H (No GPU). Slightly speedup using rwkv-7-1.5B, fp16, so as rwkv-7-2.9B, fp16. (To be honest, it is about ms level faster, and my PC is not that stable, so I cannot show an accurate speedup...)
Statement: Sorry for the stupid commit explanation, it was meant for private use days before. No much experience in PR, but really wanna contribute to the community. Hope for suggestion.

lshAlgorithm added 3 commits May 14, 2025 02:01
Signed-off-by: lshAlgorithm <[email protected]>
Signed-off-by: lshAlgorithm <[email protected]>
Signed-off-by: lshAlgorithm <[email protected]>
Signed-off-by: lshAlgorithm <[email protected]>
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