Builtin Library
- ..
- README.md1.1 KB
- bindings.yaml348 B
- shader.wgsl2.0 KB
README.md
radix_scan
Stage 2 of one pass of the shared GPU radix sort. Exactly one workgroup, once per radix pass.
Turns the per-block digit populations radix_hist wrote into their exclusive
prefix sum, in place. The histogram is laid out digit-major, so the scan gives
every (digit, block) pair the first order slot its items occupy: every item of a
lower digit comes first, and within one digit every item from an earlier block
comes first.
The scan is blocked: each thread sums a contiguous stripe of entries, the stripe sums are scanned in workgroup memory, then each thread rewalks its stripe applying the running base. One workgroup keeps the whole scan inside a single barrier domain, which is what makes it correct without a second dispatch, and the two barriers keep each thread's read pass clear of every other thread's write pass.
Bindings
| Slot | Access | Contents |
|---|---|---|
hist | read_write | Digit populations, scanned in place. |
sort | read | [1] = block count; the scan covers block_count * 256 entries. |
Dispatch { 1, 1, 1 }.