-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Light up Ascii.Equality.Equals and Ascii.Equality.EqualsIgnoreCase with Vector512 code path #88650
Conversation
Enabling AVX512 for ASCII.Equals
…he library is not using any functions from AVX512F
…rAreAscii for Vector 512. Also checking for Vector512 support and not AVX512F in ASCIIEquality.Equals
6caff3e
to
6c600cf
Compare
Tagging subscribers to this area: @dotnet/area-system-text-encoding Issue DetailsNO NEED FOR REVIEW AT THIS TIMEThis PR is about adding Vector512 support to the existing Perf
|
4ee92c1
to
a995aae
Compare
src/libraries/System.Private.CoreLib/src/System/Text/Ascii.Equality.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Basically a copy/paste of the V256 path and changed to use V512
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I was also relying on it matching the Vector256 variant.
while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd)); | ||
|
||
// If any elements remain, process the last vector in the search space. | ||
if (length % (uint)Vector512<TLeft>.Count != 0) | ||
{ | ||
ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref left, length - (uint)Vector512<TLeft>.Count); | ||
return TLoader.EqualAndAscii512(ref oneVectorAwayFromLeftEnd, ref oneVectorAwayFromRightEnd); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Not specific to this PR since it's just following the existing pattern)
Since we're already doing the ref arithmetic here, we might be able to save a few instructions by changing such loops to
while (Unsafe.IsAddressLessThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd))
{ ... }
ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref left, length - (uint)Vector512<TLeft>.Count);
return TLoader.EqualAndAscii512(ref oneVectorAwayFromLeftEnd, ref oneVectorAwayFromRightEnd);
This PR is about adding Vector512 support to the existing ASCII.Equality.Equals and ASCIIEquality..EqualsIgnoreCase library APIs. The implementation remains very much similar to Vector256.
We have changed the implementation of
public static Vector512<ushort> Load512
to make sure we either retain the existing performance or see a performance gain. Please look the comments in the code for detailed explanation.PERF