-
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
Investigate what would be required to move some SIMD functionality out of the JIT and into managed code #102275
Comments
Tagging subscribers to this area: @dotnet/area-system-numerics |
In an ideal world, we would be able to remove the entirety of |
CC. @EgorBo |
I fully support this 🙂 |
I've assigned myself for the time being, but likely won't get to this until after we snap for .NET 9 RC1 and main opens for .NET 10 If someone else has some time to work on prototyping this sooner, please reach out and we can see about getting it assigned out instead. |
The prototype overall looked good, however I'm going to block the work on #11062 being resolved as the risk is too high otherwise. -- Not being intrinsic means inlining has to happen which means various constants can't be seen as constant until post import when various other optimizations (like forward sub, constant prop, etc) have happened. This really hurts a number of common existing code patterns and will regress user workloads. There's some other aspects that likely should be investigated more as well, such as the overhead of the JIT needing to do more work (more inlining, more optimizations) to make things generate the same code and therefore likely reducing the throughput and increasing overhead of the JIT. But, I think those aspects do not need to be blocked on and can instead be handled incrementally. |
As described in #11062 (comment), we have support for rewriting some nodes (GT_INTRINSIC) back into a call as part of rationalization (the final step before lowering). This works fine when all inputs and return types are primitive. However, the support does not currently exist to do the more complex fixups and ABI handling that would be required to convert a |
I took another look at allowing The big things to note are that such signatures require us to re-resolve the However, what's not handled is the ABI handling for Refactoring the last stuff to not be Also worth noting that for input args it wasn't entirely clear whether |
Closing this. The investigation was done and it was decided that while non-core types like .NET 9 has correspondingly moved the implementation of types like |
Historically a number of types (such as
Vector2
,Vector3
, andVector4
) have had their functionality implemented asIntrinsic
in the JIT. This was done for many reasons, but primarily for performance of these types that are known to be used in perf critical workloads since the JIT needed to generate specialized instructions that were otherwise not accessible.Since then, we've had a broad range of support exposed around platform specific hardware intrinsic APIs and it is now possible to implement many of these other APIs purely in managed code. However, this has not been done due to concerns that it may regress perf. This concern is particularly relevant in complex algorithms where the inliner may decide that it is out of budget and no longer tries to optimize this code.
It would be beneficial to actually prototype the work of moving some of these implementations out of the JIT and purely into managed code. This should let us see what in the JIT may still be getting pessimized and work towards fixing it. The long term benefits of moving the complexity into managed are then substantial:
The text was updated successfully, but these errors were encountered: