[WebGPU] Correct MatMul bias input indexing in MatMul::ComputeInternal#28475
Merged
Conversation
Agent-Logs-Url: https://github.com/microsoft/onnxruntime/sessions/b21f1aac-0a81-4b5d-a3bf-38752aeab99a Co-authored-by: guschmue <22941064+guschmue@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix incorrect logic of setting the bias for matmul in WebGPU
[WebGPU] Correct MatMul bias input indexing in May 12, 2026
MatMul::ComputeInternal
guschmue
approved these changes
May 12, 2026
edgchen1
approved these changes
May 12, 2026
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
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.
Description
WebGPU MatMul was wiring bias into the wrong slot in the
inputsvector when bias is present. The vector is pre-sized to 3 and downstream code reads bias frominputs[2], but the previous logic appended bias, placing it at index 3.inputswas initialized with size3for bias cases, then bias was added viapush_back, creating a 4th element.inputs[2], matchingComputeMatMul()and Intel-path expectations.Motivation and Context
This addresses incorrect bias propagation in WebGPU MatMul (
onnxruntime/core/providers/webgpu/math/matmul.cc) caused by index mismatch between producer and consumer logic. The fix is intentionally surgical: one behavioral line change in the affected code path.