nir: Add a stripping pass for improved cacheability
authorConnor Abbott <cwabbott0@gmail.com>
Mon, 4 Mar 2019 16:51:12 +0000 (17:51 +0100)
committerConnor Abbott <cwabbott0@gmail.com>
Tue, 12 Mar 2019 09:49:48 +0000 (10:49 +0100)
commit5b2ec9c81e1abafd19f1efbbe499df03ae4aa37e
treeca352f1cdcb042bc2e4ec7c265b7d28964f583aa
parent6403171843824ec8e9484bb8a21a4a18bfb01193
nir: Add a stripping pass for improved cacheability

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.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/Makefile.sources
src/compiler/nir/meson.build
src/compiler/nir/nir.h
src/compiler/nir/nir_strip.c [new file with mode: 0644]