Skip to content

[AIE2P] Add SingletonCopyEdges dag mutator in pre-scheduler #469

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

Open
wants to merge 1 commit into
base: aie-public
Choose a base branch
from

Conversation

khallouh
Copy link
Collaborator

Some instructions take a singleton register class in their operands. If a copy of that same physical register from the function arguments is moved closer to its user by the pre-scheduler and it happens to move past an instruction requiring that singleton register class, a live range interference is created which the register allocator cannot resolve by evicting the function argument physical register, leading to a "ran out of registers" error.
To solve this, this introduces DAG mutator in the pre-scheduler with zero latency edge between such copies and such instructions, thus preventing the scheduler from creating the undesired interference.

continue;

auto MO = MI.getOperand(1);
if (!(MO.isReg() && MO.getReg().isPhysical()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit:

if (!MO.isReg() || !MO.getReg().isPhysical())
       continue;

if (!MBB->isLiveIn(PhysReg))
continue;

SDep SingletonCopyEdge(&SU, SDep::Artificial);
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about moving this into the scope of the if below?


for (SUnit &SU2 : DAG->SUnits) {
MachineInstr &MI = *SU2.getInstr();

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we creating an Edge from SU to itself?

@andcarminati
Copy link
Collaborator

Can we have a test that runs only premisched?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants