Michael Meissner
2018-10-25 21:24:48 UTC
(note, I did not include all of the Fortran maintainers on the initial To list,
but feel free to speak up as well).
Thomas, as we talked about at the Cauldron, the Power9 processors now have
direct support for IEEE 128-bit floating point. However, we already have a
long double/real*16 type on PowerPC (IBM extended double, which is a pair of
doubles), and it has been a long struggle to get the base compiler and GLIBC to
support switching the C language. At the moment, the compiler middle/back end,
C/C++ front ends are mostly done, and GLIBC is being worked on.
Jonathan Wakely and others are now working on making the libstdc++ libraries
able to support either long double type, using different function names via
name mangling for the two types.
So with the GLIBC work progressing, it is time to start thinking about how we
can move fortran's real*16 to use the IEEE 128-bit type.
There are two basic methods that I know about:
1) Wait for a distro to move, and fortran (in theory) should pick up all
of the changes for free, but that can take awhile;
2) Add support within fortran to change the name used for real*16 support
functions, and provide both functions in the library (this is what C++
is doing).
I realize that presumably like every other project, you have more work to do
than you have bodies doing the work, and it is a matter of setting the
priorities.
As we discussed, while the majority of the codes are probably real*4 or real*8,
there some codes that want/need to use higher precision (real*10 on Intel/AMD,
real*16 on PowerPC). I don't have a handle on how big the propulation is that
wants to use higher precision values on PowerPC systems.
I just recently put in a patch to the rs6000 backend that switches the names of
the math built-in functions if the compiler was configured for IBM extended
double and the user asked for IEEE 128-bit floating point, and this will work
for fortran also. But as I was looking at the compiler and library, I realized
there is a lot of code for the library support functions, and these need to be
addressed as well.
We talked about me providing a patch to switch the libquad math functions to
the GLIBC f128 functions, and after I implemented it, I realized that we never
call the libquad math functions in PowerPC, because of IBM extended double (and
there can only be one float type of a given size, which has made implement the
IEEE 128-bit support so much 'fun').
If we did call libquadmath, it would have been useful to switch to GLIBC's f128
math functions, since these functions are being heavily optimized. In
addition, if you use recent Advance Toolchain releases, AT will load up a
shared library compiled specifically for power9, which generates the native
instructions instead of calling through a PLT to get either software emulation
or the hardware instruction.
We (IBM) are in the process of setting up a power9 system in the compile farm,
so if people wanted to start actually trying things out, they will be able to.
I wanted to start a dialog on what we see as the next steps, and how willing
was Fortran going to be to support users that want/need to use the IEEE 128-bit
type, and are willing to act as guinea pigs as we modify the libraries to
support the switching (before a distro changes the defaults).
At this point, I don't know the scope of the work, and whether it is fairly
simple and might be able to be slipped into GCC 9 or if it is more complex and
needs to wait until GCC 10.
but feel free to speak up as well).
Thomas, as we talked about at the Cauldron, the Power9 processors now have
direct support for IEEE 128-bit floating point. However, we already have a
long double/real*16 type on PowerPC (IBM extended double, which is a pair of
doubles), and it has been a long struggle to get the base compiler and GLIBC to
support switching the C language. At the moment, the compiler middle/back end,
C/C++ front ends are mostly done, and GLIBC is being worked on.
Jonathan Wakely and others are now working on making the libstdc++ libraries
able to support either long double type, using different function names via
name mangling for the two types.
So with the GLIBC work progressing, it is time to start thinking about how we
can move fortran's real*16 to use the IEEE 128-bit type.
There are two basic methods that I know about:
1) Wait for a distro to move, and fortran (in theory) should pick up all
of the changes for free, but that can take awhile;
2) Add support within fortran to change the name used for real*16 support
functions, and provide both functions in the library (this is what C++
is doing).
I realize that presumably like every other project, you have more work to do
than you have bodies doing the work, and it is a matter of setting the
priorities.
As we discussed, while the majority of the codes are probably real*4 or real*8,
there some codes that want/need to use higher precision (real*10 on Intel/AMD,
real*16 on PowerPC). I don't have a handle on how big the propulation is that
wants to use higher precision values on PowerPC systems.
I just recently put in a patch to the rs6000 backend that switches the names of
the math built-in functions if the compiler was configured for IBM extended
double and the user asked for IEEE 128-bit floating point, and this will work
for fortran also. But as I was looking at the compiler and library, I realized
there is a lot of code for the library support functions, and these need to be
addressed as well.
We talked about me providing a patch to switch the libquad math functions to
the GLIBC f128 functions, and after I implemented it, I realized that we never
call the libquad math functions in PowerPC, because of IBM extended double (and
there can only be one float type of a given size, which has made implement the
IEEE 128-bit support so much 'fun').
If we did call libquadmath, it would have been useful to switch to GLIBC's f128
math functions, since these functions are being heavily optimized. In
addition, if you use recent Advance Toolchain releases, AT will load up a
shared library compiled specifically for power9, which generates the native
instructions instead of calling through a PLT to get either software emulation
or the hardware instruction.
We (IBM) are in the process of setting up a power9 system in the compile farm,
so if people wanted to start actually trying things out, they will be able to.
I wanted to start a dialog on what we see as the next steps, and how willing
was Fortran going to be to support users that want/need to use the IEEE 128-bit
type, and are willing to act as guinea pigs as we modify the libraries to
support the switching (before a distro changes the defaults).
At this point, I don't know the scope of the work, and whether it is fairly
simple and might be able to be slipped into GCC 9 or if it is more complex and
needs to wait until GCC 10.
--
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: ***@linux.ibm.com, phone: +1 (978) 899-4797
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: ***@linux.ibm.com, phone: +1 (978) 899-4797