-
Notifications
You must be signed in to change notification settings - Fork 138
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
Future direction of SoftFloat and its development model #5
Comments
The original version of SoftFloat was created to provide IEEE-compliant floating-point operations to a research processor that had no hardware floating-point. The specific processor at the time was Krste Asanovic's Ph.D. project, T0, which was developed in the 1990s at the International Computer Science Institute (ICSI). (Although it's a separate organization, ICSI has always had close ties to the Computer Science Division at the University of California, Berkeley.) After some cleaning and the addition of documentation, the C source code was released in the hope that it might be useful to others. Up until now, it has never been a goal of SoftFloat to provide the ability to simulate every aspect of any actual floating-point hardware, past or present. The main goal has always been simply to provide IEEE floating-point where there is none in hardware. SoftFloat also exists to support the companion TestFloat program, which can be used for testing a new floating-point implementation. From our perspective, SoftFloat has mainly been forward-looking, not backward-looking. Real floating-point implementations often include non-standard or non-required options that software rarely if ever needs, such as the ability to call a trap handler on exceptions or to flush underflows to zero. As a general rule, we haven't supported rarely used features in SoftFloat when we believe they're impractical for future hardware or needn't be encouraged. Note the difference: While one might not want to encourage the 80-bit double-extended-precision format either, it's in SoftFloat because its use was far from rare a decade ago. There are also some unorthodox features in SoftFloat such as the "odd" rounding mode, but those are there usually because we believe the features are useful and we more-or-less encourage their widespread adoption.
SoftFloat remains in active development, only very slowly right now. Historically, the only significant contributor to SoftFloat has been myself. Due to other projects and obligations, for this year and the
Yes, maybe, eventually.... Prof. Asanovic, who oversees the funding for this project, says he's happy to consider opening up SoftFloat to the community. The obstacles for the moment start with the fact that a community project should really attempt to have community input and agreement about such things as what features to have and what the function interfaces should be, and maybe how to subdivide SoftFloat into various "silos" for different classes of users. That all involves some time and effort. Prof. Asanovic is currently looking for somebody to manage SoftFloat as a community project, someone with the requisite skills who can commit more time than I'm personally willing to offer. In the meantime, you have me. I accept suggestions, but I'm afraid you shouldn't expect fast turnaround, nor can I promise a significant change of focus for SoftFloat from what I described above.
In practice, the repository currently is used by other Berkeley projects, but it's not directly open to outside patches. Things posted at GitHub are read and considered as time permits. |
The possibility of passing a context structure into each SoftFloat arithmetic function was considered at one time, but we decided on a different solution for a combination of reasons. We believe that some uses of SoftFloat want to make many calls to SoftFloat arithmetic functions without any swapping of the context between them, while other uses need to establish a selected context before each arithmetic function call and save any context changes after each call. Certain differences between these scenarios were expected:
Because SoftFloat's context for most floating-point formats is small, consisting only of a rounding mode, the exception flags, and maybe (rarely) the tininess detection mode, it was decided that applications of the second kind could afford to call SoftFloat functions with this sequence:
This works fine as long as SoftFloat calls are made from only a single thread. To support calls from multiple threads, Release 3b added the option to define the SoftFloat mode and exception flag variables as "thread local" (using |
This patch adds preprocessor facilities to enable choosing between global state (SoftFloatv3 default) and adding a "state" parameter to all functions. This has been discussed already by John Hauser at: ucb-bar#5 This patch takes the position of enabling both options using a preprocessor macro named "SOFTFLOAT_USE_GLOBAL_STATE". If the macro is defined, then it uses global state as it does already. If the macro is undefined, then it adds a state parameter which is a struct defined in softfloat_types.h
This patch adds preprocessor facilities to enable choosing between global state (SoftFloatv3 default) and adding a "state" parameter to all functions. This has been discussed already by John Hauser at: ucb-bar#5 This patch takes the position of enabling both options using a preprocessor macro named "SOFTFLOAT_USE_GLOBAL_STATE". If the macro is defined, then it uses global state as it does already. If the macro is undefined, then it adds a state parameter which is a struct defined in softfloat_types.h
I made a pull request (#13 ) that makes the choice of global state vs. per-function-parameter configurable at compile-time. This is useful in projects where, for example, the use of global variables is not permitted. |
This patch adds preprocessor facilities to enable choosing between global state (SoftFloatv3 default) and adding a "state" parameter to all functions. This has been discussed already by John Hauser at: ucb-bar#5 This patch takes the position of enabling both options using a preprocessor macro named "SOFTFLOAT_USE_GLOBAL_STATE". If the macro is defined, then it uses global state as it does already. If the macro is undefined, then it adds a state parameter which is a struct defined in softfloat_types.h
This patch adds preprocessor facilities to enable choosing between global state (SoftFloatv3 default) and adding a "state" parameter to all functions. This has been discussed already by John Hauser at: ucb-bar#5 This patch takes the position of enabling both options using a preprocessor macro named "SOFTFLOAT_USE_GLOBAL_STATE". If the macro is defined, then it uses global state as it does already. If the macro is undefined, then it adds a state parameter which is a struct defined in softfloat_types.h
This patch adds preprocessor facilities to enable choosing between global state (SoftFloatv3 default) and adding a "state" parameter to all functions. This has been discussed already by John Hauser at: ucb-bar#5 This patch takes the position of enabling both options using a preprocessor macro named "SOFTFLOAT_USE_GLOBAL_STATE". If the macro is defined, then it uses global state as it does already. If the macro is undefined, then it adds a state parameter which is a struct defined in softfloat_types.h
The QEMU project makes extensive use of SoftFloat to model floating point instructions. The source in QEMU's tree is based on SoftFloat2a due to later incompatibilities in the licensing. It has also seen a number of additions over time including specialisation for the various architectures we emulate. Perhaps the biggest one being augmenting the API to pass *float_status to the various operations. This needed to be done as the CPUs we emulate often have different FPU contexts so the floating point flags shouldn't interfere with each other.
As time has moved on and more recent processor revisions require additional features from later revisions of IEE754 we are faced with a dilemma of how to move forward. We can either keep adding features to our copy of 2a or instead port our code to use 3c and it track its future development. However given our extensive changes this doesn't make sense if our internal copy is going to have to be significantly modified and diverge again from the upstream. So this leads to a couple of questions:
The text was updated successfully, but these errors were encountered: