nir: Add a stripping pass for improved cacheability

Graphics / Mesa 3D Graphics Library / Mesa - Connor Abbott [] - 12 March 2019 09:49 EDT

Oftentimes various nir shaders after lowering will be the same, or almost the same. For example, this can happen when the same shader is linked with different shaders to form different pipelines and cross-stage optimizations don't kick in to change it. We want to avoid running the backend twice on these shaders. We were already doing this with radeonsi, but we were storing a few extra pieces of information that made this much less effective compared to TGSI. The worse offender by far was the program name, which caused most of the cache misses. This pass strips out these pieces of information, controlled by the NIR_STRIP debug env variable.

5b2ec9c81e1 nir: Add a stripping pass for improved cacheability
src/compiler/Makefile.sources | 1 +
src/compiler/nir/ | 1 +
src/compiler/nir/nir.h | 2 +
src/compiler/nir/nir_strip.c | 107 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 111 insertions(+)


  • Share