make use of upcoming AVXVNNIINT8

This commit is contained in:
Ilya Kurdyukov 2023-05-16 21:39:06 +07:00 committed by GitHub
parent c1b3a8e24d
commit ff2638412d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

6
ggml.c
View file

@ -557,11 +557,17 @@ static inline __m256 mul_sum_us8_pairs_float(const __m256i ax, const __m256i sy)
// multiply int8_t, add results pairwise twice and return as float vector
static inline __m256 mul_sum_i8_pairs_float(const __m256i x, const __m256i y) {
#if __AVXVNNIINT8__
const __m256i zero = _mm256_setzero_si256();
const __m256i summed_pairs = _mm256_dpbssd_epi32(zero, x, y);
return _mm256_cvtepi32_ps(summed_pairs);
#else
// Get absolute values of x vectors
const __m256i ax = _mm256_sign_epi8(x, x);
// Sign the values of the y vectors
const __m256i sy = _mm256_sign_epi8(y, x);
return mul_sum_us8_pairs_float(ax, sy);
#endif
}
static inline __m128i packNibbles( __m256i bytes )