Skip to content

Commit 7f12441

Browse files
committed
ggml-sycl : fix padding in timestep embedding kernel
This commit fixes the zero padding for odd dimensions in the timestep embedding kernel.
1 parent a1de8bd commit 7f12441

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ggml/src/ggml-sycl/tsembd.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ static void timestep_embedding_f32(
2121
int j = item_ct1.get_local_id(2) + item_ct1.get_group(2) * item_ct1.get_local_range(2);
2222
float * embed_data = (float *)((char *)dst + i*nb1);
2323

24-
if (dim % 2 != 0 && j == ((dim + 1) / 2)) {
25-
embed_data[dim] = 0.f;
24+
int half = dim / 2;
25+
26+
if (dim % 2 != 0 && j == half) {
27+
embed_data[2 * half] = 0.f;
2628
}
2729

28-
int half = dim / 2;
2930
if (j >= half) {
3031
return;
3132
}

0 commit comments

Comments
 (0)