-
Notifications
You must be signed in to change notification settings - Fork 78
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
✨ [FEATURE REQUEST] Hardware Accelerated Square Root #733
Comments
You're asking to set |
Why not? Does pros use errno in a lot of places? |
PROS doesn't but something like Eigen might. I've discussed this with @djava and he's convinced me this is not the route to take |
👍 |
@Rocky14683 has this been completed? I didn't see a commit to PROS which implements this |
i thought u said its not the route to take |
Sorry, I should have been more specific. While we can't use |
Re @SizzinSeal
Doesn't newlib already do this? https://github.com/bminor/newlib/blob/363357c023ce01e936bdaedf0f479292a8fa4e0f/newlib/libm/machine/arm/e_sqrt.c#L30-L41 |
Perhaps it does after the libm update PR. I've only analyzed binaries created using PROS 4.1.1, I'll find out |
Requested Feature
Hardware accelerated square root through. The Cortex A9 on the V5 Brain has instructions to compute the square root of floating-point numbers through the VSQRT instruction.
Current Implementation
Currently, GCC uses the sqrt implementation of libm which does not make use of this instruction.
Motivation
Computing the square root of a floating-point number is an expensive operation. With the use of more expensive algorithms like live-regenerating motion profiling and Monte Carlo Localization on the rise in VRC, it makes sense to get the V5 to perform as well as it possibly can. The better it performs, the less PROS users have to worry about performance limitations.
Features of
VSQRT
Why doesn't GCC use this instruction automatically?
libm uses errno. Yup, that simple. GCC can't inline VSQRT because it does not set errno. This would be solved with
-fno-math-errno
but this is a bad idea because libraries like Eigen may check errno. Instead, libm functions would need to be overridden.Possible implementations
We can override the
sqrt
provided by libm with a custom implementation that uses theVSQRT
instruction, but also sets errno.The text was updated successfully, but these errors were encountered: