<p dir="ltr"><br>
On Jan 21, 2016 4:37 PM, "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br>
><br>
> I don't know why, but we never hooked up this pass Eric wrote.<br>
> Otherwise, you can end up with stupid scalarized code such as:<br>
><br>
> vec4 ssa_7 = load_const (0.0, 0.0, 0.0, 0.0)<br>
> vec4 ssa_8 = ...<br>
> vec1 ssa_9 = feq ssa_8, ssa_7<br>
> vec1 ssa_10 = feq ssa_8.y, ssa_7.y<br>
> vec1 ssa_11 = feq ssa_8, ssa_7.z<br>
> vec1 ssa_12 = feq ssa_8.y, ssa_7.w<br>
><br>
> ssa_8.xyxy == <0, 0, 0, 0> should only take two feq instructions.<br>
><br>
> shader-db on Skylake:<br>
><br>
> total instructions in shared programs: 9111788 -> 9111384 (-0.00%)<br>
> instructions in affected programs: 32421 -> 32017 (-1.25%)<br>
> helped: 277<br>
> HURT: 69<br>
><br>
> total cycles in shared programs: 69221226 -> 69219394 (-0.00%)<br>
> cycles in affected programs: 917796 -> 915964 (-0.20%)<br>
> helped: 317<br>
> HURT: 408<br>
><br>
> This also prevents regressions when disabling channel expressions.<br>
><br>
> Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
> ---<br>
> src/mesa/drivers/dri/i965/brw_nir.c | 5 +++++<br>
> 1 file changed, 5 insertions(+)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c<br>
> index 935529a..ce9b9db 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_nir.c<br>
> +++ b/src/mesa/drivers/dri/i965/brw_nir.c<br>
> @@ -482,6 +482,11 @@ brw_preprocess_nir(nir_shader *nir, bool is_scalar)<br>
><br>
> nir = nir_optimize(nir, is_scalar);<br>
><br>
> + if (is_scalar) {<br>
> + OPT_V(nir_lower_load_const_to_scalar);<br>
> + OPT(nir_opt_cse);<br>
> + }</p>
<p dir="ltr">Why did you choose to put this *after* the opt loop? It seems like we would want it before so that we can use better. As long as alu_to_scalar is run before constant folding (so we don't end up re-vectorizing them), before should be fine.</p>
<p dir="ltr">> +<br>
> /* Lower a bunch of stuff */<br>
> OPT_V(nir_lower_var_copies);<br>
><br>
> --<br>
> 2.7.0<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>