[Mesa-dev] [PATCH] nir/constant_folding: fix incorrect bit-size check

Jason Ekstrand jason at jlekstrand.net
Mon Dec 17 13:43:31 UTC 2018


On December 17, 2018 06:09:36 "Juan A. Suarez Romero" <jasuarez at igalia.com> 
wrote:

> On Wed, 2018-10-31 at 12:18 +0100, Iago Toral Quiroga wrote:
>> nir_alu_type_get_type_size takes a type as parameter and we were
>> passing a bit-size instead, which did what we wanted by accident,
>> since a bit-size of zero matches nir_type_invalid, which has a
>> size of 0 too.
>> ---
>
>
> While this patch wasn't nominated to stable, I'm adding it in 18.2 for two
> reasons:
>
> - As title suggests, it fixes an issue.
> - It is required in order to apply 3595a0abf43 ("nir/constant_folding: Fix
> source bit size logic"), which is a candidate for 18.2 stable.

This patch is actually completely wrong. It just replaces one mistake with 
another.  The patch I sent and which "requires" this patch actually 
completely replaces it. I think the right thing to do on 18.2 is to apply 
both but squash them together so that only my later patch remains.

--Jason

>
> If you do prefer to keep this patch out of 18.2 stable (and thus, also
> 3595a0abf43), then let me know.
>
> Thanks in advance
>
>
> J.A.
>
>> src/compiler/nir/nir_opt_constant_folding.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/src/compiler/nir/nir_opt_constant_folding.c 
>> b/src/compiler/nir/nir_opt_constant_folding.c
>> index e5ec5e9583f..c91e7e16855 100644
>> --- a/src/compiler/nir/nir_opt_constant_folding.c
>> +++ b/src/compiler/nir/nir_opt_constant_folding.c
>> @@ -63,10 +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_alu_type_get_type_size(nir_op_infos[instr->op].input_sizes[i])) {
>> +      if (bit_size == 0 && nir_op_infos[instr->op].input_sizes[i] == 0)
>>  bit_size = instr->src[i].src.ssa->bit_size;
>> -      }
>>
>> nir_instr *src_instr = instr->src[i].src.ssa->parent_instr;
>
> _______________________________________________
> 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