-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
ARM64 Vector2 multiplication breaks in .NET 8 #98137
Comments
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsDescriptionOn Linux and MacOS, various Vector2 floating point multiplications break after running for a few hundred milliseconds. Running this code in Release Mode on a using System.Numerics;
while (true)
{
Thread.Sleep(10);
Step(4.0f);
}
static void Step(float number)
{
var variable = Vector2.One * number;
if (variable.X != variable.Y)
throw new Exception("Components don't match");
} This does not occur in Debug Mode. If I don't wrap the code in a function ( Reproduction StepsSimply create a new console project in .NET 8 and run the above code in Program.cs with Expected behaviorMultiplication should always result in <4,4> Actual behaviorMultiplication results in <4,0> after several hundred milliseconds Regression?Does not occur in .NET 7, only .NET 8 Known WorkaroundsNo response Configuration.NET 8, ARM64, MacOS (have had reports of this same problem on ARM64 Linux) Other informationThis has been an issue found in our open source game Celeste 64 for users running the game on ARM64 for both MacOS and Linux. I personally have only tested on MacOS.
|
@tannergooding could you help triaging this? |
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsDescriptionOn Linux and MacOS, various Vector2 floating point multiplications break after running for a few hundred milliseconds. Running this code in Release Mode on a using System.Numerics;
while (true)
{
Thread.Sleep(10);
Step(4.0f);
}
static void Step(float number)
{
var variable = Vector2.One * number;
if (variable.X != variable.Y)
throw new Exception("Components don't match");
Console.WriteLine(variable);
} This does not occur in Debug Mode. If I don't wrap the code in a function ( Reproduction StepsSimply create a new console project in .NET 8 and run the above code in Program.cs with Expected behaviorMultiplication should always result in <4,4> Actual behaviorMultiplication results in <4,0> after several hundred milliseconds Regression?Does not occur in .NET 7, only .NET 8 Known WorkaroundsNo response Configuration.NET 8, ARM64, MacOS (have had reports of this same problem on ARM64 Linux) Other informationThis has been an issue found in our open source game Celeste 64 for users running the game on ARM64 for both MacOS and Linux. I personally have only tested on MacOS.
|
This was fixed by @jakobbotsch in .NET 9 via #94413, which was fixing a different issue caused by the types of op1/op2 mismatching for MultiplyByScalar (one is a The simple fix should be backporting this PR to .NET 8. Independently, we should ensure an issue exists to ensure constant folding does work for this scenario and that the correctly typed operand is selected. |
That PR fixed the type mismatch but also deliberately this particular issue, which I noticed while working on the other one (#94413 (comment)). |
can confirm running the testcase results in an exception after 77 iterations on arm64 linux |
The fix is available in the current .NET 8 release. |
Description
On Linux and MacOS, various Vector2 floating point multiplications break after running for a few hundred milliseconds.
Running this code in Release Mode on a
dotnet new console
application on ARM64 results in the Y component of the vector being zero.This does not occur in Debug Mode. If I don't wrap the code in a function (
Step
) it doesn't seem to happen. If I hard code the floating value (Vector2.One * 4.0f
) it doesn't seem to happen.Reproduction Steps
Simply create a new console project in .NET 8 and run the above code in Program.cs with
dotnet run -c Release
. After running for a few hundred milliseconds the application will throw an exception.Expected behavior
Multiplication should always result in <4,4>
Actual behavior
Multiplication results in <4,0> after several hundred milliseconds
Regression?
Does not occur in .NET 7, only .NET 8
Known Workarounds
No response
Configuration
.NET 8, ARM64, MacOS (have had reports of this same problem on ARM64 Linux)
Other information
This has been an issue found in our open source game Celeste 64 for users running the game on ARM64 for both MacOS and Linux. I personally have only tested on MacOS.
The text was updated successfully, but these errors were encountered: