-
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 core ASCII.Utility methods with Vector256/Vector512 code paths. #88532
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
12bb892
Lib upgrade for ToUtf16
Ruihan-Yin ff185d0
Upgrade NarrowUtf16ToAscii with Vector512
Ruihan-Yin 9d45ff8
Complete the upgrade in NarrowUtf16ToAscii method
Ruihan-Yin 09b8e31
Adding VectorXX paths to `GetIndexOfFirstNonAscii` functions.
anthonycanino 01a43e7
Adding optimization to Vecto256 VectorContainsNonAsciiChar method.
anthonycanino ea913db
Code path refactoring and cleanup.
anthonycanino 5cb1efc
Code changes based on the review:
Ruihan-Yin 5d06c67
Resolve comments
Ruihan-Yin 17d3b28
revert the changes at GetIndexOfFirstNonAsciiByte
Ruihan-Yin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2670,6 +2670,23 @@ public static void StoreUnsafe<T>(this Vector512<T> source, ref T destination) | |
ref byte address = ref Unsafe.As<T, byte>(ref destination); | ||
Unsafe.WriteUnaligned(ref address, source); | ||
} | ||
/// <summary> | ||
/// Stores to lower 256 bits of <paramref name="source"/> to memory destination of <paramref name="destination"/>[<paramref name="elementOffset"/>] | ||
/// </summary> | ||
/// <typeparam name="T">The type of the elements in the vector.</typeparam> | ||
/// <param name="source">The vector that will be stored.</param> | ||
/// <param name="destination">The destination to which <paramref name="elementOffset" /> will be added before the vector will be stored.</param> | ||
/// <param name="elementOffset">The element offset from <paramref name="destination" /> from which the vector will be stored.</param> | ||
/// <remarks> | ||
/// Uses double instead of long to get a single instruction instead of storing temps on general porpose register (or stack) | ||
/// </remarks> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
internal static void StoreLowerUnsafe<T>(this Vector512<T> source, ref T destination, nuint elementOffset = 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same general question here as on the other. Why this helper rather than simply doing It looks like the right stuff happens for the former already and it avoids the JIT needing to do any inlining for it. |
||
{ | ||
ThrowHelper.ThrowForUnsupportedIntrinsicsVector512BaseType<T>(); | ||
ref byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref destination, elementOffset)); | ||
Unsafe.WriteUnaligned(ref address, source._lower); | ||
} | ||
|
||
/// <summary>Stores a vector at the given destination.</summary> | ||
/// <typeparam name="T">The type of the elements in the vector.</typeparam> | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why this instead of
source.GetLower().StoreUnsafe(ref destination, elementOffset)
?