Skip to content

Commit 5db73a8

Browse files
committed
ggml-cuda : fix padding in timestep embedding kernel
This commit removes the zeroing out of the last dimension now that we are not adding the extra padding dimension.
1 parent c40a17a commit 5db73a8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ggml/src/ggml-cuda/tsembd.cu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ static __global__ void timestep_embedding_f32(const float * timesteps, float * d
77
int j = threadIdx.x + blockIdx.x * blockDim.x;
88
float * embed_data = (float *)((char *)dst + i*nb1);
99

10-
if (dim % 2 != 0 && j == ((dim + 1) / 2)) {
11-
embed_data[dim] = 0.f;
10+
int half = dim / 2;
11+
if (dim % 2 != 0 && j == half) {
12+
embed_data[2 * half] = 0.f;
1213
}
1314

14-
int half = dim / 2;
1515
if (j >= half) {
1616
return;
1717
}

0 commit comments

Comments
 (0)