Compute Shaders on WebGPU cause crashes

I’m using a compute shader to write a 3d worley noise texture. While it does work, sometimes it causes a crash.

This crash / error happens more often when the workgroups size of the compute shader is bigger.
Im currently trying this on the babylon playground, version 5.0.0-beta.9. I know I’m working on a beta version but I figured it might be something else since the compute shader demos don’t cause this issue.

(If needed I can provide my code)

Thank you.

It could also be a bug in Chrome Canary as the implementation is not finalized yet. That’s hard to tell, you can try to ask some questions in the matrix channel of Dawn ( which is the implementation of WebGPU in Chrome but they may need some sort of repro to be able to investigate.

I believe this happens when a vulkan command exceeds its timeout . I actually first saw it here, around 20 mins in I FIXED VULKAN! - YouTube

vulkan docs on lost device info, pretty meh: Vulkan® 1.3.206 - A Specification (with all registered Vulkan extensions) . not very useful or anything, but it does mention that timeouts return VK_ERROR_DEVICE_LOST . Worth noting in the vid i posted above, the timeout erros he was getting were low single digit seconds. Not sure if i’m reading it correctly, but there seems to be an extension called vkWaitForFences that will return a VK_TIMEOUT instead of device lost error. Maybe if you want to go down a rabbit hole, googling about vulkan logical devices worked for me. The docs also say you may or may not lose logical device on validation error too.

(A) Which OS are you using is the any possibility if you can execute you code on other OS. On Mac, Metal is used and on Windows Vulkan and Dx12 is used by underlying webgpu implementation. This will allow you to narrow down the problem if its a Babylon or WebGPU specific.

(B) Indeed there exist scenario on OS like Linux where I have seen the presentation layer surface greater that 800x600 crashes, it an open bug in Linux. Perhaps in your case something could be similar. If you suspect its a texture size problem I will suggest you to replicate and see what size it crashes.

(C) Try execute the browser from terminal - you will find more validation layer or errors on runtime. I remember validation layer are enabled by default.

(D) Please check the console error it may a possibility the you shader are has some problem, the specs are constantly updating.

1 Like