[llvm] [llvm][CodeGen] Fixed max cycle calculation with zero-cost instructions for window scheduler (PR #99454)
Kai Yan via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 20:48:45 PDT 2024
================
@@ -437,12 +437,16 @@ int WindowScheduler::calculateMaxCycle(ScheduleDAGInstrs &DAG,
int PredCycle = getOriCycle(PredMI);
ExpectCycle = std::max(ExpectCycle, PredCycle + (int)Pred.getLatency());
}
- // ResourceManager can be used to detect resource conflicts between the
- // current MI and the previously inserted MIs.
- while (!RM.canReserveResources(*SU, CurCycle) || CurCycle < ExpectCycle) {
- ++CurCycle;
- if (CurCycle == (int)WindowIILimit)
- return CurCycle;
+ // Zero cost instructions do not need to check resource.
+ if (!TII->isZeroCost(MI.getOpcode())) {
----------------
kaiyan96 wrote:
> Why does this hook exist? How is it different from isMetaInstruction?
Metainstructions do not participate in scheduling, but zero-cost instructions do. `COPY` is a typical example of a zero-cost instruction
> Also copy should need resource checks?
`COPY` do not occupy hardware resources so they do not require resource checks, they still need to be handled during instruction scheduling to ensure proper execution.
https://github.com/llvm/llvm-project/pull/99454
More information about the llvm-commits
mailing list