Skip to content

Add insertBits edge case regression test#4664

Merged
sudonatalie merged 2 commits into
gpuweb:mainfrom
sudonatalie:metal-insertbits
Jun 13, 2026
Merged

Add insertBits edge case regression test#4664
sudonatalie merged 2 commits into
gpuweb:mainfrom
sudonatalie:metal-insertbits

Conversation

@sudonatalie

Copy link
Copy Markdown
Contributor

This reproduces a GPU hang on Mac for the Dawn implementation (see crbug.com/506180954).


Requirements for PR author:

  • All missing test coverage is tracked with "TODO" or .unimplemented().
  • New helpers are /** documented */ and new helper files are found in helper_index.txt.
  • Test behaves as expected in a WebGPU implementation. (If not passing, explain above.)
  • Test have be tested with compatibility mode validation enabled and behave as expected. (If not passing, explain above.)

Requirements for reviewer sign-off:

  • Tests are properly located.
  • Test descriptions are accurate and complete.
  • Tests provide complete coverage (including validation control cases). Missing coverage MUST be covered by TODOs.
  • Tests avoid over-parameterization (see case count report).

When landing this PR, be sure to make any necessary issue status updates.

This reproduces a GPU hang on Mac for the Dawn implementation (see
crbug.com/506180954).
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

Results for build job (at e074677):

+webgpu:shader,execution,expression,call,builtin,insertBits:array_index:* - 1 cases, 1 subcases (~1/case)
-TOTAL: 281385 cases, 2323156 subcases
+TOTAL: 281386 cases, 2323157 subcases

@sudonatalie

Copy link
Copy Markdown
Contributor Author

Currently fails on my M4 Mac and passes following: https://dawn-review.googlesource.com/c/dawn/+/316515

@sudonatalie sudonatalie requested a review from alan-baker June 12, 2026 19:56
@sudonatalie sudonatalie enabled auto-merge (squash) June 13, 2026 00:50
@sudonatalie sudonatalie merged commit d7791c8 into gpuweb:main Jun 13, 2026
1 check passed
copybara-service Bot pushed a commit to google/dawn that referenced this pull request Jun 13, 2026
When MSL's insert_bits builtin is called with an offset of 32 and a
count of 0, it can trigger a GPU hang.

This works around the issue by clamping to 31, which is the greatest
offset in insert_bits that is not a no-op (inserts only 1 bit at most).
If inserting 0 bits, it is a no-op anyways so the clamp has no
functional affect besides preventing the hang.

Since this does not adhere to the MSL spec a feedback has also been
filed to Apple: FB23103184.

Corresponding CTS that passes only after this change:
gpuweb/cts#4664

Bug: 506180954
Change-Id: I6954f22f56340998cb21bcef8f4a2d618298b89a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/316515
Commit-Queue: Natalie Chouinard <chouinard@google.com>
Reviewed-by: James Price <jrprice@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants