henrikurms / tail2futhark

18 stars 2 forks source link

Toggle floating point representation #6

Closed athas closed 8 years ago

athas commented 8 years ago

TAIL assumes that all floating point values are double-precision (mostly because that's what it calls the type). But for generating GPU code, it is really preferable to be able to use single-precision. This choice should be made in tail2futhark, I think, based on a command line parameter. This could be done by adding a 32-bit float type to the TAIL AST definition, and then transform the syntax tree to change all references to double-precision floats prior to entering the code generator.

Alternatively, the code generator could carry around an environment that indicates how we prefer to translate the DoubleT type. I am not opposed to this in principle, but the current code generator is not monadic at all.

melsman commented 8 years ago

adding f32 to tail is probably the best option. We can start by adding a flag to apltail...

Den onsdag den 27. april 2016 skrev Troels Henriksen < notifications@github.com>:

TAIL assumes that all floating point values are double-precision (mostly because that's what it calls the type). But for generating GPU code, it is really preferable to be able to use single-precision. This choice should be made in tail2futhark, I think, based on a command line parameter. This could be done by adding a 32-bit float type to the TAIL AST definition, and then transform the syntax tree to change all references to double-precision floats prior to entering the code generator.

Alternatively, the code generator could carry around an environment that indicates how we prefer to translate the DoubleT type. I am not opposed to this in principle, but the current code generator is not monadic at all.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/henrikurms/tail2futhark/issues/6

athas commented 8 years ago

Martin Elsman notifications@github.com writes:

adding f32 to tail is probably the best option. We can start by adding a flag to apltail...

What about changing the "double" in TAIL to a more high-level "real"? It is then up to each concrete code generator to determine how to map this to a hardware type.

\ Troels /\ Henriksen

athas commented 8 years ago

Implemented in 37ebafb721c9223ca708c3ac61fa14d4900b97d8.