0

I have simple compute shader like:

@compute @workgroup_size(x, y, z)
fn main(@builtin(global_invocation_id) global_id : vec3<u32>) {
    ...
}

where x, y and z are some integers. But I suppose the size of a data, I want to handle will be super large. So what is the maximum value I can specify for x, y and z? If it is system-dependent, so how I can determine it programmatically? How can I handle data, that is out of these limits?

Nikolai
  • 656
  • 6
  • 19

1 Answers1

1

The maximum values are listed in the spec with:

  • Maximum X - 256
  • Maximum Y - 256
  • Maximum Z - 64

With an overall maximum of (X * Y * Z of 65535)

dj2
  • 9,534
  • 4
  • 29
  • 52
  • 1
    You may have misunderstood spec, `WorkgroupSize` and `maxComputeWorkgroupsPerDimension` are two different parameters. `maxComputeWorkgroupsPerDimension` (its value is 65535) is the maximum value for the arguments of `cpass.dispatchWorkgroups(...)`, and `WorkgroupSizeX * Y * Z` must be <= 256 ([`maxComputeInvocationsPerWorkgroup`](https://gpuweb.github.io/gpuweb/#dom-supported-limits-maxcomputeinvocationsperworkgroup)) – Jinlei Li Jan 07 '23 at 06:34