KEMBAR78
Avx512: Abs, ceil, floor, min, max by jkrishnavs · Pull Request #84937 · dotnet/runtime · GitHub
Skip to content

Conversation

jkrishnavs
Copy link
Contributor

@jkrishnavs jkrishnavs commented Apr 17, 2023

Adding support for AVX 512:
Abs, ceil, floor, min, max, sqrt, Negate, and Unary Addition.

Covered cases:

  1. Abs:
    Abs(Vector512), Abs(Vector512), Abs(Vector512), Abs(Vector512), Abs(Vector512)
    , Abs(Vector512)

  2. ceil:
    ceil(Vector512), ceil(Vector512)

  3. Floor:
    Floor(Vector512), Floor(Vector512)

  4. Min
    Min(Vector512, Vector512), Min(Vector512, Vector512),
    Min(Vector512, Vector512), Min(Vector512, Vector512),
    Min(Vector512, Vector512), Min(Vector512, Vector512)

  5. Max
    Max(Vector512, Vector512), Max(Vector512, Vector512),
    Max(Vector512, Vector512), Max(Vector512, Vector512),
    Max(Vector512, Vector512), Max(Vector512, Vector512)

  6. Negate & Unary Addition:
    Negate(Vector512), Negate(Vector512), Negate(Vector512), Negate(Vector512), Negate(Vector512), Negate(Vector512)

Operator for Negate and Unary Addition.

Introduced a few new instructions that were not supported by lower vector intrinsics:

  1. pabsq: Abs for long
  2. min max for long

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 17, 2023
@tannergooding tannergooding added the avx512 Related to the AVX-512 architecture label Apr 20, 2023
jkrishnavs and others added 6 commits April 20, 2023 10:23
Removing unnecessary HW_Flag_NoEvexSemantics flag

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
@tannergooding
Copy link
Member

Resolved the merge conflict caused by other merged PRs

Copy link
Member

@tannergooding tannergooding left a comment

Choose a reason for hiding this comment

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

Changes LGTM. Just a couple minor code cleanup requests.

Copy link
Member

@tannergooding tannergooding left a comment

Choose a reason for hiding this comment

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

Actually, on second thought, remembered that there is still a need to fixup the roundps and roundpd instructions in instrsxarch.h as they are still marked as EVEX incompatible.

They do actually, in that they become the vrndscaleps/vrndscalepd instructions and the upper 4-bits of the immediate can now be non-zero.

That also means we probably need to update instr.cpp to ensure that roundps/roundpd are emitted as vrndscale in the disassembly

Without this fix, Ceiling and Floor are going to fail in their tests

-- The scalar versions, roundss and roundsd probably need the same treatment.

@ghost ghost added the needs-author-action An issue or pull request that requires more info or actions from the author. label Apr 21, 2023
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
@ghost ghost removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Apr 21, 2023
@jkrishnavs
Copy link
Contributor Author

to update instr.cpp to ensure that roundps/roundpd are emitted as vrndscale in the disassembly

We have tried to add vrndscaleps/vrndscalepd instructions. hope this will find the round instruction

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Copy link
Member

@tannergooding tannergooding left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@jkrishnavs
Copy link
Contributor Author

for some weird reason, git + was added to the code change. making an additional push to remove that.

@jkrishnavs jkrishnavs marked this pull request as ready for review April 22, 2023 02:55
@tannergooding
Copy link
Member

CC. @dotnet/jit-contrib, @dotnet/avx512-contrib

this needs a secondary sign-off from the JIT side

@BruceForstall BruceForstall merged commit 500fbc5 into dotnet:main Apr 22, 2023
@jkrishnavs jkrishnavs deleted the avx512minmax branch April 24, 2023 18:16
@ghost ghost locked as resolved and limited conversation to collaborators May 24, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants