[Mesa-dev] [PATCH 00/47] WIP: fp64 support for r600g

Nicolai Hähnle nhaehnle at gmail.com
Wed Aug 23 12:23:01 UTC 2017


On 23.08.2017 13:07, Elie Tournier wrote:
> From: Elie Tournier <elie.tournier at collabora.com>
> 
> TL;DR
> This series is a "status update" of my work done for adding fp64 support on r600g.
> One of the biggest issue is due to a lake of accuracy on the rcp implementation.
> Divide relay on rcp.
> 
> A branch is available on https://github.com/Hopetech/mesa/tree/glsl_arb_gpu_shader_fp64_v3
> Comments and reviews are welcome.
> 
> Patches 1-18:
> These few patches implement the basic fp64 operations.
> 
> Patches 19-47:
> Lower operations using the builtin functions previously implemented.
> 
> Known issues:
> - operations on matrix crash the system.
> - sqrt and d2f are not accurate enought so the piglit tests are failling.
>    But sqrt and d2f are working correctly using softpipe.
>    However, implementing sqrt64 as f2d(sqrt32(d2f()) seems to be good enought for Piglit.
> - rcp is define as pow(pow(x, -0.5), 2)
>    NIR and NV convert the input in a fp32, realize a rcp, convert back to a fp64 and realize some Newton-Raphson step.
>    This is not possible with GLSL IR because using fma will generate a massive builtin_float64.h file.

I don't understand this part. You need multiplication and addition 
anyway. So if it's only fma which is the problem (why?), then why not 
just use non-fused multiply-add? It may end up being slightly less 
accurate, but we don't give any strong guarantees about rcp accuracy 
anyway, do we?

Cheers,
Nicolai


> - dot is failing
> - piglit report crashes on mod. This is a regression, I'm currently working on it.
> 
> Piglit result:
> Pass: 917 Fail: 211 Crash: 241
> 
> Dave Airlie (2):
>    glsl/lower_64bit: handle any/all operations
>    glsl/lower_64bit: lower d2b using comparison
> 
> Elie Tournier (45):
>    glsl: Add "built-in" function to do abs(fp64)
>    glsl: Add "built-in" functions to do neg(fp64)
>    glsl: Add "built-in" function to do sign(fp64)
>    glsl: Add "built-in" functions to do eq(fp64, fp64)
>    glsl: Add "built-in" functions to do le(fp64, fp64)
>    glsl: Add "built-in" functions to do lt(fp64, fp64)
>    glsl: Add "built-in" functions to do add(fp64, fp64)
>    glsl: Add "built-in" functions to do mul(fp64, fp64)
>    glsl: Add "built-in" functions to do fp64_to_uint(fp64)
>    glsl: Add "built-in" functions to do uint_to_fp64(uint)
>    glsl: Add "built-in" functions to do fp64_to_int(fp64)
>    glsl: Add "built-in" functions to do int_to_fp64(int)
>    glsl: Add "built-in" functions to do fp64_to_fp32(fp64)
>    glsl: Add "built-in" functions to do fp32_to_fp64(fp32)
>    glsl: Add "built-in" functions to do sqrt(fp64)
>    glsl: Add "built-in" functions to do trunc(fp64)
>    glsl: Add "built-in" functions to do round(fp64)
>    glsl: Add "built-in" functions to do rcp(fp64)
>    glsl: Add a lowering pass for 64-bit float abs()
>    glsl: Add a lowering pass for 64-bit float neg()
>    glsl: Add a lowering pass for 64-bit float sign()
>    glsl: Add a lowering pass for 64-bit float equal()
>    glsl: Add a lowering pass for 64-bit float lequal()
>    glsl: Add a lowering pass for 64-bit float less()
>    glsl: Add a lowering pass for 64-bit float add()
>    glsl: Add a lowering pass for 64-bit float mul()
>    glsl: Add a lowering pass for 64-bit float d2u()
>    glsl: Add a lowering pass for 64-bit float u2d()
>    glsl: Add a lowering pass for 64-bit float d2i()
>    glsl: Add a lowering pass for 64-bit float i2d()
>    glsl: Add a lowering pass for 64-bit float d2f()
>    glsl: Add a lowering pass for 64-bit float f2d()
>    glsl: Add a lowering pass for 64-bit float sqrt()
>    glsl: Add a lowering pass for 64-bit float trunc()
>    glsl: Add a lowering pass for 64-bit float round()
>    glsl: Add a lowering pass for 64-bit float rcp()
>    glsl: Add a lowering pass for 64-bit float gequal()
>    glsl: Add a lowering pass for 64-bit float greater()
>    glsl: Add a lowering pass for 64-bit float nequal()
>    glsl: Add a lowering pass for 64-bit float min()
>    glsl: Add a lowering pass for 64-bit float max()
>    glsl: Add a lowering pass for 64-bit float floor()
>    glsl: Add a lowering pass for 64-bit float ceil()
>    glsl: Add a lowering pass for 64-bit float frac()
>    glsl: Add a lowering pass for 64-bit float div()
> 
>   src/compiler/Makefile.sources                      |     3 +-
>   src/compiler/glsl/builtin_float64.h                | 20310 +++++++++++++++++++
>   src/compiler/glsl/builtin_functions.cpp            |    72 +
>   src/compiler/glsl/builtin_functions.h              |    54 +
>   src/compiler/glsl/float64.glsl                     |  1494 ++
>   src/compiler/glsl/generate_ir.cpp                  |     1 +
>   src/compiler/glsl/glcpp/glcpp-parse.y              |    18 +
>   src/compiler/glsl/glsl_parser_extras.cpp           |     1 +
>   src/compiler/glsl/ir_optimization.h                |    25 +-
>   .../glsl/{lower_int64.cpp => lower_64bit.cpp}      |   325 +-
>   src/compiler/glsl/lower_instructions.cpp           |   139 +-
>   src/mesa/state_tracker/st_extensions.c             |     3 +-
>   src/mesa/state_tracker/st_glsl_to_tgsi.cpp         |    27 +
>   13 files changed, 22442 insertions(+), 30 deletions(-)
>   create mode 100644 src/compiler/glsl/builtin_float64.h
>   create mode 100644 src/compiler/glsl/float64.glsl
>   rename src/compiler/glsl/{lower_int64.cpp => lower_64bit.cpp} (51%)
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list