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>
This commit is contained in:
Connor Abbott
2019-03-04 17:51:12 +01:00
parent 6403171843
commit 5b2ec9c81e
4 changed files with 111 additions and 0 deletions

View File

@@ -3378,6 +3378,8 @@ bool nir_opt_undef(nir_shader *shader);
bool nir_opt_conditional_discard(nir_shader *shader);
void nir_strip(nir_shader *shader);
void nir_sweep(nir_shader *shader);
void nir_remap_dual_slot_attributes(nir_shader *shader,