Merge branch 'ggml-org:master' into master
This commit is contained in:
22 files changed
+136
-128
No files matched your search
@@ -7319,6 +7319,7 @@ enum mul_mat_add_mode {
|
||||
MUL_MAT_ADD_ROW, // mm + a one-row res, which a same-shape fusion must leave alone
|
||||
MUL_MAT_ADD_RES_INPLACE, // res += mm
|
||||
MUL_MAT_ADD_B_INPLACE, // b += mm: the sum overwrites the mat-mul input (m == k)
|
||||
MUL_MAT_ADD_MM_MM, // mm2 + mm: the residual is itself a mat-mul output, so both operands are MUL_MAT
|
||||
};
|
||||
|
||||
static std::string var_to_str(mul_mat_add_mode mode) {
|
||||
@@ -7328,6 +7329,7 @@ static std::string var_to_str(mul_mat_add_mode mode) {
|
||||
case MUL_MAT_ADD_ROW: return "mm+row";
|
||||
case MUL_MAT_ADD_RES_INPLACE: return "res+=mm";
|
||||
case MUL_MAT_ADD_B_INPLACE: return "b+=mm";
|
||||
case MUL_MAT_ADD_MM_MM: return "mm2+mm";
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
@@ -7373,6 +7375,12 @@ struct test_mul_mat_add : public test_case {
|
||||
case MUL_MAT_ADD_RES_MM: out = ggml_add(ctx, res, mm); break;
|
||||
case MUL_MAT_ADD_RES_INPLACE: out = ggml_add_inplace(ctx, res, mm); break;
|
||||
case MUL_MAT_ADD_B_INPLACE: out = ggml_add_inplace(ctx, b, mm); break;
|
||||
case MUL_MAT_ADD_MM_MM:
|
||||
{
|
||||
ggml_tensor * a2 = ggml_new_tensor_2d(ctx, type_a, k, m);
|
||||
ggml_tensor * mm2 = ggml_mul_mat(ctx, a2, b);
|
||||
out = ggml_add(ctx, mm2, mm);
|
||||
} break;
|
||||
}
|
||||
ggml_set_name(out, "out");
|
||||
|
||||
@@ -10485,8 +10493,11 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
|
||||
test_cases.emplace_back(new test_mul_mat(GGML_TYPE_Q4_0, GGML_TYPE_F32, m, n, k, {1, 1}, {1, 1}));
|
||||
}
|
||||
test_cases.emplace_back(new test_mul_mat(GGML_TYPE_Q4_0, GGML_TYPE_F32, 64, n, 256, {3, 2}, {2, 1}));
|
||||
for (ggml_type type_a : {GGML_TYPE_F32, GGML_TYPE_F16, GGML_TYPE_Q4_1, GGML_TYPE_Q5_0, GGML_TYPE_Q5_1, GGML_TYPE_Q8_0,
|
||||
GGML_TYPE_Q4_K, GGML_TYPE_Q5_K, GGML_TYPE_Q6_K}) {
|
||||
for (ggml_type type_a : {GGML_TYPE_F32, GGML_TYPE_F16, GGML_TYPE_BF16, GGML_TYPE_Q4_1, GGML_TYPE_Q5_0, GGML_TYPE_Q5_1,
|
||||
GGML_TYPE_Q8_0, GGML_TYPE_Q1_0, GGML_TYPE_Q2_0, GGML_TYPE_MXFP4, GGML_TYPE_Q2_K, GGML_TYPE_Q3_K,
|
||||
GGML_TYPE_Q4_K, GGML_TYPE_Q5_K, GGML_TYPE_Q6_K, GGML_TYPE_TQ2_0,
|
||||
GGML_TYPE_IQ2_XXS, GGML_TYPE_IQ2_XS, GGML_TYPE_IQ2_S, GGML_TYPE_IQ3_XXS, GGML_TYPE_IQ3_S,
|
||||
GGML_TYPE_IQ1_S, GGML_TYPE_IQ1_M, GGML_TYPE_IQ4_NL, GGML_TYPE_IQ4_XS}) {
|
||||
test_cases.emplace_back(new test_mul_mat(type_a, GGML_TYPE_F32, 48, n, 2560, {1, 1}, {1, 1}));
|
||||
test_cases.emplace_back(new test_mul_mat(type_a, GGML_TYPE_F32, 1000, n, 1024, {1, 1}, {1, 1}));
|
||||
test_cases.emplace_back(new test_mul_mat(type_a, GGML_TYPE_F32, 3000, n, 512, {1, 1}, {1, 1}));
|
||||
@@ -10498,7 +10509,7 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
|
||||
}
|
||||
}
|
||||
for (ggml_type type_a : {GGML_TYPE_Q4_0, GGML_TYPE_Q8_0, GGML_TYPE_Q5_K, GGML_TYPE_F16}) {
|
||||
for (mul_mat_add_mode mode : {MUL_MAT_ADD_MM_RES, MUL_MAT_ADD_RES_MM, MUL_MAT_ADD_ROW, MUL_MAT_ADD_RES_INPLACE}) {
|
||||
for (mul_mat_add_mode mode : {MUL_MAT_ADD_MM_RES, MUL_MAT_ADD_RES_MM, MUL_MAT_ADD_ROW, MUL_MAT_ADD_RES_INPLACE, MUL_MAT_ADD_MM_MM}) {
|
||||
test_cases.emplace_back(new test_mul_mat_add(type_a, 1000, n, 1024, mode));
|
||||
}
|
||||
test_cases.emplace_back(new test_mul_mat_add(type_a, 2048, n, 2048, MUL_MAT_ADD_B_INPLACE));
|
||||
@@ -10509,7 +10520,7 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
|
||||
test_cases.emplace_back(new test_mul_mat(type_a, GGML_TYPE_F32, 1000, n, 1024, {1, 1}, {1, 1}, {0, 1, 2, 3}, 1280));
|
||||
}
|
||||
// a src1 with a nonzero mean, for the zero points and mins of quantized src0 types
|
||||
for (ggml_type type_a : {GGML_TYPE_Q4_0, GGML_TYPE_Q4_1, GGML_TYPE_Q5_0, GGML_TYPE_Q8_0, GGML_TYPE_Q4_K, GGML_TYPE_Q5_K}) {
|
||||
for (ggml_type type_a : {GGML_TYPE_Q4_0, GGML_TYPE_Q4_1, GGML_TYPE_Q5_0, GGML_TYPE_Q8_0, GGML_TYPE_Q2_K, GGML_TYPE_Q4_K, GGML_TYPE_Q5_K}) {
|
||||
test_cases.emplace_back(new test_mul_mat_pos(type_a, GGML_TYPE_F32, 1000, n, 1024, {1, 1}, {1, 1}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user