这是indexloc提供的服务,不要输入任何密码
Skip to content

allow array size that is a pipeline-overrideable constant #1431

@dneto0

Description

@dneto0

Compute shaders are often parameterized by key sizing knobs: workgroup size, and internal shared storage sizes.

It's important to be able to parameterize the size of an array in workgroup storage. A good pattern for this is to use a pipeline-overridable constant as the size of the array.
(Also following #1272, to allow certain expressions over pipeline-overrideable constants).

FYI, for other environments the resizable workgroup array is supported like this:

  • OpenCL C supports this idiom via a pointer-to-local kernel argument, and on the API side the dispatch specifies the size of the underlying array. (The contents are uninitialized
  • MSL supports this via pointer-to-threadgroup (buffer) kernel argument. On the API side (if I understand it correctly), you supply a regular buffer object, which has a max length (e.g. see here)
  • SPIR-V for Vulkan: Use a specialization constant to size the array.
  • HLSL: I haven't looked. I think we agreed the normal pattern would be to use a #define

Metadata

Metadata

Assignees

Labels

wgslWebGPU Shading Language Issueswgsl resolvedResolved - waiting for a change to the WGSL specification

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions