mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
* Updated the cost matrix normalization proceedure to better handle infinite costs.
* Enabled R1/R2 application for nodes with infinite spill costs in the Briggs heuristic (made safe by the changes to the normalization proceedure). * Removed a redundant header. llvm-svn: 95973
This commit is contained in:
parent
dc2bb77b1b
commit
46f6d32509
@ -18,7 +18,6 @@
|
||||
|
||||
#include "Graph.h"
|
||||
#include "Solution.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
|
||||
@ -494,14 +493,23 @@ namespace PBQP {
|
||||
|
||||
bool tryNormaliseEdgeMatrix(Graph::EdgeItr &eItr) {
|
||||
|
||||
const PBQPNum infinity = std::numeric_limits<PBQPNum>::infinity();
|
||||
|
||||
Matrix &edgeCosts = g.getEdgeCosts(eItr);
|
||||
Vector &uCosts = g.getNodeCosts(g.getEdgeNode1(eItr)),
|
||||
&vCosts = g.getNodeCosts(g.getEdgeNode2(eItr));
|
||||
|
||||
for (unsigned r = 0; r < edgeCosts.getRows(); ++r) {
|
||||
PBQPNum rowMin = edgeCosts.getRowMin(r);
|
||||
PBQPNum rowMin = infinity;
|
||||
|
||||
for (unsigned c = 0; c < edgeCosts.getCols(); ++c) {
|
||||
if (vCosts[c] != infinity && edgeCosts[r][c] < rowMin)
|
||||
rowMin = edgeCosts[r][c];
|
||||
}
|
||||
|
||||
uCosts[r] += rowMin;
|
||||
if (rowMin != std::numeric_limits<PBQPNum>::infinity()) {
|
||||
|
||||
if (rowMin != infinity) {
|
||||
edgeCosts.subFromRow(r, rowMin);
|
||||
}
|
||||
else {
|
||||
@ -510,9 +518,16 @@ namespace PBQP {
|
||||
}
|
||||
|
||||
for (unsigned c = 0; c < edgeCosts.getCols(); ++c) {
|
||||
PBQPNum colMin = edgeCosts.getColMin(c);
|
||||
PBQPNum colMin = infinity;
|
||||
|
||||
for (unsigned r = 0; r < edgeCosts.getRows(); ++r) {
|
||||
if (uCosts[r] != infinity && edgeCosts[r][c] < colMin)
|
||||
colMin = edgeCosts[r][c];
|
||||
}
|
||||
|
||||
vCosts[c] += colMin;
|
||||
if (colMin != std::numeric_limits<PBQPNum>::infinity()) {
|
||||
|
||||
if (colMin != infinity) {
|
||||
edgeCosts.subFromCol(c, colMin);
|
||||
}
|
||||
else {
|
||||
|
@ -128,14 +128,7 @@ namespace PBQP {
|
||||
/// selected for heuristic reduction instead.
|
||||
bool shouldOptimallyReduce(Graph::NodeItr nItr) {
|
||||
if (getSolver().getSolverDegree(nItr) < 3) {
|
||||
if (getGraph().getNodeCosts(nItr)[0] !=
|
||||
std::numeric_limits<PBQPNum>::infinity()) {
|
||||
return true;
|
||||
}
|
||||
// Otherwise we have an infinite spill cost node.
|
||||
initializeNode(nItr);
|
||||
NodeData &nd = getHeuristicNodeData(nItr);
|
||||
return nd.isAllocable;
|
||||
return true;
|
||||
}
|
||||
// else
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user