This item tracks the conversion of the System.Buffers class to use arm64 intrinsics.
Related: #33308
Tagging subscribers to this area: @tannergooding
Notify danmosemsft if you want to be subscribed.
I can give this a shot
These ARM64 intrinsics are missing to make the code "worthwhile":
Tracked by #32512: Done!
UnsignedSaturatingSubtract - vqsubq_u8 - UQSUB
Tracked by #33398:
UnsignedShiftRight - vshrq_n_u8 - USHR
UnsignedShiftLeft - vshlq_n_u8 - USHL
Tracked by #1277: Done!
TableLookup - vqtbl4q_u8 - TBL
TableLookupExtension - vqtbx4q_u8 - TBX
These helper methods could be accelerated to help it and are tracked in #33496:
Vector128.Create(byte)
These intrinsics could be introduced to maximise perf:
Load 3 Vector128<T> - vld3q_u8 - LD3
Store 3 Vector128<T> - vst3q_u8 - ST3
Load 4 Vector128<T> - vld4q_u8 - LD4
Store 4 Vector128<T> - vst4q_u8 - ST4
https://github.com/john-h-k/runtime/commit/adeea3662d12c2cc06a241736c34cb6e4f22f446
Draft commit, most that can be done until necessary intrinsics are added
Thanks @john-h-k, as per our conversation on Discord, I'll ping you once the necessary intrinsics are added so you can make further progress.
@tannergooding @john-h-k The shift intrinsics went in with https://github.com/dotnet/runtime/pull/36830. There have been many improvements to System.Runtime.Intrinsics optimization in https://github.com/dotnet/runtime/issues/33496. Is this work now unblocked?
Yes, this should be unblocked now.
@john-h-k Are you planning to try and finish this for .NET 5, now that it's unblocked?
If not, we'll have 3-4 people free to help tackle the remaining issues from https://github.com/dotnet/runtime/issues/33308 on Monday.
CC. @jeffhandley
Yes, I should be. I just need to benchmark the 2 possible impls I've got locally, either on my old Pi2b or I can get a friend to do it on newer device
@tannergooding @jeffhandley What's the plan for this for .NET 5?
@tannergooding is planning to carry this one over the finish line ahead of RC1.
We could not get this completed in time for 5.0.0; moved to 6.0.0.