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

Expose AVX512 variants of SSE-SSE4.2 instructions #84909

Merged
merged 24 commits into from
Apr 18, 2023

Conversation

tannergooding
Copy link
Member

This exposes 512-bit variants of all the relevant SSE-SSE4.2 instructions making progress towards completing:

For a few instructions, there is a new Q variant of the instruction that supports 64-bit elements. Where relevant, existing code paths were updated to utilize this instruction

The breakdown of the changes are:

  • JIT: +395, -44
    • +84 of this is the main table, the rest is minor updates for specialized handling
  • LIB: +2386, -347
    • +225 of this is the reference assembly
    • +1302 lines is the "duplicated" entries for the *.PlatformNotSupported.cs version of the file
    • +1712 lines of this is doc comments (split between the *.cs and *.PlatformNotSupported.cs)
  • TST: +10684, -570
    • +392 lines of this is the main table used to generate the tests
    • +10292 lines is csproj and manual tests where they aren't templated yet today

@ghost ghost assigned tannergooding Apr 17, 2023
@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 Apr 17, 2023
@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost
Copy link

ghost commented Apr 17, 2023

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

Issue Details

This exposes 512-bit variants of all the relevant SSE-SSE4.2 instructions making progress towards completing:

For a few instructions, there is a new Q variant of the instruction that supports 64-bit elements. Where relevant, existing code paths were updated to utilize this instruction

The breakdown of the changes are:

  • JIT: +395, -44
    • +84 of this is the main table, the rest is minor updates for specialized handling
  • LIB: +2386, -347
    • +225 of this is the reference assembly
    • +1302 lines is the "duplicated" entries for the *.PlatformNotSupported.cs version of the file
    • +1712 lines of this is doc comments (split between the *.cs and *.PlatformNotSupported.cs)
  • TST: +10684, -570
    • +392 lines of this is the main table used to generate the tests
    • +10292 lines is csproj and manual tests where they aren't templated yet today
Author: tannergooding
Assignees: tannergooding
Labels:

area-CodeGen-coreclr, new-api-needs-documentation

Milestone: -

@tannergooding tannergooding added the avx512 Related to the AVX-512 architecture label Apr 17, 2023
@tannergooding
Copy link
Member Author

CC. @dotnet/avx512-contrib, @dotnet/jit-contrib, @dotnet/area-system-runtime-intrinsics

@tannergooding tannergooding marked this pull request as ready for review April 17, 2023 16:02
@tannergooding
Copy link
Member Author

tannergooding commented Apr 17, 2023

Diffs

We see a TP improvement of -0.02% in a couple contexts and codegen improvements for others. The codegen improvements come from:

  • containment for things like 256-bit pshufb
  • utilizing new the instructions that work with 64-bit elements (such as vpmaxsq)

Linux shows a couple regressions in some of the "recursive implementations" for the Avx.Shuffle and Avx2.AlignRight APIs.

Such diffs come from us supporting containment where we didn't previously and that hoisting the load into the jump table fallback.

We can/should probably avoid containment in the case we need to generate such a jump table, but its a pre-existing condition for all such nodes, so we can handle it in a follow up PR (#84933).

Copy link
Member

@EgorBo EgorBo left a comment

Choose a reason for hiding this comment

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

JIT and BCL changes LGTM, I skimmed through the tests and they also look ok

@tannergooding
Copy link
Member Author

Tests are passing, but timing out. I have up #84948 to try and help solve some of that.


if (Avx512BW.IsSupported)
{
using (TestTable<short> intTable = new TestTable<short>(new short[32] { 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4 }, new short[32]))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
using (TestTable<short> intTable = new TestTable<short>(new short[32] { 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4 }, new short[32]))
using (TestTable<short> intTable = new(new short[32] { 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4 }, new short[32]))

a bit more terse; here and elsewhere

Copy link
Member Author

Choose a reason for hiding this comment

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

This is setup in a way that makes it easier to switch to generated from a template in the future.

@tannergooding
Copy link
Member Author

tannergooding commented Apr 17, 2023

Pulled in #84948 to help resolve test timeouts...

Edit: It did not resolve the timeouts, seems merged test wrappers are more special than we thought. I've pulled in #84959 instead after validating that CI is indeed filtering the tests down on the relevant platforms now.

Copy link
Member

@steveharter steveharter left a comment

Choose a reason for hiding this comment

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

LGTM pending green CI

@tannergooding
Copy link
Member Author

Resolved merge conflicts. Should pass now that the tests are properly getting filtered and last run showed OSX got past the timeouts, etc.

@tannergooding tannergooding merged commit dbcffe7 into dotnet:main Apr 18, 2023
@tannergooding tannergooding deleted the avx512-2 branch April 18, 2023 19:29
@ghost ghost locked as resolved and limited conversation to collaborators May 19, 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 avx512 Related to the AVX-512 architecture new-api-needs-documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants