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

Add lowering for As*() and dependent methods. #83861

Merged
merged 3 commits into from
Mar 28, 2023

Conversation

DeepakRajendrakumaran
Copy link
Contributor

@DeepakRajendrakumaran DeepakRajendrakumaran commented Mar 23, 2023

This includes the following Vector512 API methods:
As(), AsByte(), AsDouble(), AsInt16(), AsInt32(), AsInt64(), AsNInt(), AsNUInt(), AsByte(), AsSingle(), AsUInt16(), AsUInt32(), AsUInt64(), AsVector(), AsVector512(), GetLower(), ToVector512()

Open :

  1. GetUpper() is not lowered for Vector256 even though it's supported. Is this by choice?
  2. I've marked this in code as a comment too : https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/hwintrinsicxarch.cpp#L826-L841 : For us to get here Vector256.AsVector() or Vector256.AsVector256() has to be lowered which will happen only when target supports AVX2. Considering this, will we ever end up with a case where Vector<T> size = 128 and Vector256 gets lowered? I've not been able to manipulate .NET to hit this and this might be dead code. This extends for Vector512.AsVector() or Vector512.AsVector512() with xmm too

@dotnet/avx512-contrib

@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 23, 2023
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Mar 23, 2023
@ghost
Copy link

ghost commented Mar 23, 2023

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

Issue Details

This includes the following:
As(), AsByte(), AsDouble(), AsInt16(), AsInt32(), AsInt64(), AsNInt(), AsNUInt(), AsByte(), AsSingle(), AsUInt16(), AsUInt32(), AsUInt64(), AsVector(), AsVector512(), GetLower(), ToVector512()

Author: DeepakRajendrakumaran
Assignees: -
Labels:

area-CodeGen-coreclr, community-contribution

Milestone: -

@DeepakRajendrakumaran DeepakRajendrakumaran marked this pull request as ready for review March 24, 2023 17:45
@tannergooding
Copy link
Member

GetUpper() is not lowered for Vector256 even though it's supported. Is this by choice?

Not really, its on the backlog to add direct intrinsification and a general gtNewSimdGetUpperNode helper.

I've marked this in code as a comment too : https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/hwintrinsicxarch.cpp#L826-L841 : For us to get here Vector256.AsVector() or Vector256.AsVector256() has to be lowered which will happen only when target supports AVX2. Considering this, will we ever end up with a case where Vector size = 128 and Vector256 gets lowered? I've not been able to manipulate .NET to hit this and this might be dead code. This extends for Vector512.AsVector() or Vector512.AsVector512() with xmm too

This is hit when Avx is supported but Avx2 is not supported. Try setting DOTNET_EnableAVX2=0. That should result in Vector256<T>.IsHardwareAccelerated == true but sizeof(Vector<T>) == 16.

We accelerate only a subset of Vector256 in this case, notably the ones flagged as HW_Flag_AvxOnlyCompatible

@BruceForstall BruceForstall added the avx512 Related to the AVX-512 architecture label Mar 27, 2023
This includes the following:
As(), AsByte(), AsDouble(), AsInt16(), AsInt32(), AsInt64(), AsNInt(), AsNUInt(), AsByte(), AsSingle(), AsUInt16(), AsUInt32(), AsUInt64(), AsVector(), AsVector512(), GetLower(), ToVector512()
@tannergooding
Copy link
Member

Changes overall LGTM. Just a few code cleanup requests.

@tannergooding
Copy link
Member

Not really, its on the backlog to add direct intrinsification and a general gtNewSimdGetUpperNode helper.

Draft PR for that is here: #83982. I plan on finishing it after this PR goes in and will have it cover the new Vector512 paths you added at that time.

@tannergooding
Copy link
Member

Failure is unrelated and being handled by #84012

@tannergooding
Copy link
Member

CC. @dotnet/jit-contrib, @dotnet/avx512-contrib for secondary review and merge

@BruceForstall BruceForstall merged commit e467e59 into dotnet:main Mar 28, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 28, 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 community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants