-
Notifications
You must be signed in to change notification settings - Fork 14.7k
MachineScheduler: Improve instruction clustering #137784
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
Changes from 8 commits
900eb8b
eff0914
010308e
f06e21f
3cfac16
bec14fd
4147b5f
a94346a
381cd19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,11 @@ bool llvm::fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU, | |
for (SDep &SI : SecondSU.Preds) | ||
if (SI.isCluster()) | ||
return false; | ||
|
||
unsigned FirstCluster = FirstSU.ParentClusterIdx; | ||
unsigned SecondCluster = SecondSU.ParentClusterIdx; | ||
assert(FirstCluster == InvalidClusterId && SecondCluster == InvalidClusterId); | ||
|
||
// Though the reachability checks above could be made more generic, | ||
// perhaps as part of ScheduleDAGInstrs::addEdge(), since such edges are valid, | ||
// the extra computation cost makes it less interesting in general cases. | ||
|
@@ -70,6 +75,14 @@ bool llvm::fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU, | |
if (!DAG.addEdge(&SecondSU, SDep(&FirstSU, SDep::Cluster))) | ||
return false; | ||
|
||
auto &Clusters = DAG.getClusters(); | ||
|
||
FirstSU.ParentClusterIdx = Clusters.size(); | ||
SecondSU.ParentClusterIdx = Clusters.size(); | ||
|
||
SmallSet<SUnit *, 8> Cluster{{&FirstSU, &SecondSU}}; | ||
Clusters.emplace_back(Cluster); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Weird use of "emplace". Can you write it more like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, I don't know the most proper way to use emplace_back for this case. A simple initializer_list cannot be passed to emplace_back here. So I just switch to push_back. |
||
|
||
// TODO - If we want to chain more than two instructions, we need to create | ||
// artifical edges to make dependencies from the FirstSU also dependent | ||
// on other chained instructions, and other chained instructions also | ||
|
Uh oh!
There was an error while loading. Please reload this page.