-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[MachinePipeliner] Use RegisterClassInfo::getRegPressureSetLimit
#119827
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
Merged
wangpc-pp
merged 1 commit into
llvm:main
from
wangpc-pp:main-machinepipeliner-reg-pressure-set
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure what a fixed register is, but it seems to not be the same as reserved. Seems like another hook with bad defaults
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.
Yeah, it is a bad API. Fixed registers are not reserved register... Fixed register are registers defined in
FixedRegisters
RegisterCategory by default...The logic here seems to want to remove reserved registers @kasuga-fj.
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.
As I commented in #118787 (comment), I dared to replace it from
RegisterClassInfo::getRegPressureSetLimit
before (in #87312). This is because there is a duplication between the reserved registers handled insideRegisterClassInfo::getRegPressureSetLimit
and theFixedRegs
calculated here, so theLimit >= Weight
assertion fails. If I remember correctly, in my case (AArch64), the$ffr
triggers it. What I'd like to do here is to ignore registers that have "specific rolls" (e.g., stack pointer) and those whereTargetRegisterInfo::isFixedRegister
returns true looks appropriate in this case to me. Maybe I'm misunderstanding reserved and fixed registers, and there may be a better way to achieve what I want, but I'm not sure this change will work well.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.
IMO isFixedRegister should be deleted. The intent seems to be isReserved || isConstantPhysREg
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.
Thanks for explanation! At least, after removing this part of code, the tests still pass? @kasuga-fj
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.
I ran tests and none of them failed. But that just means there are no correctness issues. This code is part of a heuristic decision, so performance degradation could happen in some cases (and I think the heuristics will be less accurate with this change).
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.
I don't think so. These "fixed" registers are also "reserved" registers, and "reserved" registers contain runtime fixed registers like those are reserved via
-ffixed-xx
options.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.
Previously (where
RegisterClassInfo::getRegPressureSetLimit
was used here), #83437 caused theLimit >= Weight
assertion to fail. This patch marks the$ffr
register as reserved. I just tried to comment out the code that marks$ffr
as reserved and run MachinePipeliner, and found thatFixedRegs
contains$ffr
. It looks to me like there are some gaps between "reserved" and "fixed". Or maybe I misunderstood something (I don't know much about the LLVM API for registers).