-
Notifications
You must be signed in to change notification settings - Fork 13.7k
ggml-cpu : fix padding in ggml_timestep_embedding #15917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
danbev
merged 1 commit into
ggml-org:master
from
danbev:ggml-timestep-embedding-padding
Sep 10, 2025
Merged
ggml-cpu : fix padding in ggml_timestep_embedding #15917
danbev
merged 1 commit into
ggml-org:master
from
danbev:ggml-timestep-embedding-padding
Sep 10, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ggml-org/ggml#1324
ggerganov
approved these changes
Sep 10, 2025
njsyw1997
pushed a commit
to aizip/llama.cpp
that referenced
this pull request
Sep 10, 2025
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: ggml-org/ggml#1324
danbev
added a commit
to danbev/llama.cpp
that referenced
this pull request
Sep 11, 2025
This commit fixes the zero padding for odd dimensions in the timestep embedding kernel similar to the fix that was applied to the cpu backend in Commit 9de447d ("ggml-cpu : fix padding in ggml_timestep_embedding (ggml-org#15917)"). 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.
danbev
added a commit
to danbev/llama.cpp
that referenced
this pull request
Sep 11, 2025
This commit fixes the zero padding for odd dimensions in the timestep embedding kernel similar to the fix that was applied to the cpu backend in Commit 9de447d ("ggml-cpu : fix padding in ggml_timestep_embedding (ggml-org#15917)"). 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.
danbev
added a commit
to danbev/llama.cpp
that referenced
this pull request
Sep 11, 2025
This commit fixes the zero padding for odd dimensions in the timestep embedding kernel similar to the fix that was applied to the cpu backend in Commit 9de447d ("ggml-cpu : fix padding in ggml_timestep_embedding (ggml-org#15917)"). 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.
danbev
added a commit
to danbev/llama.cpp
that referenced
this pull request
Sep 11, 2025
This commit fixes the zero padding for odd dimensions in the timestep embedding kernel similar to the fix that was applied to the cpu backend in Commit 9de447d ("ggml-cpu : fix padding in ggml_timestep_embedding (ggml-org#15917)"). 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.
danbev
added a commit
to danbev/llama.cpp
that referenced
this pull request
Sep 11, 2025
This commit fixes the zero padding for odd dimensions in the timestep embedding kernel similar to the fix that was applied to the cpu backend in Commit 9de447d ("ggml-cpu : fix padding in ggml_timestep_embedding (ggml-org#15917)"). 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.
danbev
added a commit
to danbev/llama.cpp
that referenced
this pull request
Sep 16, 2025
This commit fixes the zero padding for odd dimensions in the timestep embedding kernel similar to the fix that was applied to the cpu backend in Commit 9de447d ("ggml-cpu : fix padding in ggml_timestep_embedding (ggml-org#15917)"). 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.
danbev
added a commit
to danbev/llama.cpp
that referenced
this pull request
Sep 16, 2025
This commit fixes the zero padding for odd dimensions in the timestep embedding kernel similar to the fix that was applied to the cpu backend in Commit 9de447d ("ggml-cpu : fix padding in ggml_timestep_embedding (ggml-org#15917)"). 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.
danbev
added a commit
to danbev/llama.cpp
that referenced
this pull request
Sep 16, 2025
This commit fixes the zero padding for odd dimensions in the timestep embedding kernel similar to the fix that was applied to the cpu backend in Commit 9de447d ("ggml-cpu : fix padding in ggml_timestep_embedding (ggml-org#15917)"). 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.
danbev
added a commit
to danbev/llama.cpp
that referenced
this pull request
Sep 16, 2025
This commit fixes the zero padding for odd dimensions in the timestep embedding kernel similar to the fix that was applied to the cpu backend in Commit 9de447d ("ggml-cpu : fix padding in ggml_timestep_embedding (ggml-org#15917)"). 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.
danbev
added a commit
to danbev/llama.cpp
that referenced
this pull request
Sep 16, 2025
This commit fixes the zero padding for odd dimensions in the timestep embedding kernel similar to the fix that was applied to the cpu backend in Commit 9de447d ("ggml-cpu : fix padding in ggml_timestep_embedding (ggml-org#15917)"). 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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: ggml-org/ggml#1324