Skip to content

Conversation

lewing
Copy link
Member

@lewing lewing commented May 10, 2025

based on #103915 should now avoid the regressions in dotnet/perf-autofiling-issues#36484 because wasm handles BitCast of vector types in AOT and interpreter now. Mono JIT/AOT 32bit platforms other than wasm still don't have an simd intrinsic path in bitcast but I'm not sure if that matters.

Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

@lewing

This comment was marked as outdated.

@lewing
Copy link
Member Author

lewing commented Jun 2, 2025

this will also help reduce the impact of #116221

@lewing
Copy link
Member Author

lewing commented Jun 2, 2025

@kg @BrzVlad I'm happy to finish this up if I can get some guidance on the correct direction.

@lewing lewing marked this pull request as ready for review July 9, 2025 15:34
@lewing
Copy link
Member Author

lewing commented Jul 10, 2025

The failure in windows minijit is preexisting n BitCast, #109345 I'll take a look but may mark it as known

@lewing
Copy link
Member Author

lewing commented Jul 10, 2025

The failure in windows minijit is preexisting n BitCast, #109345 I'll take a look but may mark it as known

I've disabled the jit intrinsic for the already failing case.

@lewing lewing enabled auto-merge (squash) July 10, 2025 20:52
@lewing lewing requested a review from Copilot July 10, 2025 22:30
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements interpreter support for BitConverter and Unsafe.BitCast intrinsics in Mono, unifies As<TFrom,TTo> methods to use Unsafe.BitCast, and re-enables previously excluded hardware intrinsic tests.

  • Added interpreter-side handling for DoubleToInt64Bits, Int32BitsToSingle, BitCast, etc.
  • Removed Mono-specific #if MONO branches and consolidated all vector As<TFrom,TTo> to expression-bodied Unsafe.BitCast.
  • Dropped exclusions and ActiveIssue attributes for Vector128/256/512 hardware intrinsic tests so they now run.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/tests/issues.targets Removed exclusion lists for Vector128/256/512 hardware intrinsic tests
src/tests/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs Removed ActiveIssue attribute
src/tests/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs Removed ActiveIssue attribute
src/mono/mono/mini/intrinsics.c Added skip for SIMD bitcast on Windows x64 when not using LLVM
src/mono/mono/mini/interp/transform.c Implemented interpreter handling for BitConverter.*Bits and Unsafe.BitCast
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs Always use Unsafe.BitCast in Vector64.As<TFrom,TTo>
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs Always use Unsafe.BitCast in Vector128.As<TFrom,TTo>
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs Always use Unsafe.BitCast in Vector256.As<TFrom,TTo>
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512.cs Always use Unsafe.BitCast in Vector512.As<TFrom,TTo>
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.Numerics.cs Simplified AsPlane/AsQuaternion methods to expression-bodied Unsafe.BitCast
src/libraries/System.Private.CoreLib/src/System/Numerics/Vector4.Extensions.cs Simplified extension methods to expression-bodied Unsafe.BitCast
src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs Always use Unsafe.BitCast in Vector.As<TFrom,TTo>
src/libraries/System.Private.CoreLib/src/System/Numerics/Quaternion.Extensions.cs Simplified AsVector4 to expression-bodied Unsafe.BitCast
src/libraries/System.Private.CoreLib/src/System/Numerics/Plane.Extensions.cs Simplified AsVector4 to expression-bodied Unsafe.BitCast

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants