Skip to content

webgpu: fix SSM_SCAN binding aliasing - #29750

Merged
yomaytk merged 1 commit into
ggml-org:masterfrom
yomaytk:fix-ssm-scan
Oct 1, 2026
Merged

yomaytk merged 1 commit into
ggml-org:masterfrom
yomaytk:fix-ssm-scan

Conversation

@yomaytk

@yomaytk yomaytk commented Sep 30, 2026

Copy link
Copy Markdown
Member

Overview

This PR fixes the CI error: https://github.com/ggml-org/llama.cpp/actions/runs/36430015039/job/108953479413#step:7:1042

The existing xbc_overlap condition includes 4 tensors x, dt, B, C, and xbc_merged_range is calculated from all 4 tensors.
But in the Falcon-H1 model dst is placed between dt and x/B/C, so the merged binding overlapped dst and caused the aliasing error.

This change handles only the overlapping patterns x/B, B/C and x/B/C, which appear in the currently supported models using ssm_scan.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES, used AI to investigate the overlapping pattern for tensors of ssm_scan and reviewing the change

@yomaytk
yomaytk requested a review from a team as a code owner September 30, 2026 14:51
@github-actions github-actions Bot added ggml changes relating to the ggml tensor library for machine learning WebGPU labels Sep 30, 2026

uint8_t xbc_overlap = 0;
if (ggml_webgpu_tensor_binding_overlap(ctx->global_ctx, src1, src4)) {
xbc_overlap |= 0b110; // x/B

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.

😆 What's wrong with ORing flags?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Haha, nothing wrong at all!

@yomaytk
yomaytk merged commit 0c1e570 into ggml-org:master Oct 1, 2026
21 of 23 checks passed
@ggerganov

Copy link
Copy Markdown
Member

@yomaytk

yomaytk commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

@yomaytk There is a new failure with the glm5-next model: https://github.com/ggml-org/llama.cpp/actions/runs/36983330468/job/110762637185#step:8:12265

@ggerganov OK, I'll address it by tomorrow.

@yomaytk
yomaytk deleted the fix-ssm-scan branch October 3, 2026 07:43
edwardyoon pushed a commit to edwardyoon/focus-llama that referenced this pull request Oct 7, 2026
gagallo7 added a commit to gagallo7/qvac-fabric-llm.cpp that referenced this pull request Oct 16, 2026
Fix overlapping WebGPU storage bindings during Falcon-H1 rollback warmup.
Write through the merged input binding and test both aliasing variants.

b11514 rebase: WebGPU host side subsumed by upstream 0c1e570
(ggml-org#29750, x/B/C-only binding merge): WebGPU files are upstream; the
SSM_SCAN dst/ids-in-gap test cases are kept as regression coverage.

Assisted-by: Codex
(cherry picked from commit 2066738)
Assisted-by: Claude Opus 5.5
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
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