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

Song, Ruiling ruiling.song at intel.com
Mon Dec 30 21:21:45 PST 2013


This patch LGTM.

-----Original Message-----
From: beignet-bounces at lists.freedesktop.org [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Zhigang Gong
Sent: Monday, December 30, 2013 7:07 PM
To: beignet at lists.freedesktop.org
Cc: Gong, Zhigang
Subject: [Beignet] [PATCH 2/4] GBE: refine the register expiring handling.

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

_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list