llvm.org GIT mirror
[MachineScheduler] checkResourceLimit boundary condition update When we call checkResourceLimit in bumpCycle or bumpNode, and we know the resource count has just reached the limit (the equations are equal). We should return true to mark that we are resource limited for next schedule, or else we might continue to schedule in favor of latency for 1 more schedule and create a schedule that actually overbook the resource. When we call checkResourceLimit to estimate the resource limite before scheduling, we don't need to return true even if the equations are equal, as it shouldn't limit the schedule for it . Differential Revision: https://reviews.llvm.org/D62345 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362805 91177308-0d34-0410-b5e6-96231b3b80d8 Jinsong Ji 4 months ago
6 changed file(s) with 33 addition(s) and 27 deletion(s).
 1836 1836 1837 1837 /// Given a Count of resource usage and a Latency value, return true if a 1838 1838 /// SchedBoundary becomes resource limited. 1839 /// If we are checking after scheduling a node, we should return true when 1840 /// we just reach the resource limit. 1839 1841 static bool checkResourceLimit(unsigned LFactor, unsigned Count, 1840 unsigned Latency) { 1841 return (int)(Count - (Latency * LFactor)) > (int)LFactor;⏎ 1842 unsigned Latency, bool AfterSchedNode) {⏎ 1843 int ResCntFactor = (int)(Count - (Latency * LFactor)); 1844 if (AfterSchedNode) 1845 return ResCntFactor >= (int)LFactor; 1846 else 1847 return ResCntFactor > (int)LFactor; 1842 1848 } 1843 1849 1844 1850 void SchedBoundary::reset() { 2133 2139 CheckPending = true; 2134 2140 IsResourceLimited = 2135 2141 checkResourceLimit(SchedModel->getLatencyFactor(), getCriticalCount(), 2136 getScheduledLatency());⏎ 2142 getScheduledLatency(), true);⏎ 2137 2143 2138 2144 LLVM_DEBUG(dbgs() << "Cycle: " << CurrCycle << ' ' << Available.getName() 2139 2145 << '\n'); 2301 2307 // resource limited. If a stall occurred, bumpCycle does this. 2302 2308 IsResourceLimited = 2303 2309 checkResourceLimit(SchedModel->getLatencyFactor(), getCriticalCount(), 2304 getScheduledLatency());⏎ 2310 getScheduledLatency(), true);⏎ 2305 2311 2306 2312 // Update CurrMOps after calling bumpCycle to handle stalls, since bumpCycle 2307 2313 // resets CurrMOps. Loop to handle instructions with more MOps than issue in 2520 2526 RemLatency = computeRemLatency(CurrZone); 2521 2527 RemLatencyComputed = true; 2522 2528 OtherResLimited = checkResourceLimit(SchedModel->getLatencyFactor(), 2523 OtherCount, RemLatency);⏎ 2529 OtherCount, RemLatency, false);⏎ 2524 2530 } 2525 2531 2526 2532 // Schedule aggressively for latency in PostRA mode. We don't check for
 2023 2023 ; P9LE: # %bb.0: # %entry 2024 2024 ; P9LE-NEXT: lfd f0, 24(r3) 2025 2025 ; P9LE-NEXT: lfd f2, 8(r3) 2026 ; P9LE-NEXT: xxmrghd vs0, vs2, vs0 2026 2027 ; P9LE-NEXT: lfd f1, 16(r3) 2027 ; P9LE-NEXT: xxmrghd vs0, vs2, vs0 2028 2028 ; P9LE-NEXT: lfd f3, 0(r3) 2029 2029 ; P9LE-NEXT: xvcvdpsxws v2, vs0 2030 2030 ; P9LE-NEXT: xxmrghd vs0, vs3, vs1 3607 3607 ; P9LE: # %bb.0: # %entry 3608 3608 ; P9LE-NEXT: lfd f0, 24(r3) 3609 3609 ; P9LE-NEXT: lfd f2, 8(r3) 3610 ; P9LE-NEXT: xxmrghd vs0, vs2, vs0 3610 3611 ; P9LE-NEXT: lfd f1, 16(r3) 3611 ; P9LE-NEXT: xxmrghd vs0, vs2, vs0 3612 3612 ; P9LE-NEXT: lfd f3, 0(r3) 3613 3613 ; P9LE-NEXT: xvcvdpuxws v2, vs0 3614 3614 ; P9LE-NEXT: xxmrghd vs0, vs3, vs1