Skip to content

Commit b7873d4

Browse files
committed
bump llama.cpp for phi-2 support ggml-org/llama.cpp#4490
1 parent 862bddf commit b7873d4

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed
32.4 KB
Binary file not shown.

mac/FreeChat/Models/NPC/ggml-metal.metal

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,8 +1702,9 @@ kernel void kernel_rope(
17021702
dst_data[1] = x0*sin_theta + x1*cos_theta;
17031703
}
17041704
} else {
1705-
for (int64_t ib = 0; ib < ne0/n_dims; ++ib) {
1706-
for (int64_t ic = 2*tiitg; ic < n_dims; ic += 2*tptg.x) {
1705+
for (int64_t ic = 2*tiitg; ic < ne0; ic += 2*tptg.x) {
1706+
if (ic < n_dims) {
1707+
const int64_t ib = 0;
17071708

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

17231724
dst_data[0] = x0*cos_theta - x1*sin_theta;
17241725
dst_data[n_dims/2] = x0*sin_theta + x1*cos_theta;
1726+
} else {
1727+
const int64_t i0 = ic;
1728+
1729+
device const T * const src = (device T *)((device char *) src0 + i3*nb03 + i2*nb02 + i1*nb01 + i0*nb00);
1730+
device T * dst_data = (device T *)((device char *) dst + i3*nb3 + i2*nb2 + i1*nb1 + i0*nb0);
1731+
1732+
dst_data[0] = src[0];
1733+
dst_data[1] = src[1];
17251734
}
17261735
}
17271736
}

0 commit comments

Comments
 (0)