dotnet / runtime

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

`AVX512F.Compare()` not accelerated on xarch #96414

Open Ruihan-Yin opened 9 months ago

Ruihan-Yin commented 9 months ago

Description

When using AVX512F.Compare(Vector512 left, Vector512 right, FloatComparisonMode mode) as described in the document-system-runtime-intrinsics-vector512((system-single))-system-runtime-intrinsics-x86-floatcomparisonmode))

Unhandled exception. System.PlatformNotSupportedException: Operation is not supported on this platform. is reported on my AVX512F enabled machine.

Reproduction Steps

[MethodImpl(MethodImplOptions.NoInlining)]
public unsafe static Vector512<double> comp(Vector512<double> left, Vector512<double> right)
{
     return Avx512F.Compare(left, right, FloatComparisonMode.OrderedLessThanSignaling);
}
public static void Main(string[] args)
{
    Vector512<double> a = Vector512.Create(1.0);
    Vector512<double> b = Vector512.Create(2.0);
    Console.WriteLine(comp(a, b));
}

Expected behavior

the expected compare results should be logged

Actual behavior

Unhandled exception. System.PlatformNotSupportedException: Operation is not supported on this platform.
   at System.Runtime.Intrinsics.X86.Avx512F.Compare(Vector512`1 left, Vector512`1 right, FloatComparisonMode mode)

Regression?

This Compare API was exposed in #87404, but in hwintrinsiclistxarch.h, the corresponding intrinsic is missing, so PlatformNotSupportedException is reported.

Known Workarounds

No response

Configuration

i9-9980XE - Skylake

Other information

No response

ghost commented 9 months ago

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

Issue Details
### Description When using `AVX512F.Compare(Vector512 left, Vector512 right, FloatComparisonMode mode)` as described in the [document](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.intrinsics.x86.avx512f.compare?view=net-8.0#system-runtime-intrinsics-x86-avx512f-compare(system-runtime-intrinsics-vector512((system-single))-system-runtime-intrinsics-vector512((system-single))-system-runtime-intrinsics-x86-floatcomparisonmode)) `Unhandled exception. System.PlatformNotSupportedException: Operation is not supported on this platform.` is reported on my AVX512F enabled machine. ### Reproduction Steps ```C# [MethodImpl(MethodImplOptions.NoInlining)] public unsafe static Vector512 comp(Vector512 left, Vector512 right) { return Avx512F.Compare(left, right, FloatComparisonMode.OrderedLessThanSignaling); } public static void Main(string[] args) { Vector512 a = Vector512.Create(1.0); Vector512 b = Vector512.Create(2.0); Console.WriteLine(comp(a, b)); } ``` ### Expected behavior the expected compare results should be logged ### Actual behavior ``` Unhandled exception. System.PlatformNotSupportedException: Operation is not supported on this platform. at System.Runtime.Intrinsics.X86.Avx512F.Compare(Vector512`1 left, Vector512`1 right, FloatComparisonMode mode) ``` ### Regression? This `Compare` API was exposed in #87404, but in `hwintrinsiclistxarch.h`, the corresponding intrinsic is missing, so `PlatformNotSupportedException` is reported. ### Known Workarounds _No response_ ### Configuration i9-9980XE - Skylake ### Other information _No response_
Author: Ruihan-Yin
Assignees: -
Labels: `area-System.Runtime.Intrinsics`
Milestone: -