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
CONFIG_FLOAT/CONFIG_FP_SHARING descriptions are confusing and contradictory #14122
Comments
CONFIG_FLOAT enables the FPU, but only one thread max is allowed to use it as the floating point registers are ignored by the context switching code. CONFIG_FP_SHARING implements logic in the context switching code to save/restore fpu registers when threads are swapped in and out. |
@andrewboie: Thanks for clarification, I guess I can prepare Kconfig help update out od that then.
Well, perhaps you could clarify: is it the main thread is allowed to use FP, or any thread at all on the "first grab, now mine" basis? |
It doesn't matter which thread. Only that just a single one can use it. |
Also, and I think this may be architecture-dependent, but if the calling convention treats all floating point registers as volatile, then multiple threads can use the FPU with CONFIG_FP_SHARING disabled if and only if they are all of cooperative priority. |
Thanks, that's surely not for docs, but nice to know that there people who know/remember/can share such details. Related, what me got to this ticket is looking for a good test for float functionality. And I find it "interesting" the fact that none of samples/* has CONFIG_FLOAT enabled (while a number has OMG, and now I finally got it, CONFIG_FLOAT enables hardware FP. Not the best name for such an option, I'd say. |
And yet, for qemu_x86 CONFIG_FLOAT=n and yet using
|
While for qemu_cortex_m3 it's ok. |
I agree that "use the floating point registers" is not clearly enough stating that this enables the FPU. Also, I agree that it should be explicitly stated, and not just implied, that NOT CONFIG_FLOAT enables soft float. qemu_x86 crashing when 'float' is used and NOT CONFIG_FLOAT is a bug/unexpected. |
The text for floating point has been re-worked recently, in-line with what @andrewboie is suggesting here. IMHO it is clear that CONFIG_FLOAT allows for un-shared FP registers mode, while additional FP_SHARING allows for shared FP registers mode. @pfalcon could you please, check if you could close this bug? (Or at least turn this into an enhancement) :) |
@pfalcon could you re-visit the documentation and comment if this issue described here still applies? |
@pfalcon ping |
no response. |
I think phrasing could be improved here to say something like:
|
@stephanosio: That might clarify it indeed. Please see if anything like that fits the scope of your #24636 (well, now that you touch that area at all). (And if not, it's fully ok.) |
Addressed in #24636. |
https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_FLOAT.html
https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_FP_SHARING.html
The first says:
Isn't these 2 sentences contradict each other?
Now comparing 1st and 2nd doc:
So, one option allows threads to use FP registers, and another allows multiple threads to use FP registers. But "threads" are already "multiple threads".
cc: @dbkinder for the help with wording, but I guess @nashif or another core maintainer first should confirm how those options are supposed to work.
The text was updated successfully, but these errors were encountered: