[Beignet] [PATCH 1/2] GBE: bypass the expiring when the physical offset is still used for other registers.
Lu Guanqun
guanqun.lu at intel.com
Sun Nov 3 21:29:56 PST 2013
Signed-off-by: Lu Guanqun <guanqun.lu at intel.com>
---
backend/src/backend/gen_reg_allocation.cpp | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/backend/src/backend/gen_reg_allocation.cpp b/backend/src/backend/gen_reg_allocation.cpp
index 30f9e38..a52c46c 100644
--- a/backend/src/backend/gen_reg_allocation.cpp
+++ b/backend/src/backend/gen_reg_allocation.cpp
@@ -76,6 +76,8 @@ namespace gbe
bool createGenReg(const GenRegInterval &interval);
/*! Indicate if the registers are already allocated in vectors */
bool isAllocated(const SelectionVector *vector) const;
+ /*! Indicate if a virtual register is uniquely mapped to a physical register file */
+ bool isUniquelyMapped(const ir::Register reg) const;
/*! Reallocate registers if needed to make the registers in the vector
* contigous in memory
*/
@@ -209,6 +211,18 @@ namespace gbe
return true;
}
+ bool GenRegAllocator::Opaque::isUniquelyMapped(const ir::Register reg) const {
+ const auto it = RA.find(reg);
+ GBE_ASSERT(it != RA.end());
+
+ for (auto pair = RA.begin(); pair != RA.end(); ++pair) {
+ if (pair->first != reg && pair->second == it->second)
+ return false;
+ }
+
+ return true;
+ }
+
void GenRegAllocator::Opaque::coalesce(Selection &selection, SelectionVector *vector) {
for (uint32_t regID = 0; regID < vector->regNum; ++regID) {
const ir::Register reg = vector->reg[regID].reg();
@@ -307,6 +321,12 @@ namespace gbe
this->expiringID++;
continue;
}
+
+ if (!isUniquelyMapped(reg)) {
+ this->expiringID++;
+ continue;
+ }
+
// Case 1 - it does not belong to a vector. Just remove it
ctx.deallocate(it->second);
this->expiringID++;
More information about the Beignet
mailing list