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

Jason Ekstrand jason at jlekstrand.net
Sun Jul 29 05:44:38 UTC 2018


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(+)

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);
 
@@ -648,6 +649,7 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir)
    OPT(nir_lower_global_vars_to_local);
 
    OPT(nir_split_var_copies);
+   OPT(nir_split_struct_vars, nir_var_local);
 
    /* Run opt_algebraic before int64 lowering so we can hopefully get rid
     * of some int64 instructions.
-- 
2.17.1



More information about the mesa-dev mailing list