-
Notifications
You must be signed in to change notification settings - Fork 30
[AIE][PostPipeliner] make PostPipeliner depend less on PostScheduler #740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: aie-public
Are you sure you want to change the base?
Conversation
| // We virtually unroll the body by the stagecount, computed from rounding | ||
| // up the length divided by II, adding one more stage to account for | ||
| // the added resource contention | ||
| NCopies = (BS.getScheduleLength() + II - 1) / II + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the last of the remaining dependences that required the scheduler to run before the pipeliner
| LLVM_DEBUG(dbgs() << "Conflict in iteration N=" << N << "\n"); | ||
| int Iter = 0; | ||
| while (Cycle < Horizon) { | ||
| if (HR.checkConflict(Scoreboard, *MI, Cycle)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This scoreboard is no longer used for the correctness check, which we now do explicitly in scheduleOtherIterations. Here we just foreshadow conflicts with the first iteration.
| // pushed by LCDs from the first iteration. Since the dag doesn't change, | ||
| // the third iteration behaves the same. | ||
| for (int K = 0; K < NInstr; K++) { | ||
| const int N = K + NInstr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we lost an outer loop, so we have a major diff on indentation. NInstr corresponds to the former outerloop control variable L.
| DEBUG_SUMMARY(dbgs() << "PostPipeliner: Unsafe stage count, NCopies=" | ||
| << NCopies << "\n"); | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't makes this check anymore, but we also 'reach steady state' by constructing it directly from NStages
739671d to
86b1250
Compare
|
|
||
| // Initialize slot counts. | ||
| for (int K = 0; K < NTotalInstrs; K++) { | ||
| for (int K = 0; K < NInstr; K++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we clarify if we are using NInstr of ScheduleInfo or of PostPipeliner ?
Are they the same? It seems as if PostPipeliner::NInstr is closer to ScheduleInfo::Nodes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. NInstr was added to ScheduleInfo at some point; I guess the PostPipeliner one is redundant and should be eliminated. But whenever you see NInstr anywhere in postpipeliner code, it is the number schedulable instructions in the basic block, i.e. the number of nodes in one copy of the dag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, no. Ninstr is copied into ScheduleInfo to decouple an interface from the PostPipeliner itself, but most of the NInstr occurrences are to that of the PostPipeliner. Anyway, they both represent the same invariant number.
|
|
||
| LLVM_DEBUG(dbgs() << "Final Earliest - Latest:\n"); | ||
| for (int K = 0; K < NTotalInstrs; K++) { | ||
| for (int K = 0; K < 2 * NInstr; K++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: for consistency can we use int(Info.Nodes.size()) like above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or better, run a range based for loop.
AIECC-1093 This makes the postpipeliner more flexible. We no longer need to set the number of copies predicting the stage count. DAG and SchedInfo nodes are fixed at two copies. The scoreboard is reduced to the lookahead the pipeliner needs to see the future conflicts with instructions scheduled earlier, which is a pure heuristic. Correctness is checked separately by populating a scoreboard with the steady state. This check can advance the scoreboard, since it only needs to check the loop body stage. Hence it can be of fixed size II + pipelinedepth. The change also reduces runtime, especially for DAG construction
86b1250 to
a29794e
Compare
AIECC-1093
This makes the postpipeliner more flexible.
We no longer need to set the number of copies predicting the stage count. DAG and SchedInfo nodes are fixed at two copies.
The scoreboard is reduced to the lookahead the pipeliner needs to see the future conflicts with instructions scheduled earlier, which is a pure heuristic.
Correctness is checked separately by populating a scoreboard with the steady state. This check can advance the scoreboard, since it only needs to check the loop body stage. Hence it can be of fixed size II + pipelinedepth.
The change also reduces runtime, especially for DAG construction