Open kasuga-fj opened 4 months ago
@bcahoon Could you please check? (Sorry for the many mentions)
Sorry, I misunderstood something of Phi scheduling. I believe the following fixes will resolve this issue..
multipleIterations
, also consider order-dependencies (barrier-dependencies) between phisS.getSUnit()
instead of P.getSUnit()
in multipleIterations
MaxEarlyStart
instead of MinLateStart
after calling multipleIterations
We have found that there are cases where phi-phi dependencies are not handled correctly. The following link shows an example. https://godbolt.org/z/qfsT5WK5a
The following is part of the debug output.
There is a dependence between
SU(1)
andSU(2)
, and the distance of it is 1. However,SwingSchedulerDAG::getDistance
returns 0 because the dependence is not an anti. I think this problem can be resolved by changing the dependence type to an anti inSwingSchedulerDAG::updatePhiDependencies
.https://github.com/llvm/llvm-project/blob/c947709df7859bb7285873593adab70349a5ab3e/llvm/lib/CodeGen/MachinePipeliner.cpp#L957-L958
However, I'm not quite sure if there's any intent to append barrier-dependence rather than anti.
Slightly off topic, but I have a feeling that
multipleIterations
has bugs. If I understand it correctly, this function addresses the following case: the instruction defining v2 should be scheduled before the instruction defining v3.If so, I see the following problems.
multipleIterations
should beS.getSUnit()
, notP.getSUnit()
.MaxEarlyStart
, notMinLateStart
.cycle + 2 * II
instead ofcycle
?multipleIterations
also doesn't handle phi-phi barrier-dependence correctly.