-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 SequenceEqual for constant lengths unrolling #84524
Conversation
Tagging subscribers to this area: @dotnet/area-system-memory Issue DetailsSlightly improve After this PR, e.g. TryGetFloatingPointConstant is fully unrolled (all three
|
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs
Outdated
Show resolved
Hide resolved
@EgorBo In theory, the length in |
8d89753
to
3cfb576
Compare
@xtqqczze thanks for suggestion but in this case I'm interesting in making Current diffs:
This PR triggered 23 new unrollings. |
@stephentoub any thoughts on this? it triggered 23 new unrollings but in theory jit should be able to handle both patterns, but that will need quite some extra efforts |
I'm fine with it if it doesn't regress anything meaningfully. |
@stephentoub It should not (on all runtimes) and number of new unrollings prove it's better to speculate that "other.Length" is likely to be constant. Can you apporve it? 🙂 I needed it for #84525 |
Slightly improve
MemoryExtensions.SequenceEqual
shape to expose more "constant length" cases for unrolling. It's a JIT phase ordering issue, in theory, if we run VN again after Assert prop we'll do the same in JIT, unfortunately, JIT's logic to run some phases more than once is currently broken.After this PR, e.g. TryGetFloatingPointConstant is fully unrolled (all three
SequenceEqual
in it)