Add AVX512 implementation of GEMM - Q4_Kx8#12829
Conversation
|
Hi, may I ask how to test the correctness of such kernel optimization? Saying, is there a way to test whether the result of gemm/gemv by the simd implementation is correct? |
|
@Nor7th , we initially go with comparing the individual output values of GEMM and GEMV for with the mul mat outputs earlier without introduction of changes. Once there is sufficient evidence that there is not much divergence in the values, we take the perplexity measure as documented above. Further, if there is not even precision differences observed, the llama-cli output tends to be the same. For example with the AVX2 and AVX512 Outputs in this function targeted for optimization, the output remains the same for different prompts and seeds. Thanks |
* Add AVX512 implementation of GEMM - q4kx8 * Update changes to remove unnecessary whitespaces
|
Hi, is there any evaluation data for pp and tg in other sizes? Is there any acceleration effect of the method when the pp is small, like 16, 32? |
* Add AVX512 implementation of GEMM - q4kx8 * Update changes to remove unnecessary whitespaces
* Add AVX512 implementation of GEMM - q4kx8 * Update changes to remove unnecessary whitespaces
* Add AVX512 implementation of GEMM - q4kx8 * Update changes to remove unnecessary whitespaces
* Add AVX512 implementation of GEMM - q4kx8 * Update changes to remove unnecessary whitespaces
* Add AVX512 implementation of GEMM - q4kx8 * Update changes to remove unnecessary whitespaces
* Add AVX512 implementation of GEMM - q4kx8 * Update changes to remove unnecessary whitespaces
* Add AVX512 implementation of GEMM - q4kx8 * Update changes to remove unnecessary whitespaces
* Add AVX512 implementation of GEMM - q4kx8 * Update changes to remove unnecessary whitespaces
* Add AVX512 implementation of GEMM - q4kx8 * Update changes to remove unnecessary whitespaces
GCC Linux :
Q4_K_M Model :
Q4_K_S Model :
GCC Version = 12.3
The models were quantized and tested from meta-llama2 7B model - https://huggingface.co/meta-llama/Llama-2-7b
The PR was tested in AMD Granite Ridge 9600X which supports the following flags by default :
system_info: n_threads = 6 (n_threads_batch = 6) / 12 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | AARCH64_REPACK = 1 |
Further the perplexity was tested and found to be similar with the Q4_K_S model :
The perplexity results are tabulated as follows :