Skip to content

Commit

Permalink
bump llama.cpp for phi-2 support ggerganov/llama.cpp#4490
Browse files Browse the repository at this point in the history
  • Loading branch information
psugihara committed Dec 18, 2023
1 parent 862bddf commit b7873d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Binary file modified mac/FreeChat/Models/NPC/freechat-server
Binary file not shown.
13 changes: 11 additions & 2 deletions mac/FreeChat/Models/NPC/ggml-metal.metal
Original file line number Diff line number Diff line change
Expand Up @@ -1702,8 +1702,9 @@ kernel void kernel_rope(
dst_data[1] = x0*sin_theta + x1*cos_theta;
}
} else {
for (int64_t ib = 0; ib < ne0/n_dims; ++ib) {
for (int64_t ic = 2*tiitg; ic < n_dims; ic += 2*tptg.x) {
for (int64_t ic = 2*tiitg; ic < ne0; ic += 2*tptg.x) {
if (ic < n_dims) {
const int64_t ib = 0;

// simplified from `(ib * n_dims + ic) * inv_ndims`
const float cur_rot = inv_ndims*ic - ib;
Expand All @@ -1722,6 +1723,14 @@ kernel void kernel_rope(

dst_data[0] = x0*cos_theta - x1*sin_theta;
dst_data[n_dims/2] = x0*sin_theta + x1*cos_theta;
} else {
const int64_t i0 = ic;

device const T * const src = (device T *)((device char *) src0 + i3*nb03 + i2*nb02 + i1*nb01 + i0*nb00);
device T * dst_data = (device T *)((device char *) dst + i3*nb3 + i2*nb2 + i1*nb1 + i0*nb0);

dst_data[0] = src[0];
dst_data[1] = src[1];
}
}
}
Expand Down

0 comments on commit b7873d4

Please sign in to comment.