Skip to content

Fix: Handle unaligned writes in ggml_backend_webgpu_buffer_set_tensor - #29471

Merged
ggerganov merged 2 commits into
ggml-org:masterfrom
jbooth:webgpu_fix
Sep 28, 2026
Merged

ggerganov merged 2 commits into
ggml-org:masterfrom
jbooth:webgpu_fix

Conversation

@jbooth

@jbooth jbooth commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Overview

CI tests are failing consistently with an unaligned memory write for webgpu. Example here: https://github.com/ggml-org/llama.cpp/actions/runs/36205666525/job/108318129946?pr=27851.

This fix mirrors the tail section of ggml_backend_webgpu_buffer_set_tensor, which already checks if length % 4 != 0, with an analogous head section which checks if offset % 4 != 0.

Additional information

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: Used AI to diagnose and implement fix, reviewed myself before posting.

@jbooth
jbooth requested a review from a team as a code owner September 26, 2026 08:12
@github-actions github-actions Bot added ggml changes relating to the ggml tensor library for machine learning WebGPU labels Sep 26, 2026

@yomaytk yomaytk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good to me, thanks!
But the formatting CI fails, so could you format the target file? We recommend to use clang-format of version 22 or later.

@ggerganov
ggerganov merged commit f00a64c into ggml-org:master Sep 28, 2026
18 checks passed
@ggerganov

Copy link
Copy Markdown
Member

With the newly added tests, there is a new error for webgpu:

https://github.com/ggml-org/llama.cpp/actions/runs/36430015039/job/108953479413#step:7:1042

@yomaytk

yomaytk commented Sep 29, 2026

Copy link
Copy Markdown
Member

With the newly added tests, there is a new error for webgpu:

https://github.com/ggml-org/llama.cpp/actions/runs/36430015039/job/108953479413#step:7:1042

Ok, I'll look into it tomorrow.

pierreguillot pushed a commit to Ircam-Partiels/llama.cpp that referenced this pull request Oct 1, 2026
…sor (ggml-org#29471)

* Fix:  Handle unaligned writes in ggml_backend_webgpu_buffer_set_tensor

* Clang formatting
frostyautumnleaf pushed a commit to frostyautumnleaf/llama.cpp that referenced this pull request Oct 5, 2026
…sor (ggml-org#29471)

* Fix:  Handle unaligned writes in ggml_backend_webgpu_buffer_set_tensor

* Clang formatting
edwardyoon pushed a commit to edwardyoon/focus-llama that referenced this pull request Oct 7, 2026
…sor (ggml-org#29471)

* Fix:  Handle unaligned writes in ggml_backend_webgpu_buffer_set_tensor

* Clang formatting

(cherry picked from commit f00a64c)
pratiknarola-t added a commit to tetherto/qvac-fabric-llm.cpp that referenced this pull request Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning WebGPU

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants