Skip to content

Conversation

ikawrakow
Copy link
Owner

The compilation of iqk_mul_mat.cpp takes extremely long - currently 2m22s on my Ryzen-7950X CPU, with some users reporting times in the range of 30 minutes on an Antroid phone using Termux . This is to a large extent due to the Flash Attention (FA) kernels. Hence, this PR adds a cmake option to enable or disable the CPU FA kernels. It is set on by default, and can be changed using

cmake -DGGML_IQK_FLASH_ATTENTION=OFF ...

Setting it to off reduces compilation time of iqk_mul_mat.cpp to 25 seconds on the Ryzen-7950 CPU, so a speedup of 5.7X. Hopefully this will make it easier to build ik_llama.cpp on an Android phone.

If GGML_IQK_FLASH_ATTENTION is set to OFF, FA is still available but will be computed using the ggml implementation, which is very slow on any CPU I have tried.

@ikawrakow ikawrakow merged commit b3036a8 into main May 17, 2025
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