-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Vector128.Create regression on .NET 5 #44704
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Workaround for .NET5: Vector128<int> test = Vector128.Create(p.Value0,p.Value1,p.Value2,p.Value3);
// don't use calls as arguments for Vector_.Create directly and introduce temp variables instead:
var v0 = p.Value0;
var v1 = p.Value1;
var v2 = p.Value2;
var v3 = p.Value3;
Vector128<int> test = Vector128.Create(v0,v1,v2,v3); |
That is a better looking workaround that what I did, might give it a shot 👍 |
* infra: Migrate to .NET 5 This migrate projects and CI to .NET 5 * Remove language version restrictions (now on 9.0 by default) * infra: pin .NET 5 to avoid later issues * infra: Cleanup csproj files * infra: update dependencies * infra: Add temporary workaround for a bug in Vector128.Create see dotnet/runtime#44704 for more informations
@Thog Please let us know how the workaround goes. |
Yes, the workaround I posted in #44704 (comment) works for the original repro #44704 (comment)
|
I ended up not using the solution proposed by @EgorBo and kept the original workaround @gdkchan made when hitting the issue: |
Closing as dup of #43569. Fix will be in 5.0.1. |
* infra: Migrate to .NET 5 This migrate projects and CI to .NET 5 * Remove language version restrictions (now on 9.0 by default) * infra: pin .NET 5 to avoid later issues * infra: Cleanup csproj files * infra: update dependencies * infra: Add temporary workaround for a bug in Vector128.Create see dotnet/runtime#44704 for more informations
Description
Vector128.Create
is not inserting the correct elements into the vector in some cases on .NET 5. The issue can be reproduced with the code below:It should always print 10 since 1 + 2 + 3 + 4 = 10, however when running in release mode on .NET 5, it starts printing 9 after a few iterations. This issue only happens in release mode, and only on .NET 5, it works properly on .NET Core 3.1 (I did not try older versions).
Configuration
Tested on .NET 5.0.100, OS Windows 10 x64, 9th generation Core i7 x64 CPU. I don't know if it's specific to this configuration as I didn't try on any other OS or machine yet.
Regression?
It worked properly on .NET Core 3.1, I did not try versions older than that.
Other information
One possible workaround is disabling optimizations for the method using the
[MethodImpl(MethodImplOptions.NoOptimization)]
attribute, but that has performance impact so it's not ideal.The text was updated successfully, but these errors were encountered: