SPIR-V Built-In

SubgroupSize

Size of a subgroup
SubgroupSize

Decorating a variable with the SubgroupSize builtin decoration will make that variable contain the implementation-dependent number of invocations in a subgroup. This value must be a power-of-two integer.

If the shader was created with varying subgroup size allowed, the SubgroupSize decorated variable will contain the subgroup size for each subgroup that gets dispatched. This value must be between minSubgroupSize and maxSubgroupSize and must be uniform with subgroup scope.

If the shader was created with a required subgroup size, the SubgroupSize decorated variable will match that value.

If the shader does not allow varying subgroup sizes, the variable decorated with SubgroupSize will match subgroupSize.

The maximum number of invocations that an implementation can support per subgroup is 128.

Valid Usage

VUID-SubgroupSize-SubgroupSize-04382

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

VUID-SubgroupSize-SubgroupSize-04383

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