-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Performance regression with System.Numerics.Vector when retargeting from .NET 8 to .NET 9 #110223
Comments
Tagging subscribers to this area: @dotnet/area-system-numerics |
The issue here is "by design" and comes about from needing to ensure Here is the results on my machine:
And for comparison, here is the results when using
The TensorPrimitives.Subtract(one, another, workspace);
- var index = TensorPrimitives.IndexOfMaxMagnitude(workspace);
- return MathF.Abs(workspace[index]);
+ return MathF.Abs(TensorPrimitives.MaxMagnitude(workspace));
|
Thanks! By the way, on my machine I don't observe
Yes, would be nice to have it in .NET as one more variant ( |
We're observing performance regression when retargeting one of our apps from .NET 8 to .NET 9.
This is the same app with which we observed performance regression one year ago: switching from .NET 7 to .NET 8 then. (For more information about that case, see #94920)
The core calculation is to find the maximum absolute of element-wise difference of two
float
arrays.The attached test app (with benchmarks) does that in four ways:
Vector<float>
: both safe and unsafe way to instantiate a vectorTensorPrimitives
for
loopPerformanceRegression.zip
As a year ago, the regression seems to concern
System.Numerics.Vector
usage.The benchmark results are as follows:
Somehow in .NET 9, the difference between a
for
loop and vectorized code is not as large as one would expect./cc: @tannergooding
The text was updated successfully, but these errors were encountered: