[Mesa-dev] [PATCH] nir/constant_folding: Fix source bit size logic

Juan A. Suarez Romero jasuarez at igalia.com
Mon Dec 17 12:11:00 UTC 2018


On Thu, 2018-12-06 at 14:36 -0600, Jason Ekstrand wrote:
> Instead of looking at input_sizes[i] which contains the number of
> components for each source, we look at the bit size of input_types[i].
> This fixes a regression in the 1-bit boolean series though I have no
> idea how we haven't seen it before now.
> 
> Fixes: 35baee5dce5 "nir/constant_folding: fix incorrect bit-size check"
> Fixes: 9076c4e289d "nir: update opcode definitions for different bit sizes"


Commit 9076c4e289d ("nir: update opcode definitions for different bit sizes") is
already included in 18.2 stable queue, but not 35baee5dce5
("nir/constant_folding: fix incorrect bit-size check").

So in order to apply this patch in 18.2, I'm including also the later.



	J.A.

> ---
>  src/compiler/nir/nir_opt_constant_folding.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compiler/nir/nir_opt_constant_folding.c b/src/compiler/nir/nir_opt_constant_folding.c
> index c91e7e16855..5097a3bcc36 100644
> --- a/src/compiler/nir/nir_opt_constant_folding.c
> +++ b/src/compiler/nir/nir_opt_constant_folding.c
> @@ -63,7 +63,8 @@ constant_fold_alu_instr(nir_alu_instr *instr, void *mem_ctx)
>        if (!instr->src[i].src.is_ssa)
>           return false;
>  
> -      if (bit_size == 0 && nir_op_infos[instr->op].input_sizes[i] == 0)
> +      if (bit_size == 0 &&
> +          !nir_alu_type_get_type_size(nir_op_infos[instr->op].input_types[i]))
>           bit_size = instr->src[i].src.ssa->bit_size;
>  
>        nir_instr *src_instr = instr->src[i].src.ssa->parent_instr;



More information about the mesa-dev mailing list