- Notifications
You must be signed in to change notification settings - Fork 5.2k
Clean up some of the math intrinsic logic and support constant folding #47321
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
Conversation
| I broke this up by commit to make it easier to review. No diffs for Local tests for scenarios like |
src/coreclr/jit/valuenum.cpp Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be "nice" if these could call COMDouble::Acos, etc. However I think that's difficult due to layering and it wasn't obvious what would be needed to make that happen.
| CC. @jkotas, @briansull, @dotnet/jit-contrib |
…Single and COMDouble types
…ed on IsTargetIntrinsic
| Rebased to pick up unrelated test fixes so CI will pass again |
| The non-JIT part of change looks good to me. |
| @briansull can you take a look at the jit changes? |
briansull left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed the JIT changes, Looks good
| Hello @tannergooding! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me ( |
| Thanks for the reviews! |
This cleans up the
NI_System_Math_*related logic to make it easier to determine what entries were being missed by alphabetizing the IDs and adding an assert for the range.As part of that, this ensures all the existing public Math "intrinsic" APIs (minus
FusedMultiplyAddandSinCos, which have special requirements) are going through CSE and enables constant folding for them whenIsReadyToRunis false.This was done under the premise that, for a given run these APIs are deterministic and it is only harmful to constant fold in AOT like scenarios where the CRT used to compile and that which is being run against might differ.
The PMI diffs for
--frameworksshows some minimal gains:The win in
System.Speechis due to a call being inlined:The regression in
System.Runtime.Numericslooks to be becauseLogwas not previously CSE'd and so now there is a new temp introduced:It isn't exactly clear why this is needed for this scenario, particularly when the value isn't reused again elsewhere (the managed code is: https://source.dot.net/#System.Runtime.Numerics/System/Numerics/Complex.cs,594)
We see larger gains in
--benchmarks, this time constant folding methods likeExpdue to values that are constant post inlining: