Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2502,13 +2502,18 @@ bool SchedGroup::canAddSU(SUnit &SU) const {
return canAddMI(MI);

// Special case for bundled MIs.
// Return true if all of the bundled MIs can be added to this group.
// A meta instruction in a bundle is an exception.
const MachineBasicBlock *MBB = MI.getParent();
MachineBasicBlock::instr_iterator B = MI.getIterator(), E = ++B;
while (E != MBB->end() && E->isBundledWithPred())
++E;
// Initially, iterator is on a bundler header.
MachineBasicBlock::instr_iterator B = std::next(MI.getIterator());
while (B != MBB->end() && B->isBundledWithPred()) {
if (!B->isMetaInstruction() && !canAddMI(*B))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also remove the isMetaInstruction handling inside canAddMI

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arsenm, Did you mean cannAddMI return true on isMetaInstruction()? Or, a NFC change of removing lines 3 and 4 below?

1 bool SchedGroup::canAddMI(const MachineInstr &MI) const {
2  bool Result = false;
3  if (MI.isMetaInstruction())
4    Result = false;
5  ...
6  return Result;

As I addressed in my last comment, #152627 (comment), making canAddMI return true on meta instructions affected the results of tests related to sched_group_barrier/iglp_opt. This is due to lines 2501 and 2502.

In effect, making canAddMI return true on meta instructions will add artificial dependence edges among sched_barriers/sched_group_barriers/iglp_opts. Let me know if those potential changes are alright. Then, I will make canAddMI return true on meta instructions and further simplify line 2511 above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to adjust the above usage in the unbundled case, but I meant make it not consider metainstructions at all (i.e. fully pull the meta instruction handling into this function here)

return false;
++B;
}

// Return true if all of the bundled MIs can be added to this group.
return std::all_of(B, E, [this](MachineInstr &MI) { return canAddMI(MI); });
return true;
}

void SchedGroup::initSchedGroup() {
Expand Down
Loading
Loading