-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
arch/arm/stm32h7: Add lazy FPU for STM32H7 ARMV7 single core chips #15876
base: master
Are you sure you want to change the base?
Conversation
Introduces LAZYFPU by enabling LSPEN and ASPEN for lazy stacking and automatic state preservation. FPU registers are no longer stored in XCPT registers (HW and SW) if LAZY FPU is enabled. Signed-off-by: Matteo Golin <[email protected]>
[Experimental Bot, please feedback here] This PR does not fully meet the NuttX requirements yet, specifically in the Testing section. While the testing logs before the change are provided, the logs after the change are missing, replaced with "tbd, currently crashes". This indicates the change introduced a critical bug and is not ready to be merged. Here's a breakdown of what needs to be addressed:
In short, this PR needs further work and testing before it can be merged. The primary focus should be on resolving the crash and then providing comprehensive testing data demonstrating the benefits of the LAZYFPU implementation. |
/* Enable lazy stacking (LSPEN) and automatic state preservation (ASPEN). | ||
*/ | ||
|
||
regval = getreg32(NVIC_FPCCR); |
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.
can we use one arm_fpuconfig but add #ifdef/#else/#endif into the code fragment?
@linguini1 nice work!!! I was expecting it involved more assembly code, nice to know it is mostly register bits config. |
Oh it will, I believe I have to modify some context switching assembly. This is not complete yet. |
Summary
Introduces LAZYFPU by enabling LSPEN and ASPEN for lazy stacking and automatic state preservation. FPU registers are no longer stored in XCPT registers (HW and SW) if LAZY FPU is enabled.
Discussed in #15826
Impact
This reduces context switching overhead in some contexts where the FPU is used. This feature is implemented for all ARMv7-M chips, however I have only added
select ARCH_HAVE_LAZYFPU
for the STM32H7 chips that are single ARMv7-M cores as I do not have an exhaustive list of all ARMv7-M chips to test on.Testing
Performed on an STM32H743 chip. I have increased the number of FPU loops to 25 and reduced the FPU thread stack size to 2048.
Here is the results of
ostest
when LAZYFPU is disabled:Here is the results of
ostest
when LAZYFPU is enabled:tbd, currently crashes