[Mesa-dev] [PATCH 17/28] intel/nir: call nir_opt_constant_folding before nir_opt_algebraic is executed

Connor Abbott cwabbott0 at gmail.com
Wed Dec 5 18:22:52 UTC 2018


Why is this needed? In general, we shouldn't be relying on
optimization ordering for correctness. It probably just means one of
the optimizations is wrong, and you're working around that.
On Wed, Dec 5, 2018 at 4:56 PM Samuel Iglesias Gonsálvez
<siglesias at igalia.com> wrote:
>
> This would do constant folding and also flush to zero denorms operands before
> the nir_opt_algebraic is executed.
>
> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
> ---
>  src/intel/compiler/brw_nir.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
> index 0a5aa35c700..600f7a97df9 100644
> --- a/src/intel/compiler/brw_nir.c
> +++ b/src/intel/compiler/brw_nir.c
> @@ -570,8 +570,8 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler,
>        OPT(nir_opt_cse);
>        OPT(nir_opt_peephole_select, 0);
>        OPT(nir_opt_intrinsics);
> -      OPT(nir_opt_algebraic);
>        OPT(nir_opt_constant_folding);
> +      OPT(nir_opt_algebraic);
>        OPT(nir_opt_dead_cf);
>        if (OPT(nir_opt_trivial_continues)) {
>           /* If nir_opt_trivial_continues makes progress, then we need to clean
> --
> 2.19.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