]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
ggml-cpu : fix padding in ggml_timestep_embedding (llama/15917)
authorDaniel Bevenius <redacted>
Wed, 10 Sep 2025 15:31:40 +0000 (17:31 +0200)
committerGeorgi Gerganov <redacted>
Sat, 20 Sep 2025 10:45:27 +0000 (13:45 +0300)
commit3617008c37ff5763c43e63e555480f4397ecac18
tree7625b8cb781e148a9c3814eabebd46470372b17c
parentc974f6305735529096934ccb80a7197de6999faf
ggml-cpu : fix padding in ggml_timestep_embedding (llama/15917)

This commit fixes the zero padding for odd dimensions in
ggml_compute_forward_timestep_embedding_f32.
The motivation for this is that currently if an odd dimension is used,
the padding check incorrectly uses the dimension value for indexing.
For example, with dim=15:

Elements 0-6 are set to cosine values
Elements 7-13 are set to sine values
Element 14 is left uninitialized (contains garbage)
Element 15 is correctly set to zero

This fix changes embed_data[dim] to embed_data[2 * half] so that
element 14 (the first unused element) is properly set to zero as well
as the last element.

Resolves: https://github.com/ggml-org/ggml/issues/1324
ggml/src/ggml-cpu/ops.cpp