Partly related I believe so perhaps someone can help. Whole theses have been written on prefix sum algorithms, and I never got it. Perhaps someone kind can give some convincing examples of their advantages.
In lieu of pointer chasing, hashing and the like, parallel operations on flat arrays are the way to maximize GPU utilization.
- compact a hash table (i.e., remove the empty slots)
- flatten a jagged 2D array
- rewrite a dense matrix in compressed-sparse-row (CSR) format
The outcome of a prefix sum exactly corresponds with the "row starts" part of the CSR sparse matrix notation. So they are also essential when creating sparse matrices.