Skip to content

Commit cb6b133

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

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ggml/src/ggml-vulkan/vulkan-shaders/timestep_embedding.comp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ void main() {
2424
const uint j = gl_GlobalInvocationID.x;
2525
const uint d_offset = i * p.nb1;
2626

27-
if (p.dim % 2 != 0 && j == ((p.dim + 1) / 2)) {
28-
data_d[d_offset + p.dim] = 0.f;
27+
const uint half_dim = p.dim / 2;
28+
29+
if (p.dim % 2 != 0 && j == half_dim) {
30+
data_d[d_offset + 2 * half_dim] = 0.f;
2931
}
3032

31-
const uint half_dim = p.dim / 2;
3233
if (j >= half_dim) {
3334
return;
3435
}

0 commit comments

Comments
 (0)