SPIR-V Built-In

NumSubgroups

Number of subgroups in a workgroup
NumSubgroups

Decorating a variable with the NumSubgroups built-in decoration will make that variable contain the number of subgroups in the local workgroup.

Valid Usage

VUID-NumSubgroups-NumSubgroups-04293

The NumSubgroups decoration must be used only within the GLCompute, MeshEXT, TaskEXT, MeshNV, or TaskNV

Execution Model

VUID-NumSubgroups-NumSubgroups-04294

The variable decorated with NumSubgroups must be declared using the Input Storage Class

VUID-NumSubgroups-NumSubgroups-04295

The variable decorated with NumSubgroups must be declared as a scalar 32-bit integer value