wgpu: device.create_compute_pipeline hangs

I want to run a compute shader. Everything until and including device.create_shader_module runs without problems, no validation errors. The next step is to call device.create_compute_pipeline which hangs. From system monitor i see that this call uses around 3 GB of RAM.

I created a repo where you can reproduce this issue: Issue repo

I probably just misunderstood something about wgsl but i am not sure how to find the problem since naga doesn’t give me any errors.

Is this related to the compute shader being rather big? Could you give me some pointers how to find the problem?

Tried this on different systems: Linux Ubuntu / Mesa Intel Iris Plus Graphics (ICL GT2) Linux Ubuntu / NVIDIA Quadro M4000 Windows 10 / NVIDIA Quadro M4000

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 21 (8 by maintainers)

Most upvoted comments

I ran into this issue on a Macbook Air with an M1 processor. I found the cause to be a large multi-dimensional array in the workgroup memory space. I made a minimal repro case here: https://github.com/vimwitch/webgpu-hang-repro

Some things I noticed during testing:

  • Problem does not occur for storage memory
  • Problem occurs with single dimensional arrays
  • After waiting for the pipeline to be created once, subsequent creations do not hang. Changing the size of the array causes the next creation to hang. Reverting to the previous value after waiting for the changed size to be created does not result in another hang.
  • Changing shader logic causes the hang to occur again
  • Changing workgroup size does not cause hang to occur again
  • If the shader logic does not touch the array the hang does not occur
  • During the hang system memory and CPU use is unaffected
  • During the hang the program CPU use is 0, memory use is constant at 3.9 MB

Apple M1 Macbook Air OSX 12.5