[Mesa-dev] [PATCH 2/5] ra: Delete the conflict lists in ra_set_finalize

Jason Ekstrand jason at jlekstrand.net
Fri Jul 31 10:05:28 PDT 2015


I'm not 100% sure that this is the right patch.  Instead of baking 256 into
the allocator, we could allow the user to pass in an initial constant.
Since the maximum is statically known, we could also make said constant a
hard limit and allocate everything up-front in a single array and save all
the allocations.

---------->8-----------------

Subject: [PATCH 3/5] ra: Allocate bigger initial conflict lists

We allocate register sets three times: Once for SIMD4x2, SIMD8, and SIMD16.
On broadwell, hacking up the register allocate code yields:

   Average umber of conflicts: 241.892120 (16 min, 376 max)
   846 over 256, 86 under 128, 1928 total
   Average umber of conflicts: 241.892120 (16 min, 376 max)
   846 over 256, 86 under 128, 1928 total
   Average umber of conflicts: 239.732056 (16 min, 376 max)
   718 over 256, 86 under 128, 1672 total

where the first two are for SIMD8/16 and the last is for SIMD4x2.  On
IronLake, however, the numbers are a bit different for FS:

   Average umber of conflicts: 30.161085 (5 min, 53 max)
   Average umber of conflicts: 14.596154 (2 min, 25 max)
   Average umber of conflicts: 241.892120 (16 min, 376 max)

This is because we don't support send-from-GRF on ILK and so we don't need
as much wiggle-room in the allocator.  That said, once we add support
indirect addressing in the FS backend, these numbers will jump back to
the level we have for BDW.

According to callgrind, this takes the number of reralloc_size calls during
screen creation from 35,343 to 2,467 on BDW on a glxgears run.

Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Eric Anholt <eric at anholt.net>
Cc: Matt Turner <mattst88 at gmail.com>
Cc: Kenneth Graunke <kenneth at whitecape.org>

---
 src/util/register_allocate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c
index 436e008..570e13f 100644
--- a/src/util/register_allocate.c
+++ b/src/util/register_allocate.c
@@ -197,8 +197,8 @@ ra_alloc_reg_set(void *mem_ctx, unsigned int count)
                                               BITSET_WORDS(count));
       BITSET_SET(regs->regs[i].conflicts, i);
 
-      regs->regs[i].conflict_list = ralloc_array(regs->regs, unsigned int, 4);
-      regs->regs[i].conflict_list_size = 4;
+      regs->regs[i].conflict_list = ralloc_array(regs->regs, unsigned int, 256);
+      regs->regs[i].conflict_list_size = 256;
       regs->regs[i].conflict_list[0] = i;
       regs->regs[i].num_conflicts = 1;
    }
-- 
2.4.3



More information about the mesa-dev mailing list