[Beignet] [PATCH 2/2] GBE: don't put a long live register to a selection vector.
Zhigang Gong
zhigang.gong at intel.com
Thu Feb 20 18:53:24 PST 2014
If an element has very long interval, we don't want to put it into a
vector as it will add more pressure to the register allocation.
With this patch, it can reduce more than 20% spill registers for luxmark's
median scene benchmark(from 288 to 224).
Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
backend/src/backend/gen_reg_allocation.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/backend/src/backend/gen_reg_allocation.cpp b/backend/src/backend/gen_reg_allocation.cpp
index 4e276c3..c282b36 100644
--- a/backend/src/backend/gen_reg_allocation.cpp
+++ b/backend/src/backend/gen_reg_allocation.cpp
@@ -271,9 +271,12 @@ namespace gbe
// case 1: the register is not already in a vector, so it can stay in this
// vector. Note that local IDs are *non-scalar* special registers but will
// require a MOV anyway since pre-allocated in the CURBE
+ // If an element has very long interval, we don't want to put it into a
+ // vector as it will add more pressure to the register allocation.
if (it == vectorMap.end() &&
ctx.sel->isScalarOrBool(reg) == false &&
- ctx.isSpecialReg(reg) == false)
+ ctx.isSpecialReg(reg) == false &&
+ (intervals[reg].maxID - intervals[reg].minID) < 2048)
{
const VectorLocation location = std::make_pair(vector, regID);
this->vectorMap.insert(std::make_pair(reg, location));
--
1.8.3.2
More information about the Beignet
mailing list