ggml: update unit tests for the new vec_dot interface
This commit is contained in:
parent
9cd5b8de6e
commit
bca726f06a
4 changed files with 6 additions and 6 deletions
|
@ -156,8 +156,8 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
t1 = std::chrono::high_resolution_clock::now();
|
t1 = std::chrono::high_resolution_clock::now();
|
||||||
float fs;
|
float fs;
|
||||||
if (type == 0) funcs.vec_dot(kVecSize * QK4_1, &fs, x40.data(), y.data());
|
if (type == 0) funcs.vec_dot(kVecSize * QK4_1, &fs, 0, x40.data(), 0, y.data(), 0, 1);
|
||||||
else funcs.vec_dot(kVecSize * QK4_1, &fs, x41.data(), y.data());
|
else funcs.vec_dot(kVecSize * QK4_1, &fs, 0, x41.data(), 0, y.data(), 0, 1);
|
||||||
t2 = std::chrono::high_resolution_clock::now();
|
t2 = std::chrono::high_resolution_clock::now();
|
||||||
t = 1e-3*std::chrono::duration_cast<std::chrono::nanoseconds>(t2-t1).count();
|
t = 1e-3*std::chrono::duration_cast<std::chrono::nanoseconds>(t2-t1).count();
|
||||||
if (iloop > 3) ggml.addResult(fs, t);
|
if (iloop > 3) ggml.addResult(fs, t);
|
||||||
|
|
|
@ -284,8 +284,8 @@ int main(int argc, char** argv) {
|
||||||
else {
|
else {
|
||||||
auto vdot = ggml_internal_get_type_traits(funcs.vec_dot_type);
|
auto vdot = ggml_internal_get_type_traits(funcs.vec_dot_type);
|
||||||
vdot.from_float(y1.data(), q8.data(), kVecSize);
|
vdot.from_float(y1.data(), q8.data(), kVecSize);
|
||||||
if (useQ4_1) funcs.vec_dot(kVecSize, &result, q41.data(), q8.data());
|
if (useQ4_1) funcs.vec_dot(kVecSize, &result, 0, q41.data(), 0, q8.data(), 0, 1);
|
||||||
else funcs.vec_dot(kVecSize, &result, q40.data(), q8.data());
|
else funcs.vec_dot(kVecSize, &result, 0, q40.data(), 0, q8.data(), 0, 1);
|
||||||
}
|
}
|
||||||
sumq += result;
|
sumq += result;
|
||||||
t2 = std::chrono::high_resolution_clock::now();
|
t2 = std::chrono::high_resolution_clock::now();
|
||||||
|
|
|
@ -87,7 +87,7 @@ static float dot_product_error(
|
||||||
vdot.from_float(test_data2, tmp_q2.data(), test_size);
|
vdot.from_float(test_data2, tmp_q2.data(), test_size);
|
||||||
|
|
||||||
float result = INFINITY;
|
float result = INFINITY;
|
||||||
qfns.vec_dot(test_size, &result, tmp_q1.data(), tmp_q2.data());
|
qfns.vec_dot(test_size, &result, 0, tmp_q1.data(), 0, tmp_q2.data(), 0, 1);
|
||||||
|
|
||||||
const float dot_ref = dot_product(test_data1, test_data2, test_size);
|
const float dot_ref = dot_product(test_data1, test_data2, test_size);
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ int main(int argc, char * argv[]) {
|
||||||
printf(" %zu values (%.2f MB)\n", size, 4*size/(float)(1024*1024));
|
printf(" %zu values (%.2f MB)\n", size, 4*size/(float)(1024*1024));
|
||||||
auto quantize_fn = [&](void) -> float {
|
auto quantize_fn = [&](void) -> float {
|
||||||
float result;
|
float result;
|
||||||
qfns.vec_dot(size, &result, test_q1, test_q2);
|
qfns.vec_dot(size, &result, 0, test_q1, 0, test_q2, 0, 1);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
size_t quantized_size = ggml_row_size(type, size);
|
size_t quantized_size = ggml_row_size(type, size);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue