@@ -151,14 +151,14 @@ enum RegisterMapping {
151151 SQ_MAX_PGM_VGPRS = 1024 , // Maximum programmable VGPRs across all targets.
152152 AGPR_OFFSET = 512 , // Maximum programmable ArchVGPRs across all targets.
153153 SQ_MAX_PGM_SGPRS = 128 , // Maximum programmable SGPRs across all targets.
154- NUM_EXTRA_VGPRS = 9 , // Reserved slots for DS.
155154 // Artificial register slots to track LDS writes into specific LDS locations
156155 // if a location is known. When slots are exhausted or location is
157156 // unknown use the first slot. The first slot is also always updated in
158157 // addition to known location's slot to properly generate waits if dependent
159158 // instruction's location is unknown.
160- EXTRA_VGPR_LDS = 0 ,
161- NUM_ALL_VGPRS = SQ_MAX_PGM_VGPRS + NUM_EXTRA_VGPRS, // Where SGPR starts.
159+ FIRST_LDS_VGPR = SQ_MAX_PGM_VGPRS, // Extra slots for LDS stores.
160+ NUM_LDS_VGPRS = 9 , // One more than the stores we track.
161+ NUM_ALL_VGPRS = SQ_MAX_PGM_VGPRS + NUM_LDS_VGPRS, // Where SGPRs start.
162162};
163163
164164// Enumerate different types of result-returning VMEM operations. Although
@@ -488,7 +488,7 @@ class WaitcntBrackets {
488488 unsigned char VgprVmemTypes[NUM_ALL_VGPRS] = {0 };
489489 // Store representative LDS DMA operations. The only useful info here is
490490 // alias info. One store is kept per unique AAInfo.
491- SmallVector<const MachineInstr *, NUM_EXTRA_VGPRS - 1 > LDSDMAStores;
491+ SmallVector<const MachineInstr *, NUM_LDS_VGPRS - 1 > LDSDMAStores;
492492};
493493
494494// This abstracts the logic for generating and updating S_WAIT* instructions
@@ -1062,15 +1062,15 @@ void WaitcntBrackets::updateByEvent(const SIInstrInfo *TII,
10621062 }
10631063 }
10641064 }
1065- if (Slot || LDSDMAStores.size () == NUM_EXTRA_VGPRS - 1 )
1065+ if (Slot || LDSDMAStores.size () == NUM_LDS_VGPRS - 1 )
10661066 break ;
10671067 LDSDMAStores.push_back (&Inst);
10681068 Slot = LDSDMAStores.size ();
10691069 break ;
10701070 }
1071- setRegScore (SQ_MAX_PGM_VGPRS + EXTRA_VGPR_LDS + Slot, T, CurrScore);
1071+ setRegScore (FIRST_LDS_VGPR + Slot, T, CurrScore);
10721072 if (Slot)
1073- setRegScore (SQ_MAX_PGM_VGPRS + EXTRA_VGPR_LDS , T, CurrScore);
1073+ setRegScore (FIRST_LDS_VGPR , T, CurrScore);
10741074 }
10751075 }
10761076}
@@ -1122,7 +1122,7 @@ void WaitcntBrackets::print(raw_ostream &OS) const {
11221122 if (RegScore <= LB)
11231123 continue ;
11241124 unsigned RelScore = RegScore - LB - 1 ;
1125- if (J < SQ_MAX_PGM_VGPRS + EXTRA_VGPR_LDS ) {
1125+ if (J < FIRST_LDS_VGPR ) {
11261126 OS << RelScore << " :v" << J << " " ;
11271127 } else {
11281128 OS << RelScore << " :ds " ;
@@ -1914,7 +1914,7 @@ bool SIInsertWaitcnts::generateWaitcntInstBefore(MachineInstr &MI,
19141914 continue ;
19151915
19161916 // LOAD_CNT is only relevant to vgpr or LDS.
1917- unsigned RegNo = SQ_MAX_PGM_VGPRS + EXTRA_VGPR_LDS ;
1917+ unsigned RegNo = FIRST_LDS_VGPR ;
19181918 // Only objects with alias scope info were added to LDSDMAScopes array.
19191919 // In the absense of the scope info we will not be able to disambiguate
19201920 // aliasing here. There is no need to try searching for a corresponding
0 commit comments