Skip to content
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

Mono has different behavior for reflection invocation of IsSupported flags #87037

Open
tannergooding opened this issue Jun 2, 2023 · 4 comments

Comments

@tannergooding
Copy link
Member

#86486 expanded the validation done for the various Isa.IsSupported flags exposed by the JIT.

Mono failed this test with the following:

System.Runtime.Intrinsics.X86.Sse.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Sse2.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Aes.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Pclmulqdq.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Sse3.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Ssse3.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Sse41.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Sse42.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Avx.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Fma.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx2.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Bmi1.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Bmi2.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Avx512F.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512F+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512BW.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512BW+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512CD.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512CD+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512DQ.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512DQ+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512F.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512F+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512BW.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512BW+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512CD.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512CD+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512DQ.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512DQ+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.Vector128.IsHardwareAccelerated returned a different result when called via reflection
System.Runtime.Intrinsics.Vector256.IsHardwareAccelerated returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.Vector512.IsHardwareAccelerated returned false but the hardware and runtime returned true
System.Numerics.Vector.Count returned 16 but the hardware returned 32

In particular, it exposes that while several ISAs are supported by Mono, the recursive call is not being properly handled for:

  • Sse.IsSupported
  • Sse2.IsSupported
  • Aes.IsSupported
  • Pclmulqdq.IsSupported
  • Sse3.IsSupported
  • Ssse3.IsSupported
  • Sse41.IsSupported
  • Sse42.IsSupported
  • Bmi1.IsSupported
  • Bmi2.IsSupported
  • Vector128.IsHardwareAccelerated

It also highlights the following ISAs which aren't yet supported by Mono. This is not a bug in Mono, just represents work that is yet to be completed and for which the test would need a corresponding check to account for the behavior difference. We do not, however, have a trivial way to check at runtime if we are on RyuJIT or Mono:

  • Avx.IsSupported
  • Fma.IsSupported
  • Avx2.IsSupported
  • Avx512F.IsSupported
  • Avx512F+VL.IsSupported
  • Avx512BW.IsSupported
  • Avx512BW+VL.IsSupported
  • Avx512CD.IsSupported
  • Avx512CD+VL.IsSupported
  • Avx512DQ.IsSupported
  • Avx512DQ+VL.IsSupported
  • Avx512F.IsSupported
  • Avx512F+VL.IsSupported
  • Avx512BW.IsSupported
  • Avx512BW+VL.IsSupported
  • Avx512CD.IsSupported
  • Avx512CD+VL.IsSupported
  • Avx512DQ.IsSupported
  • Avx512DQ+VL.IsSupported
  • Vector256.IsHardwareAccelerated
  • Vector512.IsHardwareAccelerated
  • Vector<byte>.Count == 32 when Avx2 is supported
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jun 2, 2023
@ghost
Copy link

ghost commented Jun 2, 2023

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

Issue Details

#86486 expanded the validation done for the various Isa.IsSupported flags exposed by the JIT.

Mono failed this test with the following:

System.Runtime.Intrinsics.X86.Sse.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Sse2.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Aes.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Pclmulqdq.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Sse3.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Ssse3.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Sse41.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Sse42.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Avx.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Fma.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx2.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Bmi1.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Bmi2.IsSupported returned a different result when called via reflection
System.Runtime.Intrinsics.X86.Avx512F.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512F+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512BW.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512BW+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512CD.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512CD+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512DQ.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512DQ+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512F.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512F+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512BW.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512BW+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512CD.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512CD+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512DQ.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.X86.Avx512DQ+VL.IsSupported returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.Vector128.IsHardwareAccelerated returned a different result when called via reflection
System.Runtime.Intrinsics.Vector256.IsHardwareAccelerated returned false but the hardware and runtime returned true
System.Runtime.Intrinsics.Vector512.IsHardwareAccelerated returned false but the hardware and runtime returned true
System.Numerics.Vector.Count returned 16 but the hardware returned 32

In particular, it exposes that while several ISAs are supported by Mono, the recursive call is not being properly handled for:

  • Sse.IsSupported
  • Sse2.IsSupported
  • Aes.IsSupported
  • Pclmulqdq.IsSupported
  • Sse3.IsSupported
  • Ssse3.IsSupported
  • Sse41.IsSupported
  • Sse42.IsSupported
  • Bmi1.IsSupported
  • Bmi2.IsSupported
  • Vector128.IsHardwareAccelerated

It also highlights the following ISAs which aren't yet supported by Mono. This is not a bug in Mono, just represents work that is yet to be completed and for which the test would need a corresponding check to account for the behavior difference. We do not, however, have a trivial way to check at runtime if we are on RyuJIT or Mono:

  • Avx.IsSupported
  • Fma.IsSupported
  • Avx2.IsSupported
  • Avx512F.IsSupported
  • Avx512F+VL.IsSupported
  • Avx512BW.IsSupported
  • Avx512BW+VL.IsSupported
  • Avx512CD.IsSupported
  • Avx512CD+VL.IsSupported
  • Avx512DQ.IsSupported
  • Avx512DQ+VL.IsSupported
  • Avx512F.IsSupported
  • Avx512F+VL.IsSupported
  • Avx512BW.IsSupported
  • Avx512BW+VL.IsSupported
  • Avx512CD.IsSupported
  • Avx512CD+VL.IsSupported
  • Avx512DQ.IsSupported
  • Avx512DQ+VL.IsSupported
  • Vector256.IsHardwareAccelerated
  • Vector512.IsHardwareAccelerated
  • Vector<byte>.Count == 32 when Avx2 is supported
Author: tannergooding
Assignees: -
Labels:

area-System.Runtime.Intrinsics, untriaged

Milestone: -

@jandupej jandupej self-assigned this Jun 2, 2023
@jandupej jandupej removed the untriaged New issue has not been triaged by the area owner label Jun 2, 2023
@teo-tsirpanis
Copy link
Contributor

@jandupej can you add a milestone? If you do so the bot will remove the untriaged label automatically.

@SamMonoRT
Copy link
Member

Moving to 9.0

@SamMonoRT SamMonoRT modified the milestones: 8.0.0, 9.0.0 Aug 10, 2023
@SamMonoRT SamMonoRT assigned fanyang-mono and unassigned jandupej Oct 25, 2023
@steveisok
Copy link
Member

I do think this is important to fix, so I'm going to play the milestone game one more time and move this to 10.

@steveisok steveisok modified the milestones: 9.0.0, 10.0.0 Aug 5, 2024
@fanyang-mono fanyang-mono removed their assignment Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants