Skip to content

Commit c3656ff

Browse files
bcheng0127igcbot
authored andcommitted
Reduce the RA compilation time - rowSize
1 parent e384dfe commit c3656ff

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

visa/GraphColor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Interference::Interference(LivenessAnalysis* l, LiveRange**& lr, unsigned n, uns
107107
builder(*g.kernel.fg.builder), maxId(n), splitStartId(ns), splitNum(nm),
108108
liveAnalysis(l)
109109
{
110+
rowSize = maxId / BITS_DWORD + 1;
110111
}
111112

112113
inline bool Interference::varSplitCheckBeforeIntf(unsigned v1, unsigned v2)
@@ -1578,7 +1579,7 @@ bool Interference::interfereBetween(unsigned v1, unsigned v2) const
15781579
if (useDenseMatrix())
15791580
{
15801581
unsigned col = v2 / BITS_DWORD;
1581-
return (matrix[v1 * getRowSize() + col] & BitMask[v2 - col * BITS_DWORD]) ? true : false;
1582+
return (matrix[v1 * rowSize + col] & BitMask[v2 - col * BITS_DWORD]) ? true : false;
15821583
}
15831584
else
15841585
{
@@ -2538,9 +2539,9 @@ void Interference::generateSparseIntfGraph()
25382539
// Iterate over intf graph matrix
25392540
for (unsigned int row = 0; row < numVars; row++)
25402541
{
2541-
unsigned int rowOffset = row*getRowSize();
2542+
unsigned int rowOffset = row*rowSize;
25422543
unsigned int colStart = (row + 1) / BITS_DWORD;
2543-
for (unsigned int j = colStart; j < getRowSize(); j++)
2544+
for (unsigned int j = colStart; j < rowSize; j++)
25442545
{
25452546
unsigned int intfBlk = getInterferenceBlk(rowOffset + j);
25462547
if (intfBlk != 0)

visa/GraphColor.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ namespace vISA
362362
LiveRange**& lrs;
363363
IR_Builder& builder;
364364
unsigned maxId;
365+
unsigned rowSize;
365366
unsigned splitStartId;
366367
unsigned splitNum;
367368
unsigned int* matrix = nullptr;
@@ -413,7 +414,7 @@ namespace vISA
413414
{
414415
if (useDenseMatrix())
415416
{
416-
unsigned N = getRowSize() * maxId;
417+
unsigned N = rowSize * maxId;
417418
matrix = new uint32_t[N];
418419
memset(matrix, 0, N * sizeof(int));
419420
}
@@ -434,7 +435,7 @@ namespace vISA
434435
sparseIntf.clear();
435436
if (useDenseMatrix())
436437
{
437-
unsigned N = getRowSize() * maxId;
438+
unsigned N = rowSize * maxId;
438439
std::memset(matrix, 0, N * sizeof(int));
439440
}
440441
else
@@ -453,10 +454,6 @@ namespace vISA
453454
assert(useDenseMatrix() && "matrix is not initialized");
454455
return matrix != nullptr ? matrix[idx] : 0;
455456
}
456-
inline unsigned int getRowSize() const
457-
{
458-
return maxId / BITS_DWORD + 1;
459-
}
460457

461458
std::vector<unsigned int>& getSparseIntfForVar(unsigned int id) { return sparseIntf[id]; }
462459

@@ -467,7 +464,7 @@ namespace vISA
467464
if (useDenseMatrix())
468465
{
469466
unsigned col = v2 / BITS_DWORD;
470-
matrix[v1 * getRowSize() + col] |= BitMask[v2 - col * BITS_DWORD];
467+
matrix[v1 * rowSize + col] |= BitMask[v2 - col * BITS_DWORD];
471468
}
472469
else
473470
{
@@ -483,7 +480,7 @@ namespace vISA
483480
MUST_BE_TRUE(sparseIntf.size() == 0, "Updating intf graph matrix after populating sparse intf graph");
484481
#endif
485482

486-
matrix[v1 * getRowSize() + col] |= block;
483+
matrix[v1 * rowSize + col] |= block;
487484
}
488485
else
489486
{

0 commit comments

Comments
 (0)