-
Notifications
You must be signed in to change notification settings - Fork 176
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
perf: Try fast pow for EigenStepper
step size scaling
#3153
perf: Try fast pow for EigenStepper
step size scaling
#3153
Conversation
EigenStepper
step scalingEigenStepper
step size scaling
Since we are clamping anyway, we could look at the representation of so we want to end up with a number in the range we could then construct the function using
Even with the other technique, it might be useful to do the clamping before. |
📊: Physics performance monitoring for 441aa99physmon summary
|
Apparently
I suspect the reason for higher performance when removing the second scaling is that our current scaling strategy increases and decreases the step size periodically which results in a lot of attempted steps and possibly mispredicted branches. I will make the function selection configurable for now. |
EigenStepper
step size scalingEigenStepper
step size scaling
Co-authored-by: Alexander J. Pfleger <[email protected]>
…#3153) Currently the step scaling calculation has a big impact on the `EigenStepper` performance. In this PR the `pow(x, 0.25)` is approximated with `fastPow` (similar to fast inverse square root) which relies on the bit representation of the floating point number. The assumption is that we do not really care about the precision of this value but rather that it gives a good approximation for the step size scaling. Edit: After measuring the performance it seems like there is no measurable improvement. I made this approximation compile time optional for now. See this acts-project#3153 (comment) for more details <img width="577" alt="image" src="https://github.com/acts-project/acts/assets/487211/d613caeb-991f-4a89-98fc-bc051be13b7b"> References - https://martin.ankerl.com/2012/01/25/optimized-approximative-pow-in-c-and-cpp
…#3153) Currently the step scaling calculation has a big impact on the `EigenStepper` performance. In this PR the `pow(x, 0.25)` is approximated with `fastPow` (similar to fast inverse square root) which relies on the bit representation of the floating point number. The assumption is that we do not really care about the precision of this value but rather that it gives a good approximation for the step size scaling. Edit: After measuring the performance it seems like there is no measurable improvement. I made this approximation compile time optional for now. See this acts-project#3153 (comment) for more details <img width="577" alt="image" src="https://github.com/acts-project/acts/assets/487211/d613caeb-991f-4a89-98fc-bc051be13b7b"> References - https://martin.ankerl.com/2012/01/25/optimized-approximative-pow-in-c-and-cpp
Currently the step scaling calculation has a big impact on the
EigenStepper
performance. In this PR thepow(x, 0.25)
is approximated withfastPow
(similar to fast inverse square root) which relies on the bit representation of the floating point number.The assumption is that we do not really care about the precision of this value but rather that it gives a good approximation for the step size scaling.
Edit: After measuring the performance it seems like there is no measurable improvement. I made this approximation compile time optional for now. See this #3153 (comment) for more details
References