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.
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
Faster IndexOf for substrings #63285
Faster IndexOf for substrings #63285
Changes from 31 commits
34bf37a
03ae4da
5cfdb16
0638617
e36fdc6
85c2320
8918ab6
cb32d34
cda6b50
8af9270
87c26d0
652b42d
53cefad
d465407
22921fd
2c851bc
9308d82
dac974a
3554ad3
de87ec2
cb7541f
b0b04ad
141e236
e664ad3
bff8419
dcc9d81
3def5e0
a52138b
f86e323
f2372a0
38ef9a9
f5e6192
4827ddc
d601351
3a005bc
9fefe81
c118dd2
7e8b100
d805701
3bb56f0
e9df891
cb60535
7c55951
3f0b4c3
4d860a1
48f4fc7
7c3b834
c68a07a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 Avx2.IsSupported rather than Vector256.IsHardwareAccelerated? If we need to use Avx2 here, that seems like a failure of the Vector types we should fix.
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.
@stephentoub I personally am not a fan of
IsHardwareAccelerated
property at all but the same applies toVector<>.IsHardwareAccelerated
they both returntrue
on an e.g. Core i7 Ivy Bridge with AVX1 but most likely use slow paths for many APIs with integers. In IndexOf I rely on AVX2.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 maintain that if this can't be successful just using Vector*, something is wrong. A key point of these APIs is to not have to use or understand the low-level intrinsics.
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.
cc @tannergooding
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.
Like I stated in one of the other comments, I'm fine with us updating
Vector256<T>.IsHardwareAccelerated
to only returntrue
on AVX2+ where both floating-point and integer operations can be accelerated using "single instructions".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.
Do we need a follow up issue opened then, to remove use of
Avx2.IsSupported
here? presumably after VectorNNN is fully employed in these files, there should be no using statements for System.Runtime.Intrinsics.Arm nor for System.Runtime.Intrinsics.X86, if I correctly understand the ambitions of the new Vector APIs.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.
Yes, if it's not going to be addressed in this PR, we need to address it subsequently soon.
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.
@tannergooding, is this something you're able to follow up on?
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 opened #64309