# workgroup.stack
`workgroup.stack` is a Category C primitive for a bounded LIFO stack resident in
workgroup SRAM. It exposes `push(value)`, `pop()`, `peek()`, `len()`, and
`is_empty()` against a stack handle and `u32` value payloads.
The WGSL lowering executes a uniform command stream across the workgroup. Every
lane visits every command index, synchronizes with `workgroupBarrier()`, and the
selected lane performs the requested operation against shared `var<workgroup>`
storage. Overflow and underflow are explicit status words; no CPU fallback is
part of the Category C contract.
Algebraic laws:
- `StackPushThenPopIdentity`: after a successful `push(x)`, the next `pop()`
returns `x` and restores the previous length.
- `StackPeekDoesNotMutate`: `peek()` returns the same value as `pop()` would
without changing `len()`.
- `BoundedCapacity`: `push` beyond the declared capacity returns overflow and
does not alter the live element count.