-
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
Minimize use of unsafe
context
#111025
base: main
Are you sure you want to change the base?
Minimize use of unsafe
context
#111025
Conversation
I'm not a fan of this change, these types are very unsafe-adjacent so I don't see why repeating the keyword 7 times is beneficial. |
This change brings these files into alignment with runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs Line 33 in dc0432b
|
I agree with @MihaZupan, but since there is already an inconsistency with V128 I guess it's fine to clean up? PS: it is really unfortunate that |
Looking at |
when I was removing redundant unsafe I didn't scan SIMD APIs so I can imagine there are some redundancies there |
I agree with this. As we move forward with refining exactly what "unsafe" means and adding to what triggers warnings and viral requirements, we should also look at removing things that are no longer appropriate. |
It also produces a compiler warning, which we suppress for the repository:
|
|
||
/// <inheritdoc cref="ISimdVector{TSelf, T}.LoadAlignedNonTemporal(T*)" /> | ||
[Intrinsic] | ||
static Vector128<T> ISimdVector<Vector128<T>, T>.LoadAlignedNonTemporal(T* source) => Vector128.LoadAlignedNonTemporal(source); | ||
static unsafe Vector128<T> ISimdVector<Vector128<T>, T>.LoadAlignedNonTemporal(T* source) => Vector128.LoadAlignedNonTemporal(source); | ||
|
||
/// <inheritdoc cref="ISimdVector{TSelf, T}.LoadUnsafe(ref readonly T)" /> | ||
[Intrinsic] |
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 overloads that take ref T
should be really marked as unsafe too, even though C# does not require it today.
Contributes to #94941.
Follow-up to #110953.
cc: @EgorBo