[Mesa-dev] [GSoC2016] Interested in implementing "Soft" double precision floating point support

Ian Romanick idr at freedesktop.org
Thu Mar 10 19:02:51 UTC 2016


On 03/10/2016 06:30 AM, tournier.elie wrote:
> First, thank you all for your answers.
> 
> So if I summarize what was said, we need
> Ian:
>  - add
>  - negate
>  - absolute value
>  - multiply
>  - reciprocal
>  - convert to single precision
>  - convert from single precision
> Roland:
>  - sqrt

Reciprocal sqrt (rsqrt) is probably more useful.  You can then get sqrt
using reciprocal and rqsrt.

>  - comparaison (< / == / >)
>  - floor/ceil
> I will contact Pat Brown (His name appear in the contact field in [1])
> to know if we need the function below for implement gpu_shader_fp64.

Don't contact Pat.  He's a busy guy, and he probably won't respond. :)

We have to have some sort of implementation of every function in the
extension.  That's not the part that's under debate.  The part that is
under debate is whether specific operations are needed to implement the
functions.  For example, as Roland mentioned, you can implement pow
using exp and log.

>  - pow
>  - exp
>  - log

I looked back at the spec, and there are no pow, exponent, or logarithm
related functions.  I guess we get of easy there.  It may still be
interesting to eventually implement these, but that would be a much,
much, much later step.

> About the license
> 
>     /Like I mentioned in the project description, there are quite a few
>     existing C implementations of these functions.  Finding one of those
>     that you can understand and that has a compatible license is probably
>     the best place to start./
> 
> Main Mesa code is under MIT license.
> If I chose to use a GNU GPL license file like Linux kernel [3], my code
> must be under GNU GPL and probably all the project too. Am I right?
> 
> [1] https://www.opengl.org/registry/specs/ARB/gpu_shader_fp64.txt
> [2] http://www.mesa3d.org/license.html
> [3]
> https://github.com/torvalds/linux/blob/097f70b3c4d84ffccca15195bdfde3a37c0a7c0f/arch/arm/nwfpe/softfloat.c
> 
> 2016-03-10 2:18 GMT+01:00 Roland Scheidegger <sroland at vmware.com
> <mailto:sroland at vmware.com>>:
> 
>     Am 09.03.2016 um 23:51 schrieb Ian Romanick:
>     > On 03/09/2016 02:25 AM, tournier.elie wrote:
>     >> Hi everyone.
>     >>
>     >> My name is Elie TOURNIER, I am enrolled in a French Engineering
>     school
>     >> (Telecom Physique Strasbourg) specialized in Medical ICT.
>     >> I'm interested in implementing "Soft" double precision floating point
>     >> support [1].
>     >> Taking this subject seem to be a good way to get my feet wet in
>     the Mesa
>     >> code and discover how some of its components works.
>     >>
>     >> I come to you in order to become know but also to retrieve valuable
>     >> information for the success of this project.
>     >>
>     >> I would like to know more about the following things to
>     understand your
>     >> requirements :
>     >> 1- "/Each double precision value would be stored in a uvec2/" The
>     IEEE
>     >> double precision floating point standard representation requires a 64
>     >> bit: 1 for sign, 11 for exponent and the others for fraction [2].
>     >> -> How double precision value must be stored?
>     >
>     > As Emil mentioned, on GLSL 1.30, a uvec2 consists of two, 32-bit
>     > unsigned integers.  Each double precision value would be stored in
>     a uvec2.
>     >
>     >> 2- Where can I find |GL_ARB_gpu_shader_fp64 |documentation|?
>     >> |
>     >>
>     >>
>     >> This is my first exposure to Mesa. Please excuse me if I am
>     asking basic
>     >> questions.
>     >
>     > For this particular project, you wouldn't need Mesa at all for quite
>     > some time.  All of the initial project should be done in "raw" GLSL
>     > 1.30, and any OpenGL implementation capable of GLSL 1.30 can be used.
>     > You would implement (and test!) a library of functions like 'uvec2
>     > addDouble(uvec2 a, uvec2 b)' that would provide all of the required
>     > double precision operations.
>     >
>     > The set of required functions should be pretty small.  I think:
>     >
>     >  - add
>     >  - negate
>     >  - absolute value
>     >  - multiply
>     >  - reciprocal
>     >  - convert to single precision
>     >  - convert from single precision
>     >  - pow (maybe?)
>     >  - exp (maybe?)
>     >  - log (maybe?)
> 
>     I don't think you need exp/log. At least glsl dosen't require it, though
>     the project isn't clear about it.
>     (pow all hw I know of with exactly one exception (that would be intel
>     graphics...) implements it as log2/mul/exp2 even for f32 anyway).
>     I think though you need sqrt (or rsqrt). And some functions for
>     rounding, plus comparison operations. Maybe min/max too (albeit if you
>     have comparisons you can emulate them of course).
> 
>     Roland
> 
> 
>     >
>     > I think everything else could be implemented using those functions.
>     >
>     > Like I mentioned in the project description, there are quite a few
>     > existing C implementations of these functions.  Finding one of those
>     > that you can understand and that has a compatible license is probably
>     > the best place to start.
>     >
>     >> Please point me to the right resources so that I can better
>     understand
>     >> the project. I would also be happy to fix a bug to familiarize myself
>     >> with the source code. Any suggestions on bugs that are relevant
>     to the
>     >> project will be of great help.
>     >>
>     >> Regards,
>     >> Elie
>     >>
>     >> [1]
>     >>
>     http://www.x.org/wiki/SummerOfCodeIdeas/#softdoubleprecisionfloatingpointsupport
>     >> [2] http://steve.hollasch.net/cgindex/coding/ieeefloat.html#storage
>     >>
>     >> PS: If you have any questions, please don't hesitate to contact me.
>     >>
>     >>
>     >> _______________________________________________
>     >> mesa-dev mailing list
>     >> mesa-dev at lists.freedesktop.org
>     <mailto:mesa-dev at lists.freedesktop.org>
>     >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>     >
>     > _______________________________________________
>     > mesa-dev mailing list
>     > mesa-dev at lists.freedesktop.org <mailto:mesa-dev at lists.freedesktop.org>
>     > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>     >
> 
> 



More information about the mesa-dev mailing list