@@ -49,7 +49,6 @@ using namespace vISA;
4949
5050#define MIN (x,y ) (((x)<(y))? (x):(y))
5151#define MAX (x,y ) (((x)<(y))? (y):(x))
52- #define ROUND (x,y ) ((x) + ((y - x % y) % y))
5352
5453unsigned int BitMask[BITS_DWORD] =
5554{
@@ -6607,15 +6606,15 @@ G4_Imm* GlobalRA::createMsgDesc(unsigned owordSize, bool writeType, bool isSplit
66076606 unsigned messageLength = 1 ;
66086607 if (!isSplitSend)
66096608 {
6610- messageLength += ROUND (owordSize, 2 ) / 2 ;
6609+ messageLength += owordToGRFSize ( ROUND (owordSize, G4_GRF_REG_NBYTES/OWORD_BYTE_SIZE)) ;
66116610 }
66126611 message |= messageLength << SEND_MSG_LENGTH_BIT_OFFSET;
66136612 }
66146613 else
66156614 {
66166615 unsigned messageType = SEND_OWORD_READ_TYPE;
66176616 message |= messageType << SEND_MSG_TYPE_BIT_OFFSET;
6618- unsigned responseLength = ROUND (owordSize, 2 ) / 2 ;
6617+ unsigned responseLength = owordToGRFSize ( ROUND (owordSize, G4_GRF_REG_NBYTES / OWORD_BYTE_SIZE)) ;
66196618 message |= responseLength << SEND_RSP_LENGTH_BIT_OFFSET;
66206619 unsigned messageLength = 1 ;
66216620 message |= messageLength << SEND_MSG_LENGTH_BIT_OFFSET;
@@ -6668,23 +6667,23 @@ void GraphColor::saveRegs(
66686667 else if (owordSize > 8 )
66696668 {
66706669 saveRegs (startReg, 8 , scratchRegDcl, framePtr, frameOwordOffset, bb, insertIt);
6671- saveRegs (startReg + 4 , owordSize - 8 , scratchRegDcl, framePtr, frameOwordOffset + 8 , bb, insertIt);
6670+ saveRegs (startReg + GlobalRA::owordToGRFSize ( 8 ) , owordSize - 8 , scratchRegDcl, framePtr, frameOwordOffset + 8 , bb, insertIt);
66726671 }
66736672 //
66746673 // Split into chunks of sizes 4 and remaining owords.
66756674 //
66766675 else if (owordSize > 4 )
66776676 {
66786677 saveRegs (startReg, 4 , scratchRegDcl, framePtr, frameOwordOffset, bb, insertIt);
6679- saveRegs (startReg + 2 , owordSize - 4 , scratchRegDcl, framePtr, frameOwordOffset + 4 , bb, insertIt);
6678+ saveRegs (startReg + GlobalRA::owordToGRFSize ( 4 ) , owordSize - 4 , scratchRegDcl, framePtr, frameOwordOffset + 4 , bb, insertIt);
66806679 }
66816680 //
66826681 // Split into chunks of sizes 2 and remaining owords.
66836682 //
66846683 else if (owordSize > 2 )
66856684 {
66866685 saveRegs (startReg, 2 , scratchRegDcl, framePtr, frameOwordOffset, bb, insertIt);
6687- saveRegs (startReg + 1 , owordSize - 2 , scratchRegDcl, framePtr, frameOwordOffset + 2 , bb, insertIt);
6686+ saveRegs (startReg + GlobalRA::owordToGRFSize ( 2 ) , owordSize - 2 , scratchRegDcl, framePtr, frameOwordOffset + 2 , bb, insertIt);
66886687 }
66896688 else
66906689 {
@@ -6711,7 +6710,8 @@ void GraphColor::saveActiveRegs(
67116710 if (startPos < saveRegs.size () && saveRegs[startPos]) {
67126711 unsigned endPos = startPos + 1 ;
67136712 for (; endPos < saveRegs.size () && saveRegs[endPos] == true ; endPos++);
6714- unsigned owordSize = (endPos - startPos) * 2 ;
6713+ unsigned owordSize = (endPos - startPos) * GlobalRA::GRFSizeToOwords (1 );
6714+ owordSize = std::max (owordSize, GlobalRA::GRFSizeToOwords (1 ));
67156715 this ->saveRegs (startPos + startReg, owordSize, scratchRegDcl, framePtr, frameOwordPos, bb, insertIt);
67166716 frameOwordPos += owordSize;
67176717 startPos = endPos;
@@ -6751,23 +6751,23 @@ void GraphColor::restoreRegs(
67516751 else if (owordSize > 8 )
67526752 {
67536753 restoreRegs (startReg, 8 , scratchRegDcl, framePtr, frameOwordOffset, bb, insertIt);
6754- restoreRegs (startReg + 4 , owordSize - 8 , scratchRegDcl, framePtr, frameOwordOffset + 8 , bb, insertIt);
6754+ restoreRegs (startReg + GlobalRA::owordToGRFSize ( 8 ) , owordSize - 8 , scratchRegDcl, framePtr, frameOwordOffset + 8 , bb, insertIt);
67556755 }
67566756 //
67576757 // Split into chunks of sizes 4 and remaining owords.
67586758 //
67596759 else if (owordSize > 4 )
67606760 {
67616761 restoreRegs (startReg, 4 , scratchRegDcl, framePtr, frameOwordOffset, bb, insertIt);
6762- restoreRegs (startReg + 2 , owordSize - 4 , scratchRegDcl, framePtr, frameOwordOffset + 4 , bb, insertIt);
6762+ restoreRegs (startReg + GlobalRA::owordToGRFSize ( 4 ) , owordSize - 4 , scratchRegDcl, framePtr, frameOwordOffset + 4 , bb, insertIt);
67636763 }
67646764 //
67656765 // Split into chunks of sizes 2 and remaining owords.
67666766 //
67676767 else if (owordSize > 2 )
67686768 {
67696769 restoreRegs (startReg, 2 , scratchRegDcl, framePtr, frameOwordOffset, bb, insertIt);
6770- restoreRegs (startReg + 1 , owordSize - 2 , scratchRegDcl, framePtr, frameOwordOffset + 2 , bb, insertIt);
6770+ restoreRegs (startReg + GlobalRA::owordToGRFSize ( 2 ) , owordSize - 2 , scratchRegDcl, framePtr, frameOwordOffset + 2 , bb, insertIt);
67716771 }
67726772 else
67736773 {
@@ -6794,7 +6794,8 @@ void GraphColor::restoreActiveRegs(
67946794 if (startPos < restoreRegs.size () && restoreRegs[startPos]) {
67956795 unsigned endPos = startPos + 1 ;
67966796 for (; endPos < restoreRegs.size () && restoreRegs[endPos] == true ; endPos++);
6797- unsigned owordSize = (endPos - startPos) * 2 ;
6797+ unsigned owordSize = (endPos - startPos) * GlobalRA::GRFSizeToOwords (1 );
6798+ owordSize = std::max (owordSize, GlobalRA::GRFSizeToOwords (1 ));
67986799 this ->restoreRegs (startPos + startReg, owordSize, scratchRegDcl, framePtr, frameOwordPos, bb, insertIt);
67996800 frameOwordPos += owordSize;
68006801 startPos = endPos;
0 commit comments