---
title: "num_subgroups: builtin value, TypeShade language reference"
description: "num_subgroups, a builtin value in the TypeShade language reference. The number of subgroups in the current workgroup."
url: https://typeshade.dev/reference/builtin-values/num_subgroups/
language: en
---

# `@builtin("num_subgroups")`

Builtin value

The number of subgroups in the current workgroup.

**Valid in**

compute input

The signature, the sentence and any message are the compiler's own text at commit af54ddad5.

## Syntax

`@builtin("num_subgroups"): u32`

## Description

Compute stage only; on the CPU oracle and on WebGL2 a subgroup is one invocation, so it is the workgroup size.

## Examples

- [`gallery/subgroup-reduce/subgroup-reduce.shade.ts`](https://typeshade.dev/guide/examples/subgroup-reduce/)

## See also

- [Builtin values](https://typeshade.dev/reference/builtin-values/)
