Skip to content

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

Merged
BruceForstall merged 3 commits into
dotnet:mainfrom
DeepakRajendrakumaran:vector512API_3
Mar 28, 2023
Merged

Add lowering for As*() and dependent methods.#83861
BruceForstall merged 3 commits into
dotnet:mainfrom
DeepakRajendrakumaran:vector512API_3

Conversation

@DeepakRajendrakumaran

@DeepakRajendrakumaran DeepakRajendrakumaran commented Mar 23, 2023

Copy link
Copy Markdown
Contributor

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

@ghost ghost added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member labels Mar 23, 2023
@ghost

ghost commented Mar 23, 2023

Copy link
Copy Markdown

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: -

Comment thread src/coreclr/jit/hwintrinsicxarch.cpp Outdated
@DeepakRajendrakumaran DeepakRajendrakumaran marked this pull request as ready for review March 24, 2023 17:45
@tannergooding

Copy link
Copy Markdown
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

Comment thread src/coreclr/jit/fgbasic.cpp Outdated
@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()
Comment thread src/coreclr/jit/hwintrinsiccodegenxarch.cpp
Comment thread src/coreclr/jit/hwintrinsiccodegenxarch.cpp Outdated
Comment thread src/coreclr/jit/hwintrinsiccodegenxarch.cpp Outdated
Comment thread src/coreclr/jit/hwintrinsiclistxarch.h Outdated
Comment thread src/coreclr/jit/hwintrinsiclistxarch.h Outdated
Comment thread src/coreclr/jit/hwintrinsicxarch.cpp Outdated
@tannergooding

Copy link
Copy Markdown
Member

Changes overall LGTM. Just a few code cleanup requests.

@tannergooding

Copy link
Copy Markdown
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
Copy Markdown
Member

Failure is unrelated and being handled by #84012

@tannergooding

Copy link
Copy Markdown
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