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

Fix compile failure and further optimize by using vec_msum & vec_sum4s on ppc64le #849

Merged
merged 4 commits into from
Jun 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
fix compile issues introduced by loongarch_asx
  • Loading branch information
penghongbo committed Jun 4, 2024
commit 0ba346e1415d8234006b9b064d6e32c999523b07
4 changes: 4 additions & 0 deletions src/ggml-quants.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,7 @@ void quantize_row_q8_0(const float * restrict x, void * restrict vy, int64_t k)
}
vec_xst(vec_pack(vec_pack(vi[0], vi[1]), vec_pack(vi[2], vi[3])), 0, &y[i].qs[0]);
vec_xst(vec_pack(vec_pack(vi[4], vi[5]), vec_pack(vi[6], vi[7])), 16, &y[i].qs[0]);
}

#elif defined(__loongarch_asx)
for (int i = 0; i < nb; i++) {
Expand Down Expand Up @@ -1437,6 +1438,7 @@ void quantize_row_q8_1(const float * restrict x, void * restrict vy, int64_t k)
accv = vec_add(accv, vec_sld(accv, accv, 4));
accv = vec_add(accv, vec_sld(accv, accv, 8));
y[i].s = GGML_FP32_TO_FP16(d * vec_extract(accv, 0));
}

#elif defined(__loongarch_asx)
for (int i = 0; i < nb; i++) {
Expand Down Expand Up @@ -5984,6 +5986,8 @@ void ggml_vec_dot_q2_K_q8_K(int n, float * restrict s, size_t bs, const void * r
vector signed int vsumi6 = vec_splats((int32_t)0);
vector signed int vsumi7 = vec_splats((int32_t)0);

const uint8_t * restrict q2 = x[i].qs;
const int8_t * restrict q8 = y[i].qs;

for (int j = 0; j < QK_K/128; ++j) {
__builtin_prefetch(q2, 0, 1);
Expand Down