dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.45k stars 4.76k forks source link

Add Support for Vector512 in BinaryPrimitives.ReverseEndianness.cs #108204

Open masterworgen opened 2 months ago

masterworgen commented 2 months ago

Issue Summary: Currently, the BinaryPrimitives.ReverseEndianness.cs file in the .NET runtime includes methods that utilize Vector128 and Vector256 for reversing endianness. However, there is no support for Vector512. To enhance performance on hardware that supports Vector512 (e.g., AVX-512 capable processors), it would be beneficial to extend these methods to also handle Vector512.

Proposed Solution: Implement additional overloads or logic within the existing methods to utilize Vector512 when supported by the hardware. Ensure that the fallback mechanism for hardware without AVX-512 support remains in place. Provide appropriate unit tests to validate the functionality of reversing endianness using Vector512. Benefit: By supporting Vector512, we can potentially achieve better performance on modern hardware with AVX-512 capabilities, especially in scenarios where large volumes of data require endianness conversion.

Additional Considerations: Ensure backward compatibility with existing usages of Vector128 and Vector256. If necessary, include benchmarks comparing the performance gains between Vector128, Vector256, and Vector512 implementations. Thank you for considering this enhancement.

dotnet-policy-service[bot] commented 2 months ago

Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics See info in area-owners.md if you want to be subscribed.