1

I'm writing a Compute Shader in Unity. I understand that a set of threads within a workgroup can execute in any order / fully in parallel on the hardware. What I'm not sure about is whether a set of workgroups are executed in a particular order?

If my kernel is annotated with numthreads(256, 1, 1), does that mean that the SV_GroupID zero is executed first with its threads SV_GroupIndex from 0 to 255 (in any order), followed by SV_GroupID number one, etc?

If not by default, is there any way to enforce it...? Could I set the number of threads equal to the number available on hardware to ensure it's only able to execute one group at a time or something? (sounds hacky!)

Context: I have a sparse array of ordered data, and I'm attempting to condense it down into a dense array while retaining the order. Taking advantage of the existing ordering using a parallel algorithm is proving tricky!

Joseph Humfrey
  • 2,974
  • 2
  • 23
  • 34

0 Answers0