[llvm] [CodeGen][MISched] Handle empty sized resource usage. (PR #75951)
Francesco Petrogalli via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 17 03:18:04 PST 2024
================
@@ -4266,6 +4266,12 @@ unsigned ResourceSegments::getFirstAvailableAt(
assert(std::is_sorted(std::begin(_Intervals), std::end(_Intervals),
sortIntervals) &&
"Cannot execute on an un-sorted set of intervals.");
+
+ // Zero resource usage is allowed by TargetSchedule.td but we do not construct
+ // a ResourceSegment interval for that situation.
+ if (AcquireAtCycle == Cycle)
+ return Cycle;
----------------
fpetrogalli wrote:
This seems to be wrong. Say that `CurrCycle` is 200, and that ResourceX have a `[AcquireAtCycle,ReleaseAtCycle]` pair `[5,5]` (note that `Cycle == ReleaseAtCycle` in the naming of the method's parameters... unfortunate)
Your code will say that the resource is available at cycle 5 (not even considering if the resource is busy at cycle 200), but in reality we can only schedule from cycle 200 onwards.
https://github.com/llvm/llvm-project/pull/75951
More information about the llvm-commits
mailing list