Skip to content

ggml-webgpu: fix minimax-m3 crash on webgpu by adding F16 REPEAT - #26307

Merged
fairydreaming merged 1 commit into
ggml-org:masterfrom
yomaytk:fix-webgpu-ci
Aug 2, 2026
Merged

ggml-webgpu: fix minimax-m3 crash on webgpu by adding F16 REPEAT#26307
fairydreaming merged 1 commit into
ggml-org:masterfrom
yomaytk:fix-webgpu-ci

Conversation

@yomaytk

@yomaytk yomaytk commented Jul 30, 2026

Copy link
Copy Markdown
Member

Overview

This PR fixes the error of webgpu ci error for minimax-m3 introduced by #24908.

minimax-m3 graph calls ggml_tensor * bmx = ggml_repeat_4d(ctx0, ...); followed by ggml_add_inplace(ctx0, bmx, ...), but existing webgpu backend doesn't have F16 repeat, so it crashes with Bus error, because the GPU ADD op ends up with an inplace destination on CPU buffer. So it fixes the error by adding F16 repeat support.

Additional information

The root cause seems to be in ggml scheduler, so I'll investigate it and follow up on it in separate PR.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES, to diagnoise and write the code. code is reviewed by me.

@github-actions github-actions Bot added testing Everything test related ggml changes relating to the ggml tensor library for machine learning WebGPU labels Jul 30, 2026
@yomaytk
yomaytk marked this pull request as ready for review July 30, 2026 14:36
@yomaytk
yomaytk requested review from a team and ggerganov as code owners July 30, 2026 14:36

@nikwen nikwen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I didn't see your PR earlier, so I spent a few hours investigating this bug and came to the same solution. Implementing F16 REPEAT fixes the issue.

The crash happens because tensor->buffer->buft->iface.get_name(tensor->buffer->buft) is "CPU" here. We incorrectly cast tensor->buffer->context to ggml_backend_webgpu_buffer_context *. The program then crashes when we try to return ctx->buffer because we attempt an invalid memory access during the copy constructor of wgpu::Buffer.

@fairydreaming fairydreaming left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested this, it fixes the problem with crashing test-llama-archs minimax-m3 test.

@reeselevine

Copy link
Copy Markdown
Contributor

There seems to be a similar potential bug in ggml scheduling that causes a few other models in test-llama-archs to fail too: #25931 (comment)

I noticed that the output buffer for a SET_ROWS operation is on the CPU, despite the input buffers being on the GPU.

@fairydreaming
fairydreaming merged commit 7a2db1a into ggml-org:master Aug 2, 2026
28 of 29 checks passed
@nikwen nikwen mentioned this pull request Aug 2, 2026
@nikwen

nikwen commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

The minimax-m3 tests were disabled in #26415. They should probably be re-enabled after this PR was merged.

(I've hit the open PR limit so can't open another PR myself right now.)

kashif pushed a commit to kashif/llama.cpp that referenced this pull request Aug 2, 2026
TheTom pushed a commit to TheTom/llama-cpp-turboquant that referenced this pull request Aug 3, 2026
belarusian pushed a commit to belarusian/llama.cpp that referenced this pull request Aug 4, 2026
smalinin pushed a commit to smalinin/llama.cpp that referenced this pull request Aug 4, 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 testing Everything test related WebGPU

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants