gpuweb / gpuweb

Where the GPU for the Web work happens!

Home Page:http://webgpu.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reduce byte-size limit for function and private address spaces

jrprice opened this issue · comments

The WGSL spec currently has a 64k limit for arrays in the function and private address spaces.

Through CTS testing, we have found that 64k is too ambitious, with these tests failing beyond 8k on certain platforms (e.g. Metal + Apple silicon). To better reflect reality, I propose the following changes to this limit:

  1. Lower it to 8192 bytes.
  2. Replace "array type" with "variable", as the limit applies to any type
  3. Apply the limit to the aggregation of all private variables referenced by an entry point, and all variables declared inside a function.

Since these limits are purely informative and implementations are permitted so support shaders that go beyond them, this is a backwards compatible change.

WGSL 2024-04-16 Minutes
  • JB: Same experience in Naga to blow stack before reaching nesting depth of statements.
  • KG: Allowable to go beyond, consensus is to merge all of these. If impl wants to go further they can.
  • JP: Fine with me. Only non-simple lower is array sizes. Do we want to also signal that hte limit is about the aggregation of the variables in a given address space. We say 8k for an array, but in reality you have to consider the size of all the private variables together.
  • KG: Good distinction, worth noting. In line with how we give limits for other things.
  • JB: Have option to declare an implementation restriction. If I make a jillion structs things go badly. To some extent, leaning on that anyway.
  • Approved