Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create test case to cover observed barrier miscompilation #1983

Open
raphlinus opened this issue Nov 10, 2022 · 0 comments
Open

Create test case to cover observed barrier miscompilation #1983

raphlinus opened this issue Nov 10, 2022 · 0 comments
Assignees
Labels

Comments

@raphlinus
Copy link

In porting piet-gpu to WebGPU, I have come across a serious miscompilation. It would be good to get coverage for this into the CTS. More details are at gfx-rs/wgpu#3181 but I will attempt to condense the essentials here.

The reduced case is a pattern consisting of an atomic add, storing the result of that add into workgroup shared memory, doing a workgroupBarrier() then storing that value (perhaps doing a tiny bit of additional computation such as adding an offset) into a storage buffer, but with that store protected by a conditional guard. If any of these elements are missing, then I am not able to repro the miscompilation. In addition, it only repros when buffer robustness is accomplished through conditionalizing memory accesses (which is the default in naga), not when clamping (the default in tint). That said, though I was not easily able to do so, it would not be surprising to me if it were possible to manifest the bug in other conditions, possibly including in a browser. I can continue exploring.

https://gist.github.com/raphlinus/f32d9602241ea5c99b480e721f1ea834 contains a minimal WGSL and WebGPU repro of the problem. The expected value is [1, 1, 1], but when the WGSL code is run using wgpu 0.14 on a mac M1, it produces three identical garbage values. Rust code for the repro is in linebender/vello#199; I have not yet gotten a failure running in browser.

This was discussed in WGSL office hours earlier today. I'm a bit new at contributing to the WebGPU CTS, but happy to help however I can. I have come across a number of shader compilation issues while developing piet-gpu, and my goal is to land coverage for each of those into the appropriate CTS. Happy to answer any questions or provide more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

4 participants
@dj2 @raphlinus @zoddicus and others