Skip to content

Commit e09f596

Browse files
committed
Remove assert and std::min
It's actually possible to hit the assert on a valid IR if both amdgpu-num-sgprs and amdgpu-num-vgprs are defined and have very low values. It's also unnecessary to take the minimum between the spilling and increase occupancy targets, which will be necessarily higher and therefore automatically satisfied even when these attributes are defined.
1 parent 5bf0b78 commit e09f596

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,19 +1716,14 @@ bool PreRARematStage::canIncreaseOccupancyOrReduceSpill() {
17161716
TargetOcc = std::nullopt;
17171717
} else {
17181718
// There is no spilling and room to improve occupancy; set up "increased
1719-
// occupancy targets" for all regions. We further restrict the SGPR/VGPR
1720-
// limits for increasing occupancy by the "spilling limits" since the latter
1721-
// may end up smaller due to "amdgpu-num-sgpr" / "amdgpu-num-vgpr"
1722-
// attributes.
1719+
// occupancy targets" for all regions.
17231720
TargetOcc = DAG.MinOccupancy + 1;
17241721
unsigned VGPRBlockSize =
17251722
MF.getInfo<SIMachineFunctionInfo>()->getDynamicVGPRBlockSize();
1726-
MaxSGPRs = std::min(MaxSGPRs, ST.getMaxNumSGPRs(*TargetOcc, false));
1727-
MaxVGPRs = std::min(MaxVGPRs, ST.getMaxNumVGPRs(*TargetOcc, VGPRBlockSize));
1723+
MaxSGPRs = ST.getMaxNumSGPRs(*TargetOcc, false);
1724+
MaxVGPRs = ST.getMaxNumVGPRs(*TargetOcc, VGPRBlockSize);
17281725
ResetTargetRegions();
1729-
assert(!OptRegions.empty() && "there should be at least one target region");
17301726
}
1731-
17321727
REMAT_DEBUG({
17331728
dbgs() << "Analyzing ";
17341729
MF.getFunction().printAsOperand(dbgs(), false);

0 commit comments

Comments
 (0)