Skip to content

intel/brw: Reduce allocations for fs_inst sources

Caio Oliveira requested to merge cmarcelo/mesa:intel-brw-resize-sources into main

Embed a small array of 4 fs_regs in fs_inst, instead of always performing a separate allocation. It will also avoid allocating a new array in fs_reg::resize_sources if the existing one is larger than the new size.

This MR includes two preparation patches:

  • One from Ken to re-arrange the fs_inst fields to pack it better;
  • Another to remove unused asserts that were looking at a source that was not present.

Results from compilation times in Fossil DB on my TGL machine:

// Assassin's Creed Odyssey
+------------------------------------------------------------+
|  +                                                         |
|+ +  +                                              x x  x  |
|+ +  +                                              x x  x x|
|                                                    |_MA__| |
||_A_|                                                       |
+------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x   7         16.22         16.25         16.23     16.232857   0.011126973
+   7         16.01         16.03         16.02         16.02  0.0081649658
Difference at 95.0% confidence
        -0.212857 +/- 0.0113665
        -1.31127% +/- 0.0700219%
        (Student's t, pooled s = 0.009759)

// Total War Warhammer 3
+------------------------------------------------------------+
|   +                                                        |
|   ++                                               x x     |
|  ++++                                             xx x     |
|  +++++              +                             xxxxxxx x|
|                                                    |_A_|   |
||___MA____|                                                 |
+------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x  13        107.72        107.99        107.82     107.81769   0.075955453
+  13        106.07        106.69        106.13     106.15923    0.16408644
Difference at 95.0% confidence
        -1.65846 +/- 0.103507
        -1.53821% +/- 0.0960018%
        (Student's t, pooled s = 0.127855)

// Borderlands 3
+------------------------------------------------------------+
|  +                                                   x     |
|  +                                                   x     |
|  +                                                   x     |
|+ +    + +                                          x x  x x|
|                                                     |MA_|  |
||_M_A__|                                                    |
+------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x   7          9.43          9.46          9.44     9.4428571  0.0095118973
+   7           9.2          9.24          9.21     9.2157143   0.013972763
Difference at 95.0% confidence
        -0.227143 +/- 0.0139211
        -2.40545% +/- 0.147425%
        (Student's t, pooled s = 0.0119523)

// Rise of the Tomb Raider
+------------------------------------------------------------+
| +                                                          |
| +                                                          |
| +                                                        x |
| +                                                        x |
| +                                                       xx |
|++                                                       xxx|
|                                                         |A||
||A|                                                         |
+------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x   7         29.99         30.02         30.01     30.004286   0.011338934
+   7         29.23         29.25         29.25     29.244286  0.0078679579
Difference at 95.0% confidence
        -0.76 +/- 0.0113665
        -2.53297% +/- 0.0378831%
        (Student's t, pooled s = 0.009759)

Merge request reports