[Beignet] [PATCH 2/4] GBE: refine the register expiring handling.

Zhigang Gong zhigang.gong at intel.com
Mon Dec 30 03:06:55 PST 2013


Previous implementation expires one register each time which
is not every efficient, now change to expire as much as possible
registers.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 backend/src/backend/gen_reg_allocation.cpp |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/backend/src/backend/gen_reg_allocation.cpp b/backend/src/backend/gen_reg_allocation.cpp
index d7362dd..2bb0d19 100644
--- a/backend/src/backend/gen_reg_allocation.cpp
+++ b/backend/src/backend/gen_reg_allocation.cpp
@@ -276,6 +276,7 @@ namespace gbe
   }
 
   bool GenRegAllocator::Opaque::expireGRF(const GenRegInterval &limit) {
+    bool ret = false;
     while (this->expiringID != ending.size()) {
       const GenRegInterval *toExpire = this->ending[this->expiringID];
       const ir::Register reg = toExpire->reg;
@@ -299,7 +300,7 @@ namespace gbe
       }
 
       if (toExpire->maxID >= limit.minID)
-        return false;
+        break;
       auto it = RA.find(reg);
       GBE_ASSERT(it != RA.end());
       // offset less than 32 means it is not managed by our reg allocator.
@@ -310,11 +311,11 @@ namespace gbe
       // Case 1 - it does not belong to a vector. Just remove it
         ctx.deallocate(it->second);
         this->expiringID++;
-        return true;
+        ret = true;
     }
 
     // We were not able to expire anything
-    return false;
+    return ret;
   }
 
   void GenRegAllocator::Opaque::allocateFlags(Selection &selection) {
-- 
1.7.9.5



More information about the Beignet mailing list