Option to enable or disable the CPU FA kernels #429
                
     Merged
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
The compilation of
iqk_mul_mat.cpptakes 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 acmakeoption to enable or disable the CPU FA kernels. It is set on by default, and can be changed usingSetting it to off reduces compilation time of
iqk_mul_mat.cppto 25 seconds on the Ryzen-7950 CPU, so a speedup of 5.7X. Hopefully this will make it easier to buildik_llama.cppon an Android phone.If
GGML_IQK_FLASH_ATTENTIONis set toOFF, FA is still available but will be computed using theggmlimplementation, which is very slow on any CPU I have tried.