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.7k forks source link

Investigate and implement better codegen for Matrix4x4 #9420

Open eerhardt opened 6 years ago

eerhardt commented 6 years ago

Using Matrix4x4 by value methods are significantly slower than using corresponding ref overloads. See https://github.com/dotnet/corefx/pull/25388#issuecomment-348360835.

We've rejected adding these ref overloads to System.Numerics.Vectors to avoid API clutter and because the performance benefit of the ref overloads is not significant.

However, the benchmarks showed a benefit for Matrix4x4. We should investigate how much of the Matrix4x4ByRef benefit can be matched with better codegen for the ByValue case. And then implement any improvements.

cc @CarolEidt

category:cq theme:vector-codegen skill-level:expert cost:medium

BruceForstall commented 1 year ago

@tannergooding comments?

tannergooding commented 1 year ago

I think this isn't really a codegen issue, rather a library issue.

We need to update the code paths to use intrinsics, where possible, and to be more explicit about inlining.

The JIT is already doing better inlining and better follows the underlying ABIs where possible.