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

SimdAsHWIntrinsic improvements and cleanup #80134

Merged
merged 12 commits into from
Jan 6, 2023

Conversation

tannergooding
Copy link
Member

@tannergooding tannergooding commented Jan 3, 2023

This does some general cleanup to the simdashwintrinsic code by sharing code paths where possible and using the gtNewSimd*Node helpers where they exist.

As part of that, this resolves an issue with the operand order used for a gtNewSimdWithElementNode call. I additionally attempted to finishe the cleanup to use fgMakeMultiUse rather than impCloneExpr, however it hit various asserts and needs more followup (I plan on doing this in a separate PR: #80242).

@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 Jan 3, 2023
@ghost ghost assigned tannergooding Jan 3, 2023
@ghost
Copy link

ghost commented Jan 3, 2023

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

Issue Details

This does some general cleanup to the simdashwintrinsic code by sharing code paths where possible and using the gtNewSimd*Node helpers where they exist.

As part of that, this finishes the cleanup to use fgMakeMultiUse rather than impCloneExpr and resolves an issue with the operand order used for a gtNewSimdWithElementNode call.

Author: tannergooding
Assignees: tannergooding
Labels:

area-CodeGen-coreclr

Milestone: -

@build-analysis build-analysis bot mentioned this pull request Jan 4, 2023
@tannergooding
Copy link
Member Author

/azp run runtime-coreclr jitstress-isas-x86, runtime-coreclr jitstress-isas-arm, runtime-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@tannergooding tannergooding marked this pull request as ready for review January 5, 2023 19:58
@tannergooding
Copy link
Member Author

CC. @dotnet/jit-contrib. Some pretty substantial wins here, reducing the size by 40k bytes on Arm64 and 90-102k bytes on x64.

There is a small gain for Arm64 minopts and a small regression for x64 minopts, but also some nice throughput gains (-0.14% for libraries.pmi on x64) for full opts and no TP change for minopts.

@tannergooding
Copy link
Member Author

tannergooding commented Jan 5, 2023

The few regressions are cases where we are spilling an operand (impSpillSideEffect) where we weren't before, effectively a bug fix.

The vast majority of these are simply the Vector128/256.AndNot tests which are heavily testing these paths (and doing so in uncommon patterns to "stress" the JIT).

For AndNot in particular, we might be able to "salvage" some of this by using GTF_REVERSE_OPS instead, but that might be a more involved change given these are MultiOp nodes.

@vargaz
Copy link
Contributor

vargaz commented Jan 5, 2023

The mono changes look ok.

case NI_VectorT256_op_Division:
#endif // TARGET_XARCH
{
return gtNewSimdBinOpNode(GT_DIV, retType, op1, op2, simdBaseJitType, simdSize,
Copy link
Member

Choose a reason for hiding this comment

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

I assume eventually we might need to implement the magic division optimization if op2 is CNS_VEC? 🙂 (or pdivp is fast enough as is?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, there are some optimization opportunities here that we can more easily enable/centralize in the future with this change.

@EgorBo
Copy link
Member

EgorBo commented Jan 5, 2023

Nice diffs

@tannergooding
Copy link
Member Author

/azp run runtime-coreclr jitstress-isas-x86, runtime-coreclr jitstress-isas-arm, runtime-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@tannergooding tannergooding merged commit 1808d1c into dotnet:main Jan 6, 2023
@tannergooding
Copy link
Member Author

Merged slightly early (only mono llvmfullaot legs left). CI had already been passing except for two WasmBuildTest legs. I only merged in latest dotnet/main to ensure that failure was unrelated

@tannergooding tannergooding deleted the simplify-simdashw branch January 6, 2023 18:58
@EgorBo
Copy link
Member

EgorBo commented Jan 10, 2023

@ghost ghost locked as resolved and limited conversation to collaborators Feb 9, 2023
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.

4 participants