Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster AVX2 matrix multiplications for MoE models #428

Merged
merged 3 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions llama.cpp/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -10642,6 +10642,20 @@ static void ggml_compute_forward_mul_mat_id(
const int64_t nr0 = ne01; // src0 rows
const int64_t nr1 = cne1; // src1 rows

if ((vec_dot_type == GGML_TYPE_Q8_K || vec_dot_type == GGML_TYPE_Q8_0 ||
vec_dot_type == GGML_TYPE_Q8_1) && dst->type == GGML_TYPE_F32) {
if (ne13 == 1) {
if (!llamafile_mixmul_iqk(nr0, nr1, ne00, ne11, src0->type,
(const char *)src0_cur,
(const char *)wdata,
(float *)dst->data, nb1, nb2,
matrix_rows + cur_a*ne12,
ith, nth)) goto IQK_MulMat_Not_Available;
continue;
}
}
IQK_MulMat_Not_Available:;

// distribute the thread work across the inner or outer loop based on which one is larger

const int64_t nth0 = nr0 > nr1 ? nth : 1; // parallelize by src0 rows
Expand Down
Loading