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 helper APIS for GetLower/Upper and WithLower/Upper #83982

Merged
merged 13 commits into from
Mar 30, 2023

Conversation

tannergooding
Copy link
Member

This ensures the GetLower, GetUpper, WithLower, and WithUpper APIs are intrinsic and have appropriate helpers carried through to lowering.

This should minimally improve codegen as we no longer have to worry about the inliner but it should also make it simpler for certain AVX-512 optimizations to light up, such as vector512.GetLower().GetLower().

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

ghost commented Mar 27, 2023

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

Issue Details

This ensures the GetLower, GetUpper, WithLower, and WithUpper APIs are intrinsic and have appropriate helpers carried through to lowering.

This should minimally improve codegen as we no longer have to worry about the inliner but it should also make it simpler for certain AVX-512 optimizations to light up, such as vector512.GetLower().GetLower().

Author: tannergooding
Assignees: tannergooding
Labels:

area-CodeGen-coreclr

Milestone: -

@tannergooding
Copy link
Member Author

WASM failures are #83986

@tannergooding tannergooding marked this pull request as ready for review March 29, 2023 22:03
@tannergooding
Copy link
Member Author

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

@tannergooding
Copy link
Member Author

Diffs

Some small improvement to Arm64 as we're able to optimize the Vector128.GetUpper:

-            movi    v17.4s, #0
-            ext     v16.16b, v16.16b, v17.16b, #8
+            ext     v16.16b, v16.16b, v16.16b, #8

No real diffs on x64. For both x64 and Arm64 it being 1 node with 1 (Get) or 2 (With) inputs all the way to lowering/codegen allows the JIT to do some minor transformations. In the case of Linux x64, there are a couple places where we get 1 memory read instead of 2. In the case of Arm64 we sometimes see the ext reordered closer to its actual usage site. These are most often no change in assembly size when this happens.

@@ -3168,22 +3162,16 @@ public static Vector128<T> WithLower<T>(this Vector128<T> vector, Vector64<T> va
/// <param name="value">The value of the upper 64-bits as a <see cref="Vector64{T}" />.</param>
/// <returns>A new <see cref="Vector128{T}" /> with the upper 64-bits set to <paramref name="value" /> and the lower 64-bits set to the same value as that in <paramref name="vector" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="vector" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
Copy link
Member

Choose a reason for hiding this comment

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

The comment above is wrong: with the upper 64-bits set to the specified value and the upper 64-bits set to the same value as that in the given vector (both parts say "upper")

Copy link
Member Author

Choose a reason for hiding this comment

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

Will fix these in a follow up PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

@tannergooding tannergooding merged commit 57ae91c into dotnet:main Mar 30, 2023
@tannergooding tannergooding deleted the hwintrin-getwith branch March 30, 2023 04:24
@ghost ghost locked as resolved and limited conversation to collaborators Apr 29, 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.

2 participants