Skip to content

Commit 2c4f95d

Browse files
committed
swap arguments to vDSP_vdiv call
documentation for vDSP_vdiv states: "Note that B comes before A!"
1 parent 6cc42de commit 2c4f95d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ggml.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8777,8 +8777,8 @@ static void ggml_compute_forward_div_f32(
87778777

87788778
#ifdef GGML_USE_ACCELERATE
87798779
vDSP_vdiv(
8780-
(float *) ((char *) src0->data + i3*nb03 + i2*nb02 + i1*nb01), 1,
87818780
(float *) ((char *) src1->data + i3*nb13 + i2*nb12 + i1*nb11), 1,
8781+
(float *) ((char *) src0->data + i3*nb03 + i2*nb02 + i1*nb01), 1,
87828782
(float *) ((char *) dst->data + i3*nb3 + i2*nb2 + i1*nb1 ), 1,
87838783
ne0);
87848784
#else
@@ -9831,15 +9831,15 @@ static void ggml_compute_forward_rms_norm_back_f32(
98319831
sum_xdz += (ggml_float)(x[i00] * dz[i00]);
98329832
}
98339833

9834-
const float mean = sum_xx/ne00;
9835-
const float mean_eps = sum_xx/ne00 + eps;
9836-
const float sum_eps = sum_xx + eps*ne00;
9837-
const float mean_xdz = sum_xdz/ne00;
9834+
const ggml_float mean = sum_xx/ne00;
9835+
const ggml_float mean_eps = sum_xx/ne00 + eps;
9836+
const ggml_float sum_eps = sum_xx + eps*ne00;
9837+
const ggml_float mean_xdz = sum_xdz/ne00;
98389838
// we could cache rms from forward pass to improve performance.
98399839
// to do this implement ggml_rms and compose ggml_rms_norm using ggml_rms.
9840-
const float rms = sqrtf(mean_eps);
9841-
const float rrms = 1.0f / sqrtf(mean_eps);
9842-
const float scale = -rrms/(ne00 * mean_eps); // -1/(n*rms**3)
9840+
const ggml_float rms = sqrtf(mean_eps);
9841+
const ggml_float rrms = 1.0f / sqrtf(mean_eps);
9842+
const ggml_float scale = -rrms/(ne00 * mean_eps); // -1/(n*rms**3)
98439843

98449844
{
98459845
// z = rms_norm(x)

0 commit comments

Comments
 (0)