by mgraczyk · 11y ago · 0 comments
It's trivial to write microbenchmarks where spilling hot read/write variables to the stack destroys performance, much harder to find special cases where the difference isn't noticeable.
- Workloads that are LSU-bound, like simple per-pixel image operations and level 1 and level 2 BLAS[1]. Here every spill is taking up two LSU dispatch slots that would otherwise be used for "real work".
- Spilled loop-carried dependencies in tight loops; here you're simply adding latency to the critical path.
Both are fairly rare in "generic" code, but very real concerns for compute kernels.
[1] The BLAS operations have few enough buffers that spill/fill never actually happens in practice, but more complex operations on multiple buffers do run into this.