MCPcopy Create free account
hub / github.com/antirez/ds4 / test_dot_reference

Function test_dot_reference

tests/test_q4k_dot.c:175–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173 j, expected_sc[j], expected_m[j], sc, m);
174 ok = 0;
175 }
176 }
177
178 printf(" scale extraction: %s\n", ok ? "PASS" : "FAIL");
179 return ok ? 0 : 1;
180}
181
182static int test_dot_reference(void) {
183 int ok = 1;
184 for (uint32_t seed = 1; seed <= 50; seed++) {
185 block_q4_K bx;
186 block_q8_K by;
187 fill_q4_K(&bx, seed);
188 fill_q8_K(&by, seed * 7 + 13);
189
190 float result = 0.0f;
191 vec_dot_q4_K_q8_K(QK_K, &result, &bx, &by);
192 float expected = ref_dot(&bx, &by);
193
194 float err = fabsf(result - expected);
195 float rel = fabsf(expected) > 1e-3f ? err / fabsf(expected) : err;
196 if (rel > 0.01f) {
197 printf(" seed=%u: result=%.6f expected=%.6f rel_err=%.6f\n",
198 seed, result, expected, rel);
199 ok = 0;
200 }
201 }

Callers 1

mainFunction · 0.85

Calls 4

fill_q4_KFunction · 0.85
fill_q8_KFunction · 0.85
vec_dot_q4_K_q8_KFunction · 0.85
ref_dotFunction · 0.85

Tested by

no test coverage detected