-
Notifications
You must be signed in to change notification settings - Fork 14
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
[AIE NFC] Postpipeliner cleanups and refactorings #253
base: aie-public
Are you sure you want to change the base?
Conversation
2f11c48
to
3e5d4c7
Compare
static cl::opt<int> PostPipelinerMaxTryII( | ||
"aie-postpipeliner-maxtry-ii", cl::init(10), | ||
cl::desc("[AIE] Maximum II steps to be tried in the post-ra pipeliner")); | ||
|
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.
Rationale: It is difficult to give a useful absolute value. for small ResMII we will be trying way beyond usefulness, for larger ResMII it may not be enough. A relative amount works better.
@@ -600,6 +604,7 @@ SchedulingStage InterBlockScheduling::updateScheduling(BlockState &BS) { | |||
auto &PostSWP = BS.getPostSWP(); | |||
if (PostSWP.canAccept(*BS.TheBlock)) { | |||
BS.FixPoint.II = PostSWP.getResMII(*BS.TheBlock); | |||
BS.FixPoint.IITries = 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 also simplifies using a solver only on the first few tries
@@ -139,9 +161,10 @@ class PostPipeliner { | |||
int FirstUnscheduled = 0; | |||
int LastUnscheduled = -1; | |||
|
|||
/// Holds the cycle of each SUnit. The following should hold: | |||
/// Holds the schuling information for each instruction. The following |
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.
schuling
-> scheduling
public: | ||
std::vector<NodeInfo> Nodes; | ||
int NInstr; | ||
int MaxEarliest = 0; |
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.
It would be nice to have some comments on these fields, for future reference.
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.
Check: those fields are not used now. Are they related to a new feature?
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.
ScheduleInfo is passed to the strategies. These values are computed as a service to implementors of new strategies.
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# (c) Copyright 2024 Advanced Micro Devices, Inc. or its affiliates |
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: 2025.
# | ||
# (c) Copyright 2024 Advanced Micro Devices, Inc. or its affiliates | ||
|
||
# RUN: llc --mtriple=aie2 -O2 --start-before=postmisched %s \ |
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.
Can we have a description of what does feasibleRA means here? I can see that we have some conf2d_bf16 so it is interesting to also see how this one differs from the others.
Hi @martien-de-jong, this set of changes looks good! I just left some comments for clarification! |
This is to give full access to the Info array and it's associated parameters
Dump intervals in ascii art
3e5d4c7
to
95dbddf
Compare
bool TopDown = true; | ||
bool Alternate = false; | ||
int Runs = 0; | ||
ArrayRef<PriorityComponent> Components; |
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.
Why not own the list of components? Does that help a lot with memory usage?
struct Configuration { | ||
int ExtraStages = 0; | ||
bool TopDown = true; | ||
bool Alternate = 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.
Would be nice to document those fields, especially Alternate
// When we need more slots than we have data predecessors, we have local | ||
// resource contention that we can safely account for in Earliest. | ||
if (Count > 0 && Slots.max() > Count) { | ||
Me.Earliest = std::max(Me.Earliest, PredEarliest + Slots.max() - 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.
Checking: Do we have something similar to bias Latest
based on successors? I think yes, but my memory is blurry.
@@ -342,7 +342,10 @@ bool PostPipeliner::computeLoopCarriedParameters() { | |||
N.StaticLatest = N.Latest; | |||
} | |||
Info.compute(); | |||
return true; | |||
|
|||
// If no node can be scheduled in cycle 0, we must have a circuit that |
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: If no node can be scheduled in cycle 0 after accounting for LCDs, ...
// represent a valid 'regular' loop schedule. | ||
if (NStages == 1) { | ||
LLVM_DEBUG(dbgs() << "PostPipeliner: Degenerate pipeline, NStages=1\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.
FYI @andcarminati , I think that will simplify the epilogue scheduling PR.
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 looks good, and I think I want it. Let me know when you went through the comments and I will approve :)
Small logging improvements
Facility to rerun a strategy an arbitrary number of times
Push earliest with 'local' resource conflicts