Skip to content

Fix WebGPU buffer segment offset alignment#27853

Merged
guschmue merged 1 commit intomicrosoft:mainfrom
jchen10:offset_align
Mar 27, 2026
Merged

Fix WebGPU buffer segment offset alignment#27853
guschmue merged 1 commit intomicrosoft:mainfrom
jchen10:offset_align

Conversation

@jchen10
Copy link
Copy Markdown
Contributor

@jchen10 jchen10 commented Mar 26, 2026

Align maxStorageBufferBindingSize down to the nearest multiple of minStorageBufferOffsetAlignment after querying device limits. This ensures that when large buffers are split into segments, each segment's byte offset satisfies WebGPU's bind group offset alignment requirement (typically 256 bytes).

Align maxStorageBufferBindingSize down to the nearest multiple of
minStorageBufferOffsetAlignment after querying device limits. This
ensures that when large buffers are split into segments, each
segment's byte offset satisfies WebGPU's bind group offset alignment
requirement (typically 256 bytes).
@jchen10
Copy link
Copy Markdown
Contributor Author

jchen10 commented Mar 26, 2026

The error to fix:

Exception: WebGPU validation failed. Offset (1073741820) of [Buffer (unlabeled)] does not satisfy the minimum BufferBindingType::ReadOnlyStorage alignment (256).
 - While validating entries[1] against { binding: 1, visibility: ShaderStage::Compute, buffer: {type: BufferBindingType::ReadOnlyStorage, minBindingSize: 2, hasDynamicOffset: 0} }.
 - While validating [BindGroupDescriptor ""Gather""] against [BindGroupLayout (unlabeled)]
 - While calling [Device].CreateBindGroup([BindGroupDescriptor ""Gather""]).

@jchen10
Copy link
Copy Markdown
Contributor Author

jchen10 commented Mar 26, 2026

@fs-eire @guschmue @qjia7 PTAL

@guschmue
Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 4 pipeline(s).

@guschmue guschmue added the ep:WebGPU ort-web webgpu provider label Mar 26, 2026
@guschmue guschmue merged commit 1c05b13 into microsoft:main Mar 27, 2026
112 of 115 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ep:WebGPU ort-web webgpu provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants