/* Exactness test for the integer-dot kernels: dot_i8i8 and dot_i4i8 must return * EXACTLY the same value as a plain-C reference, whatever SIMD path was compiled * in (avx512-vnni / avx2 / neon / vsx / scalar). Integer arithmetic has no * rounding, so any mismatch is a kernel bug, not noise. * * Covers: odd sizes (scalar tail), sizes below one vector, the w=-128 edge * (sign-trick kernels must treat |−128| as 128 unsigned, not saturate to 127), * and random data at qrow_i8's contract (|x| <= 127, w full int8 range). */ #define main coli_glm_main_unused #include "../glm.c" #undef main static uint32_t rng_state=0x12345678u; static uint32_t xr(void){ rng_state^=rng_state<<13; rng_state^=rng_state>>17; rng_state^=rng_state<<5; return rng_state; } static int32_t ref_i8i8(const int8_t *w, const int8_t *x, int I){ int64_t s=0; for(int i=0;i>1]; int v=(i&1)?((int)(b>>4)-8):((int)(b&0xF)-8); s+=v*x[i]; } return (int32_t)s; } int main(void){ static const int sizes[]={1,2,15,16,17,31,32,33,63,64,65,100,127,128,1408,4096,4097}; static int8_t w[8192], x[8192]; static uint8_t w4[4096]; for(unsigned t=0;t