Skip to content
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

[AIE2P] Optimize G_PHI regbankselect for fifo/acc #314

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

Conversation

andcarminati
Copy link
Collaborator

Observation: this PR should include more tests after merging more fifo intrinsics.


# Test 3: The instruction %19:_(p0) = G_PHI %0(p0), %bb.0, %27(p0), %bb.1
# should not be mapped to accregbank. The result of the PHI node is used by an instruction
# that is considered an `accululator-use instruction` but the considered result is just a scalar
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit accumulator

Copy link
Collaborator Author

@andcarminati andcarminati Jan 28, 2025

Choose a reason for hiding this comment

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

Oh, did I really write this? Good catch!

@andcarminati andcarminati force-pushed the andreu.fifo.regbank.optimization branch from 436679d to 785ff92 Compare January 28, 2025 16:15
bb.2:
PseudoRET implicit $lr

...
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Maybe add a test where a PHI is used both as a PHI and an ACC. I think we will favour the FIFO mapping at this point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean by both FIFO and ACC? Yes, we should favor the FIFO because we check it first. I hope we will not face this situation, according to the benchmarks I saw, what do you think?

@andcarminati andcarminati force-pushed the andreu.fifo.regbank.optimization branch from 785ff92 to 407735d Compare January 29, 2025 16:46
@@ -966,6 +976,36 @@ AIE2PRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
}
return AIEBaseRegisterBankInfo::getInstrMapping(MI);
}
case TargetOpcode::G_PHI: {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a really special-case to handle. If we map to vector reg bank, we may block optimal SWP scheduling's after. This is also a special case because one single PHI node may contain inputs mapped to fifo, accumulator and vector bank at the same time. The way it is mapped is also different, we handle only the output and inputs are related the inputs.

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.

3 participants