Skip to content

Commit d6c0839

Browse files
authored
[AMDGPU] Reduce size of SGPR arrays in SIInsertWaitcnts. NFC. (#130097)
1 parent 4e6721b commit d6c0839

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ enum WaitEventType {
132132
enum RegisterMapping {
133133
SQ_MAX_PGM_VGPRS = 512, // Maximum programmable VGPRs across all targets.
134134
AGPR_OFFSET = 256, // Maximum programmable ArchVGPRs across all targets.
135-
SQ_MAX_PGM_SGPRS = 256, // Maximum programmable SGPRs across all targets.
135+
SQ_MAX_PGM_SGPRS = 128, // Maximum programmable SGPRs across all targets.
136136
NUM_EXTRA_VGPRS = 9, // Reserved slots for DS.
137137
// Artificial register slots to track LDS writes into specific LDS locations
138138
// if a location is known. When slots are exhausted or location is
@@ -757,14 +757,13 @@ RegInterval WaitcntBrackets::getRegInterval(const MachineInstr *MI,
757757
if (TRI->isAGPR(*MRI, Op.getReg()))
758758
Result.first += AGPR_OFFSET;
759759
assert(Result.first >= 0 && Result.first < SQ_MAX_PGM_VGPRS);
760-
} else if (TRI->isSGPRReg(*MRI, Op.getReg())) {
761-
assert(Reg < SQ_MAX_PGM_SGPRS);
760+
} else if (TRI->isSGPRReg(*MRI, Op.getReg()) && Reg < SQ_MAX_PGM_SGPRS) {
761+
// SGPRs including VCC, TTMPs and EXEC but excluding read-only scalar
762+
// sources like SRC_PRIVATE_BASE.
762763
Result.first = Reg + NUM_ALL_VGPRS;
763-
}
764-
// TODO: Handle TTMP
765-
// else if (TRI->isTTMP(*MRI, Reg.getReg())) ...
766-
else
764+
} else {
767765
return {-1, -1};
766+
}
768767

769768
const TargetRegisterClass *RC = TRI->getPhysRegBaseClass(Op.getReg());
770769
unsigned Size = TRI->getRegSizeInBits(*RC);

0 commit comments

Comments
 (0)