Skip to content

Commit 9454535

Browse files
pratikasharigcbot
authored andcommitted
Fix bug where reRA pass obliterated gtpin data
structure fields. Restore next free scratch slot field of gtpin info which was clobbered by reRA pass.
1 parent 7e3c199 commit 9454535

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

visa/G4_Kernel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,11 @@ void gtPinData::setScratchNextFree(unsigned next) {
522522
nextScratchFree = ((next + kernel.numEltPerGRF<Type_UB>() - 1) / kernel.numEltPerGRF<Type_UB>()) * kernel.numEltPerGRF<Type_UB>();
523523
}
524524

525+
unsigned int gtPinData::getScratchNextFree() const
526+
{
527+
return nextScratchFree;
528+
}
529+
525530
uint32_t gtPinData::getNumBytesScratchUse() const
526531
{
527532
if (gtpin_init)

visa/G4_Kernel.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class gtPinData
106106
void* getGTPinInfoBuffer(unsigned &bufferSize);
107107

108108
void setScratchNextFree(unsigned next);
109+
unsigned int getScratchNextFree() const;
109110

110111
uint32_t getNumBytesScratchUse() const;
111112

visa/Optimizer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,7 @@ void Optimizer::reRAPostSchedule()
18701870
if (builder.getIsPayload())
18711871
return;
18721872
auto freeGRFsBeforeReRA = gtpin->getNumFreeGlobalRegs();
1873+
auto nextScratchFreeBeforeReRA = gtpin->getScratchNextFree();
18731874

18741875
storeGRFAssignments(kernel.Declares, assignments);
18751876
// This pass is run for gtpin since they need re-allocation after
@@ -1944,6 +1945,7 @@ void Optimizer::reRAPostSchedule()
19441945
computeGlobalFreeGRFs(kernel);
19451946
}
19461947

1948+
gtpin->setScratchNextFree(nextScratchFreeBeforeReRA);
19471949
*builder.getJitInfo() = finalizerInfo;
19481950
}
19491951

0 commit comments

Comments
 (0)