radeonsi/nir: Use nir stripping pass
authorConnor Abbott <cwabbott0@gmail.com>
Mon, 4 Mar 2019 17:00:30 +0000 (18:00 +0100)
committerConnor Abbott <cwabbott0@gmail.com>
Tue, 12 Mar 2019 09:49:48 +0000 (10:49 +0100)
This reduces compilation time for my shader-db collection from around 40
seconds to 30, vs. 19 seconds for TGSI. There are still some shaders
that TGSI caches but NIR doesn't, partly because of more aggressive
cross-stage optimizations with NIR.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/gallium/drivers/radeonsi/si_shader_nir.c

index 5fc1df250aafbbc95a45727953f73135e67dfba9..25429fdeab7f353ca8afddca9f028b23536cb67a 100644 (file)
@@ -892,6 +892,11 @@ si_lower_nir(struct si_shader_selector* sel)
        } while (progress);
 
        NIR_PASS_V(sel->nir, nir_lower_bool_to_int32);
+
+       /* Strip the resulting shader so that the shader cache is more likely
+        * to hit from other similar shaders.
+        */
+       nir_strip(sel->nir);
 }
 
 static void declare_nir_input_vs(struct si_shader_context *ctx,