IQ2_XXS: much faster CPU prompt processing #515
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.
While experimenting with the trellis quants in PRs #505 and #511, I realized that CPU matrix multiplications (GEMM) for quants that are slow to unpack and make ready for
int8_tdot products (as the trellis quants are) are much faster if one unpacks a given number of rows to, e.g.,Q8_0_R8, and then uses theQ8_0_R8 x Q8_2_X4GEMM to perform the multiplication with all columns of the right matrix.This PR applies the approach of #505/#511 to
IQ2_XXS(AVX2/Zen4only). We get nearly 3X improvement in PP performance compared toIQ2_XXSon the main branch, and 2X compared toIQ2_XXS_R4!The same approach can be used out-of-the-box for
IQ3_XXS(left for a follow up PR).IQ2_XS, IQ2_SandIQ3_Suse blocks of 16, so one would need a new row-interleaved 8-bit type with blocks of 16 for those.