-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Improve IndexOfAnyAsciiSearcher ARM throughput #78739
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
Improve IndexOfAnyAsciiSearcher ARM throughput #78739
Conversation
Also solves an edge-case bug for byte overloads on ARM64 where we'd get false positives (negatives for Except) when haystack values were exactly 128 above a value in the needle
|
Tagging subscribers to this area: @dotnet/area-system-memory Issue DetailsAlso solves an edge-case bug for byte overloads on ARM64 where we'd get false positives (negatives for Except) when haystack values were exactly 128 above a value in the needle. Before
After
|
| haystackWithOffsetNeedle[i] = (byte)(128 + needleValues[i % needleValues.Length]); | ||
| } | ||
|
|
||
| Assert.Equal(-1, haystackWithOffsetNeedle.IndexOfAny(needle)); |
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.
The test would blow up here on ARM before this change
| Vector128<byte> ascii = Sse2.IsSupported | ||
| ? Sse2.PackSignedSaturate(ascii0, ascii1).AsByte() | ||
| : AdvSimd.Arm64.UnzipEven(ascii0.AsByte(), ascii1.AsByte()); | ||
| Vector128<byte> ascii = Sse2.PackSignedSaturate(ascii0, ascii1).AsByte(); |
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.
Nit: does the ascii local temporary help with anything?
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.
I don't think so, I just found it a bit more readable when initially writing this logic
|
/azp run runtime-libraries-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Also solves an edge-case bug for byte overloads on ARM64 where we'd get false positives (negatives for Except) when haystack values were exactly 128 above a value in the needle.
Closes #78718
Before
After