dotnet / runtime

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

Arm64 SVE: Size of vector is always 128bits #101433

Open a74nh opened 5 months ago

a74nh commented 5 months ago

When using the SVE API, Unsafe.SizeOf on a vector always return 128bits.

Instead, the value should return the current vector length of the machine. For example, Neoverse N2 has 128bits, whereas Neoverse V1 has 256bits.

There are quite a few places within the jit that make 128bit assumptions. These need to instead use the current vector length.

Once merged, https://github.com/dotnet/runtime/pull/101295 will by default set the vector length of the machine to 128bits. This needs partially reverting so that the default option is to not change the current setting.

When all the above is fixed, all the of HardwareIntrinsics_Arm tests should pass on a Neoverse V1.

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

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

EgorBo commented 5 months ago

For example, Neoverse N2 has 128bits, whereas Neoverse N2 has 256bits.

I presume you meant Neoverse V2 has 256bits

a74nh commented 5 months ago

For example, Neoverse N2 has 128bits, whereas Neoverse N2 has 256bits.

I presume you meant Neoverse V2 has 256bit

V1. Updated above.