[Mesa-dev] [PATCH 4/5] i965/fs: Debug the optimization passes by dumping instr to file.

Matt Turner mattst88 at gmail.com
Sat May 31 17:46:07 PDT 2014


On Sat, May 31, 2014 at 5:33 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On Friday, May 30, 2014 07:35:22 PM Matt Turner wrote:
>> With INTEL_DEBUG=optimizer, write the output of dump_instructions() to a
>> file each time an optimization pass makes progress. This lets you easily
>> diff successive files to see what an optimization pass did.
>>
>> Example filenames written when running glxgears:
>>    fs8-00-00-start
>>    fs8-00-01-04-opt_copy_propagate
>>    fs8-00-01-06-dead_code_eliminate
>>    fs8-00-01-12-compute_to_mrf
>>    fs8-00-02-06-dead_code_eliminate
>>        |   |  |   |
>>        |   |  |   `-- optimization pass name
>>        |   |  |
>>        |   |  `-- optimization pass number in the loop
>>        |   |
>>        |   `-- optimization loop interation
>>        |
>>        `-- shader program number
>>
>> Note that with INTEL_DEBUG=optimizer, we disable compact_virtual_grfs,
>> so that we can diff instruction lists across loop interations without
>> the register numbers being changes.
>> ---
>>  src/mesa/drivers/dri/i965/brw_fs.cpp | 53 ++++++++++++++++++++++++++++--------
>>  1 file changed, 41 insertions(+), 12 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> index c9b31fe..0d56ac7 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> @@ -1714,6 +1714,9 @@ fs_visitor::split_virtual_grfs()
>>  void
>>  fs_visitor::compact_virtual_grfs()
>>  {
>> +   if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER))
>> +      return;
>> +
>>     /* Mark which virtual GRFs are used, and count how many. */
>>     int remap_table[this->virtual_grf_count];
>>     memset(remap_table, -1, sizeof(remap_table));
>> @@ -3020,24 +3023,50 @@ fs_visitor::run()
>>
>>        opt_drop_redundant_mov_to_flags();
>>
>> +#define OPT(pass, args...) do {                                            \
>> +      pass_num++;                                                          \
>> +      bool this_progress = pass(args);                                     \
>> +                                                                           \
>> +      if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER) && this_progress) {      \
>> +         char filename[64];                                                \
>> +         snprintf(filename, 64, "fs%d-%02d-%02d-%02d-" #pass,              \
>
> One thought...could we widen the shader number to:
> "fs%d-%04d-%02d-%02-d"
> Some programs have a lot of shaders (though admittedly you're probably not
> using INTEL_DEBUG=optimizer on a whole game).
>
> Either way's fine.

Sure thing. That's not a bad idea.


More information about the mesa-dev mailing list