[Mesa-dev] [PATCH 11/14] i965/compaction: Add support for G45.

Matt Turner mattst88 at gmail.com
Wed Sep 24 11:09:30 PDT 2014


On Wed, Sep 24, 2014 at 10:43 AM, Ian Romanick <idr at freedesktop.org> wrote:
> On 08/28/2014 08:10 PM, Matt Turner wrote:
>> ---
>>  src/mesa/drivers/dri/i965/brw_eu_compact.c | 39 ++++++++++++++++++------------
>>  1 file changed, 24 insertions(+), 15 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_eu_compact.c b/src/mesa/drivers/dri/i965/brw_eu_compact.c
>> index 5008ba6..9c23d55 100644
>> --- a/src/mesa/drivers/dri/i965/brw_eu_compact.c
>> +++ b/src/mesa/drivers/dri/i965/brw_eu_compact.c
>> @@ -23,12 +23,12 @@
>>
>>  /** @file brw_eu_compact.c
>>   *
>> - * Instruction compaction is a feature of gm45 and newer hardware that allows
>> + * Instruction compaction is a feature of G45 and newer hardware that allows
>>   * for a smaller instruction encoding.
>>   *
>>   * The instruction cache is on the order of 32KB, and many programs generate
>>   * far more instructions than that.  The instruction cache is built to barely
>> - * keep up with instruction dispatch abaility in cache hit cases -- L1
>> + * keep up with instruction dispatch ability in cache hit cases -- L1
>>   * instruction cache misses that still hit in the next level could limit
>>   * throughput by around 50%.
>>   *
>> @@ -1207,14 +1207,15 @@ static void
>>  update_gen4_jump_count(struct brw_context *brw, brw_inst *insn,
>>                         int this_old_ip, int *compacted_counts)
>>  {
>> -   assert(brw->gen == 5);
>> +   assert(brw->gen == 5 || brw->is_g4x);
>>
>>     /* Jump Count is in units of:
>> +    *    - uncompacted instructions on G45; and
>>      *    - compacted instructions on Gen5.
>>      */
>>     int jump_count = brw_inst_gen4_jump_count(brw, insn);
>> -   int jump_count_compacted = jump_count;
>> -   int jump_count_uncompacted = jump_count / 2;
>> +   int jump_count_compacted = jump_count * (brw->is_g4x ? 2 : 1);
>> +   int jump_count_uncompacted = jump_count / (brw->is_g4x ? 1 : 2);
>>
>>     int target_old_ip = this_old_ip + jump_count_uncompacted;
>>
>> @@ -1222,7 +1223,8 @@ update_gen4_jump_count(struct brw_context *brw, brw_inst *insn,
>>     int target_compacted_count = compacted_counts[target_old_ip];
>>
>>     jump_count_compacted -= (target_compacted_count - this_compacted_count);
>> -   brw_inst_set_gen4_jump_count(brw, insn, jump_count_compacted);
>> +   brw_inst_set_gen4_jump_count(brw, insn, jump_count_compacted /
>> +                                           (brw->is_g4x ? 2 : 1));
>>  }
>>
>>  void
>> @@ -1265,13 +1267,14 @@ brw_init_compaction_tables(struct brw_context *brw)
>>        src_index_table = gen6_src_index_table;
>>        break;
>>     case 5:
>> +   case 4:
>>        control_index_table = g45_control_index_table;
>>        datatype_table = g45_datatype_table;
>>        subreg_table = g45_subreg_table;
>>        src_index_table = g45_src_index_table;
>>        break;
>
> The check a couple hunks below prevents us from getting here on GEN4?

Right, there's no instruction compaction on the original 965. No harm
in setting the table pointers on it though.


More information about the mesa-dev mailing list