[Mesa-dev] [PATCH v2 07/11] intel/nir: Use the new structure and array splitting passes

Caio Marcelo de Oliveira Filho caio.oliveira at intel.com
Tue Aug 21 00:57:00 UTC 2018


On Sat, Jul 28, 2018 at 10:44:38PM -0700, Jason Ekstrand wrote:
> Shader-db results on Kaby Lake:
> 
>     total instructions in shared programs: 15177605 -> 15177605 (0.00%)
>     instructions in affected programs: 0 -> 0
>     helped: 0
>     HURT: 0
> 
> This is unsurprising because nir_lower_vars_to_ssa already effectively
> does structure and array splitting internally.  It doesn't actually
> split the variables but it's ability to reason about aliasing in the
> presence of arrays and structures and pick out scalars or vectors to be
> lowered to SSA values is fairly advanced.
> ---
>  src/intel/compiler/brw_nir.c | 2 ++
>  1 file changed, 2 insertions(+)

This patch is

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>


> diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
> index 5990427b731..96ad77c3906 100644
> --- a/src/intel/compiler/brw_nir.c
> +++ b/src/intel/compiler/brw_nir.c
> @@ -541,6 +541,7 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler,
>     bool progress;
>     do {
>        progress = false;
> +      OPT(nir_split_array_vars, nir_var_local);
>        OPT(nir_lower_vars_to_ssa);
>        OPT(nir_opt_copy_prop_vars);

I'm guessing we do this multiple times (instead of only once like
struct) because other optimizations might turn indirects into directs,
allowing more splitting.  If that's the case maybe worth a note in the
commit message.




More information about the mesa-dev mailing list