[Mesa-dev] [PATCH] nir: call nir_index_local_regs(..) to update reg_alloc

Jason Ekstrand jason at jlekstrand.net
Sun Jun 24 20:13:59 UTC 2018


In general, drivers and passes shouldn't rely on the results of 
index_*_regs or index_ssa_defs after an optimization or lowering pass is 
run.  We've considered the results of those functions to be too volatile to 
try and keep up to date.  Drivers or passes are expected to call the 
indexing function themselves if they need that information.


That doesn't mean this change is necessarily wrong or that we don't want to 
move in a direction of trying to keep more of that information up to date.  
It does mean that the behavior you're seeing isn't really a bug and that 
changing that behavior will require more than just this patch.  Could you 
provide more context on what issue you're having and what you're trying to 
accomplish?


--Jason


On June 24, 2018 09:37:05 Christian Gmeiner <christian.gmeiner at gmail.com> 
wrote:

> After calling nir_lower_regs_to_ssa(..) nir_function_impl's reg_alloc
> counter still hold its old value. Just call nir_index_local_regs(..) to
> set reg_alloc to the correct value - which should be 0.
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> ---
> src/compiler/nir/nir_lower_regs_to_ssa.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/compiler/nir/nir_lower_regs_to_ssa.c 
> b/src/compiler/nir/nir_lower_regs_to_ssa.c
> index d70e70260b..7214e92b90 100644
> --- a/src/compiler/nir/nir_lower_regs_to_ssa.c
> +++ b/src/compiler/nir/nir_lower_regs_to_ssa.c
> @@ -275,6 +275,8 @@ nir_lower_regs_to_ssa_impl(nir_function_impl *impl)
>       }
>    }
>
> +   nir_index_local_regs(impl);
> +
>    free(state.values);
>
>    nir_metadata_preserve(impl, nir_metadata_block_index |
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev





More information about the mesa-dev mailing list