Lines Matching +full:pressure +full:- +full:max

1 //===- GCNRegPressure.cpp -------------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
20 #define DEBUG_TYPE "machine-scheduler"
29 if (I == S2.end() || I->second != P.second) in isEqual()
43 return STI->isSGPRClass(RC) in getRegKind()
44 ? (STI->getRegSizeInBits(*RC) == 32 ? SGPR32 : SGPR_TUPLE) in getRegKind()
45 : STI->isAGPRClass(RC) in getRegKind()
46 ? (STI->getRegSizeInBits(*RC) == 32 ? AGPR32 : AGPR_TUPLE) in getRegKind()
47 : (STI->getRegSizeInBits(*RC) == 32 ? VGPR32 : VGPR_TUPLE); in getRegKind()
61 Sign = -1; in inc()
83 Sign * TRI->getRegClassWeight(MRI.getRegClass(Reg)).RegWeight; in inc()
116 // SGPR excess pressure conditions in less()
117 unsigned ExcessSGPR = std::max(static_cast<int>(getSGPRNum() - MaxSGPRs), 0); in less()
119 std::max(static_cast<int>(O.getSGPRNum() - MaxSGPRs), 0); in less()
123 unsigned VGPRForSGPRSpills = (ExcessSGPR + (WaveSize - 1)) / WaveSize; in less()
125 (OtherExcessSGPR + (WaveSize - 1)) / WaveSize; in less()
129 // Unified excess pressure conditions, accounting for VGPRs used for SGPR in less()
132 std::max(static_cast<int>(getVGPRNum(ST.hasGFX90AInsts()) + in less()
133 VGPRForSGPRSpills - MaxVGPRs), in less()
136 std::max(static_cast<int>(O.getVGPRNum(ST.hasGFX90AInsts()) + in less()
137 OtherVGPRForSGPRSpills - MaxVGPRs), in less()
139 // Arch VGPR excess pressure conditions, accounting for VGPRs used for SGPR in less()
141 unsigned ExcessArchVGPR = std::max( in less()
142 static_cast<int>(getVGPRNum(false) + VGPRForSGPRSpills - MaxArchVGPRs), in less()
145 std::max(static_cast<int>(O.getVGPRNum(false) + OtherVGPRForSGPRSpills - in less()
148 // AGPR excess pressure conditions in less()
149 unsigned ExcessAGPR = std::max( in less()
150 static_cast<int>(ST.hasGFX90AInsts() ? (getAGPRNum() - MaxArchVGPRs) in less()
151 : (getAGPRNum() - MaxVGPRs)), in less()
153 unsigned OtherExcessAGPR = std::max( in less()
154 static_cast<int>(ST.hasGFX90AInsts() ? (O.getAGPRNum() - MaxArchVGPRs) in less()
155 : (O.getAGPRNum() - MaxVGPRs)), in less()
163 // pressure. in less()
165 // The difference in excess VGPR pressure, after including VGPRs used for in less()
167 int VGPRDiff = ((OtherExcessVGPR + OtherExcessArchVGPR + OtherExcessAGPR) - in less()
170 int SGPRDiff = OtherExcessSGPR - ExcessSGPR; in less()
176 std::max(static_cast<int>(getVGPRNum(ST.hasGFX90AInsts()) - MaxVGPRs), in less()
178 std::max(static_cast<int>(getVGPRNum(false) - MaxArchVGPRs), 0); in less()
180 std::max( in less()
181 static_cast<int>(O.getVGPRNum(ST.hasGFX90AInsts()) - MaxVGPRs), in less()
183 std::max(static_cast<int>(O.getVGPRNum(false) - MaxArchVGPRs), 0); in less()
186 // of the pressures has VGPR usage from SGPR spills, prefer the pressure in less()
190 // If both pressures have the same excess pressure before and after in less()
204 // Give third precedence to lower register tuple pressure. in less()
206 for (int I = 2; I > 0; --I, SGPRFirst = !SGPRFirst) { in less()
232 << ST->getOccupancyWithNumVGPRs(RP.getVGPRNum(ST->hasGFX90AInsts())) in print()
236 OS << "(O" << ST->getOccupancyWithNumSGPRs(RP.getSGPRNum()) << ')'; in print()
240 OS << " -> Occ: " << RP.getOccupancy(*ST); in print()
249 // We don't rely on read-undef flag because in case of tentative schedule in getDefRegMask()
254 MRI.getTargetRegisterInfo()->getSubRegIndexLaneMask(MO.getSubReg()); in getDefRegMask()
386 LaneBitmask &LiveMask = I->second; in recede()
394 // Update MaxPressure with defs pressure. in recede()
398 MaxPressure = max(DefPressure, MaxPressure); in recede()
410 // Update MaxPressure with uses plus early-clobber defs pressure. in recede()
411 MaxPressure = HasECDefs ? max(CurPressure + ECDefPressure, MaxPressure) in recede()
412 : max(CurPressure, MaxPressure); in recede()
422 MRI = &MI.getParent()->getParent()->getRegInfo(); in reset()
424 MBBEnd = MI.getParent()->end(); in reset()
438 assert(NextMI == MBBEnd || !NextMI->isDebugInstr()); in advanceBeforeNext()
447 for (auto &MO : LastTrackedMI->operands()) { in advanceBeforeNext()
464 auto PrevMask = It->second; in advanceBeforeNext()
465 It->second &= ~S.LaneMask; in advanceBeforeNext()
466 CurPressure.inc(MO.getReg(), PrevMask, It->second, *MRI); in advanceBeforeNext()
469 if (It != LiveRegs.end() && It->second.none()) in advanceBeforeNext()
475 CurPressure.inc(MO.getReg(), It->second, LaneBitmask::getNone(), *MRI); in advanceBeforeNext()
480 MaxPressure = max(MaxPressure, CurPressure); in advanceBeforeNext()
492 for (const auto &MO : LastTrackedMI->all_defs()) { in advanceToNext()
502 MaxPressure = max(MaxPressure, CurPressure); in advanceToNext()
535 } else if (I->second != P.second) { in reportMismatch()
537 << " masks doesn't match: LIS reported " << PrintLaneMask(I->second) in reportMismatch()
560 reportMismatch(LISLR, TrackedLR, MRI->getTargetRegisterInfo()); in isValid()
566 dbgs() << "GCNUpwardRPTracker error: Pressure sets different\nTracked: " in isValid()
580 if (It != LiveRegs.end() && It->second.any()) in print()
582 << PrintLaneMask(It->second); in print()
591 "amdgpu-print-rp-downward",
598 INITIALIZE_PASS(GCNRegPressurePrinter, "amdgpu-print-rp", "", true, true)
600 // Return lanemask of Reg's subregs that are live-through at [Begin, End] and
607 auto IsInOneSegment = [Begin, End](const LiveRange &LR) -> bool { in getRegLiveThroughMask()
609 return Segment && Segment->contains(End); in getRegLiveThroughMask()
638 OS << "---\nname: " << MF.getName() << "\nbody: |\n"; in runOnMachineFunction()
642 OS << format(PFX " %-5d", RP.getSGPRNum()) in runOnMachineFunction()
643 << format(" %-5d", RP.getVGPRNum(false)); in runOnMachineFunction()
655 // Register pressure before and at an instruction (in program order). in runOnMachineFunction()
666 SlotIndex MBBStartSlot = LIS.getSlotIndexes()->getMBBStartIdx(&MBB); in runOnMachineFunction()
667 SlotIndex MBBEndSlot = LIS.getSlotIndexes()->getMBBEndIdx(&MBB); in runOnMachineFunction()
708 OS << PFX " Live-in: " << llvm::print(LiveIn, MRI); in runOnMachineFunction()
717 RP[UseDownwardTracker ? I : (RP.size() - 1 - I)]; in runOnMachineFunction()
726 OS << PFX " Live-out:" << llvm::print(LiveOut, MRI); in runOnMachineFunction()
740 OS << PFX " Live-thr:" << llvm::print(LiveThrough, MRI); in runOnMachineFunction()