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

Ensure that FMA codegen operand swapping matches the lsra selections #62382

Merged
merged 2 commits into from
Dec 6, 2021

Conversation

tannergooding
Copy link
Member

CC. @weilinwa, @kunalspathak

This was missed in #62215, effectively there were cases where lsra would swap operands that codegen wasn't accounting for which lead to allocated registers not lining up what we expected.

Caught this via --pmi --frameworks diffs on a different change I was working on.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Dec 4, 2021
@ghost
Copy link

ghost commented Dec 4, 2021

Tagging subscribers to this area: @JulieLeeMSFT
See info in area-owners.md if you want to be subscribed.

Issue Details

CC. @weilinwa, @kunalspathak

This was missed in #62215, effectively there were cases where lsra would swap operands that codegen wasn't accounting for which lead to allocated registers not lining up what we expected.

Caught this via --pmi --frameworks diffs on a different change I was working on.

Author: tannergooding
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

if (targetReg == op2NodeReg)
{
std::swap(emitOp1, emitOp2);
// op2 = ([op1] * op2) + op3
// 132 form: XMM1 = (XMM1 * [XMM3]) + XMM2
ins = _132form;
std::swap(emitOp2, emitOp3);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

After std::swap(emitOp1, emitOp3); and std::swap(emitOp2, emitOp3);, we will get emitOp1 = op3; emitOp2 = op1; emitOp3 = op2. But in my understanding, we need emitOp1 = op2; emitOp2 = op3; emitOp3 = op1 here. Is there anything I'm missing?

Copy link
Contributor

@weilinwa weilinwa Dec 4, 2021

Choose a reason for hiding this comment

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

@tannergooding, in case you haven't seen this one #62343. That was a case missed and captured by pmi. I think you also solved it in this new commit.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right and that means LSRA has an issue here. Will fix

@tannergooding
Copy link
Member Author

/azp run runtime-coreclr superpmi-replay

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@kunalspathak kunalspathak left a comment

Choose a reason for hiding this comment

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

LGTM with minor nit.

// 213 form: XMM1 = (XMM2 * XMM1) + [XMM3]
if (!copiesUpperBits && (targetReg == op2NodeReg))
// containedOpNum == 0
// no extra work when resultOpNum is 0 or 1
Copy link
Member

Choose a reason for hiding this comment

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

remove the references of containedOpNum and resultOpNum and instead just explain that this is the case when no operand is contained and we pick the appropriate forms.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to remove this in a follow up PR (will put it up about 5 minutes after merging).

This will allow us to get CI passing again without needing to wait on the PR to rerun all tests for a comment change.

@tannergooding tannergooding merged commit c9f56b8 into dotnet:main Dec 6, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jan 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants