[Mesa-dev] [PATCH 6/6] i965: Use the nir_move_comparisons pass.

Ian Romanick idr at freedesktop.org
Wed Aug 10 18:08:23 UTC 2016


On 08/09/2016 07:30 PM, Kenneth Graunke wrote:
> On Haswell (GL 3.3):
> 
> total instructions in shared programs: 6211427 -> 6210079 (-0.02%)
> instructions in affected programs: 219356 -> 218008 (-0.61%)
> helped: 567
> HURT: 132
> 
> No spill/fill changes.
> 
> LOST:   0
> GAINED: 4
> 
> On Broadwell (GL 4.4):
> 
> total instructions in shared programs: 11640218 -> 11632136 (-0.07%)
> instructions in affected programs: 542528 -> 534446 (-1.49%)
> helped: 1661
> HURT: 143
> 
> total spills in shared programs: 2922 -> 2932 (0.34%)
> spills in affected programs: 420 -> 430 (2.38%)
> helped: 1
> HURT: 1
> 
> total fills in shared programs: 4389 -> 4390 (0.02%)
> fills in affected programs: 967 -> 968 (0.10%)
> helped: 1
> HURT: 1

I would have thought that this would help more.  I wonder if it's being
held back by the poor way we handle || and &&.  We always implement
these as actual instructions, but we could use predication.  I had
looked into this a very little bit in days just before NIR, and it
looked promising.  Once NIR landed, I couldn't tell the difference
between logical-or and bitwise-or, and I abandoned the effort.

I also had problems dealing with the single condition code register that
we use.  Long sequences like (a && b || c && d) really want to use all
the condition code registers.

> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_nir.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
> index db2056d..b02c404 100644
> --- a/src/mesa/drivers/dri/i965/brw_nir.c
> +++ b/src/mesa/drivers/dri/i965/brw_nir.c
> @@ -487,6 +487,7 @@ brw_postprocess_nir(nir_shader *nir,
>     OPT_V(nir_lower_to_source_mods);
>     OPT(nir_copy_prop);
>     OPT(nir_opt_dce);
> +   OPT(nir_opt_move_comparisons);
>  
>     OPT(nir_lower_locals_to_regs);
>  
> 



More information about the mesa-dev mailing list