Skip to content

Commit 9d605df

Browse files
committed
Replace mul_ptr with mul
1 parent f47daed commit 9d605df

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

ggml/src/ggml-cuda/norm.cu

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,8 @@ static __global__ void rms_norm_f32(
120120
x += sample*stride_sample + channel*stride_channel + row*stride_row;
121121
dst += ((sample*nchannels + channel)*nrows + row)*ncols;
122122

123-
const float * mul_ptr = nullptr;
124123
if constexpr (do_multiply) {
125-
mul_ptr = mul + sample*mul_stride_sample + channel*mul_stride_channel + row*mul_stride_row;
124+
mul += sample*mul_stride_sample + channel*mul_stride_channel + row*mul_stride_row;
126125
}
127126

128127
float tmp = 0.0f; // partial sum for thread in warp
@@ -152,7 +151,7 @@ static __global__ void rms_norm_f32(
152151

153152
for (int col = tid; col < ncols; col += block_size) {
154153
if constexpr (do_multiply) {
155-
dst[col] = scale * x[col] * mul_ptr[col];
154+
dst[col] = scale * x[col] * mul[col];
156155
} else {
157156
dst[col] = scale * x[col];
158157
}
@@ -333,7 +332,7 @@ static void rms_norm_mul_f32_cuda(
333332
const int64_t mul_stride_row, const int64_t mul_stride_channel, const int64_t mul_stride_sample,
334333
const float eps, cudaStream_t stream) {
335334
const dim3 blocks_num(nrows, nchannels, nsamples);
336-
if(mul == nullptr) {
335+
if (mul == nullptr) {
337336
rms_norm_f32_cuda(x, dst, ncols, nrows, nchannels, nsamples, stride_row, stride_channel, stride_sample, eps, stream);
338337
return;
339338
}

0 commit comments

Comments
 (0)