[Mesa-dev] [PATCH 5/6] nir: Fix holes in nir_instr

Ian Romanick idr at freedesktop.org
Wed Nov 28 16:24:30 UTC 2018


On 11/28/2018 02:54 AM, Eero Tamminen wrote:
> Hi,
> 
> On 28.11.2018 2.38, Ian Romanick wrote:
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> Found using pahole.
> 
> While Pahole does static analysis for binaries, Valgrind has tool that
> can do also _run-time_ analysis of structures and other heap allocations
> utilization:
>     http://valgrind.org/docs/manual/dh-manual.html

That is interesting.  I did not know about that!  pahole has some
problems with Mesa.  At least the version in my (aging) distro crashes
on some of our C++ classes.

> With the structure members usage frequency information, one can move
> often used parts to same cache-lines and infrequently used parts
> together for more efficient cache utilization.  One may also find
> structure members that get never used in practice although there's
> code that refers them.
> 
> 
>     - Eero
> 
>> Changes in peak memory usage according to Valgrind massif:
>>
>> mean soft fp64 using uint64:   1,343,991,403 => 1,342,759,331
>> gfxbench5 aztec ruins high 11:    63,619,971 =>    63,555,571
>> deus ex mankind divided 148:      62,887,728 =>    62,845,304
>> deus ex mankind divided 2890:     72,399,750 =>    71,922,686
>> dirt showdown 676:                69,464,023 =>    69,238,607
>> dolphin ubershaders 210:          78,359,728 =>    77,822,072
>>
>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>> ---
>>   src/compiler/nir/nir.h | 10 +++++-----
>>   1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
>> index a292ec73e1e..74c700026ad 100644
>> --- a/src/compiler/nir/nir.h
>> +++ b/src/compiler/nir/nir.h
>> @@ -486,7 +486,7 @@ typedef struct nir_register {
>>   #define nir_foreach_register_safe(reg, reg_list) \
>>      foreach_list_typed_safe(nir_register, reg, node, reg_list)
>>   -typedef enum {
>> +typedef enum PACKED {
>>      nir_instr_type_alu,
>>      nir_instr_type_deref,
>>      nir_instr_type_call,
>> @@ -501,16 +501,16 @@ typedef enum {
>>     typedef struct nir_instr {
>>      struct exec_node node;
>> -   nir_instr_type type;
>>      struct nir_block *block;
>> -
>> -   /** generic instruction index. */
>> -   unsigned index;
>> +   nir_instr_type type;
>>        /* A temporary for optimization and analysis passes to use for
>> storing
>>       * flags.  For instance, DCE uses this to store the "dead/live"
>> info.
>>       */
>>      uint8_t pass_flags;
>> +
>> +   /** generic instruction index. */
>> +   unsigned index;
>>   } nir_instr;
>>     static inline nir_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