[Mesa-dev] [PATCH] i965/vec4: dead_code_eliminate: update writemask on null_regs based on flag_live

Alejandro Piñeiro apinheiro at igalia.com
Thu Oct 15 08:15:11 PDT 2015



On 15/10/15 14:38, Francisco Jerez wrote:
> Alejandro Piñeiro <apinheiro at igalia.com> writes:
>
>> ---
>>
>> This patch implements the idea proposed by Francisco Jerez. With this
>> change, even adding the new condition pointed by Matt Turner on the
>> "2/5 i965/vec4: adding vec4_cmod_propagation optimization", the shader-db
>> numbers remain the same. So this patch would go before the optimization
>> (so in this series it would be the patch 1.5).
>>
>> Note: Im not resending the patch 2/5, as Matt pointed that he granted
>> the reviewed status with his suggested change. I can send it if needed
>> in any case.
>>
>>  .../drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp    | 16 +++++++++++-----
>>  1 file changed, 11 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
>> index 8fc7a36..31ea128 100644
>> --- a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
>> @@ -78,13 +78,19 @@ vec4_visitor::dead_code_eliminate()
>>               sizeof(BITSET_WORD));
>>  
>>        foreach_inst_in_block_reverse(vec4_instruction, inst, block) {
>> -         if (inst->dst.file == GRF && !inst->has_side_effects()) {
>> +         if ((inst->dst.file == GRF && !inst->has_side_effects()) ||
>> +             (inst->dst.is_null() && inst->writes_flag())){
>>              bool result_live[4] = { false };
>>  
>> -            for (unsigned i = 0; i < inst->regs_written; i++) {
>> -               for (int c = 0; c < 4; c++)
>> -                  result_live[c] |= BITSET_TEST(
>> -                     live, var_from_reg(alloc, offset(inst->dst, i), c));
>> +            if (inst->dst.file == GRF) {
>> +               for (unsigned i = 0; i < inst->regs_written; i++) {
>> +                  for (int c = 0; c < 4; c++)
>> +                     result_live[c] |= BITSET_TEST(
>> +                        live, var_from_reg(alloc, offset(inst->dst, i), c));
>> +               }
>> +            } else {
>> +               for (unsigned c = 0; c < 4; c++)
>> +                  result_live[c] |= BITSET_TEST(flag_live, c);
> Sadly flag liveness is not kept track of per component -- I.e. the
> flag_live bit-set and the flag live-out bitset calculated by liveness
> analysis have only one bit representing the union of all components.
> This won't work unless you fix that too.

Ok, I assumed that was tracking per component as I didn't detect any
piglit regression after this change. But after all, I also didn't detect
any piglit regression with vec4_cmod_propagation even without Matt last
suggestion.

I will work on adding component information on flag liveness (or at
least try to add it).

BR

-- 
Alejandro Piñeiro (apinheiro at igalia.com)



More information about the mesa-dev mailing list