a general purpose method for
play

A general-purpose method for faithfully rounded floating-point - PowerPoint PPT Presentation

A general-purpose method for faithfully rounded floating-point function approximation in FPGAs David B. Thomas Imperial College London 1 David Thomas, Imperial College, dt10@ic.ac.uk FloPoCo : Parameterised primitives 2 David Thomas,


  1. A general-purpose method for faithfully rounded floating-point function approximation in FPGAs David B. Thomas Imperial College London 1 David Thomas, Imperial College, dt10@ic.ac.uk

  2. FloPoCo : Parameterised primitives 2 David Thomas, Imperial College, dt10@ic.ac.uk

  3. FloPoCo : Parameterised primitives 3 David Thomas, Imperial College, dt10@ic.ac.uk

  4. FloPoCo : Parameterised primitives 4 David Thomas, Imperial College, dt10@ic.ac.uk

  5. FloatApprox : Parameterised anything Approximation Input format interval Output format 5 David Thomas, Imperial College, dt10@ic.ac.uk

  6. FloatApprox : Parameterised anything 6 David Thomas, Imperial College, dt10@ic.ac.uk

  7. FloatApprox • Architecture for FPGA function approximation – Deeply pipelined – Floating-point in and out – Faithfully rounded • Method and tool for approximating functions – Handles any most twice-differentiable functions – Completely automated: expression to VHDL – Designed for reliability rather than optimality 7 David Thomas, Imperial College, dt10@ic.ac.uk

  8. 1. Motivation 2. The FloatApprox approach 1. Range reduction and approximation method 2. Evaluation architecture 3. Evaluation in hardware 8 David Thomas, Imperial College, dt10@ic.ac.uk

  9. Context: FPGA accelerators • Mathematical or algorithmic specification • Convert to HLS or VHDL implementation – Rely on optimised IP for floating-point – Integrated at link-time into the final design 9 David Thomas, Imperial College, dt10@ic.ac.uk

  10. Context: FPGA accelerators • Mathematical or algorithmic specification • Convert to HLS or VHDL implementation – Rely on optimised IP for floating-point – Integrated at link-time into the final design • Intellectual challenges for accelerator design – Managing memory accesses and bandwidth – Rewriting to tolerate latency of operators – Keeping pipelines occupied – Not : designing low-level IP cores 9 David Thomas, Imperial College, dt10@ic.ac.uk

  11. Floating-point IP: Requirements • Faithfully rounded – Make every bit count – Tractable error analysis • Pipelined for 150MHz+ clock rate – Must be pipelined: RAM and DSPs are multi-cycle – Synthesis tools have limited retiming capability • Working RTL (circuit) implementation – A paper can’t be synthesised 10 David Thomas, Imperial College, dt10@ic.ac.uk

  12. Floating-point IP: Requirements • Faithfully rounded – Make every bit count – Tractable error analysis • Pipelined for 150MHz+ clock rate – Must be pipelined: RAM and DSPs are multi-cycle – Synthesis tools have limited retiming capability • Working RTL (circuit) implementation – A paper can’t be synthesised 10 David Thomas, Imperial College, dt10@ic.ac.uk

  13. A fable... Subject: Floating-point log1p? To: dt10@ic.ac.uk From: phd-slash-industry-bod@somewhere.com Body: I’m converting some code for an accelerator, and it uses log1p. Can I use your core from that PoC you did a while back? 11 David Thomas, Imperial College, dt10@ic.ac.uk

  14. A fable... Subject: Re: Floating-point log1p? To: phd-slash-industry-bod@somewhere.com From: dt10@ic.ac.uk Body: Afraid that was written in Handel- C, I don’t have any VHDL. You could recreate it using the attached maple script, plus write a code gen. > I’m converting some code for an accelerator, and > it uses log1p. Can I use your core from that > PoC you did a while back? 12 David Thomas, Imperial College, dt10@ic.ac.uk

  15. A fable... Subject: Re: Floating-point log1p? To: phd-slash-industry-bod@somewhere.com From: dt10@ic.ac.uk Body: Any luck? > Afraid that was written in Handel- C, I don’t > have any VHDL. You could recreate it using > the attached maple script, plus write a code gen. > > I’m converting some code for an accelerator, and > > it uses log1p. Can I use your core from that > > PoC you did a while back? 13 David Thomas, Imperial College, dt10@ic.ac.uk

  16. ... becomes a nightmare Subject: Re: Floating-point log1p? To: phd-slash-industry-bod@somewhere.com From: dt10@ic.ic.ac.uk Body: Oh, we don’t have maple . It’s ok, I found out log1p(x)=log(1+x), and just did that. Works fine. > Any luck? > > Afraid that was written in Handel- C, I don’t > > have any VHDL. You could recreate it using > > the attached maple script, plus write a code gen. 14 David Thomas, Imperial College, dt10@ic.ac.uk

  17. What IP is available? Source Pipelined Faithful RTL add, mul, div FloPoCo Yes Yes Yes log, exp FloPoCo Yes Yes Yes sin, cos FPLibrary No Yes Yes Altera Yes Yes Altera flow only Xilinx Yes ? Vivado HLS only log1p Altera Yes Yes Altera flow only expm1 Altera Yes No OpenCL only erf Altera Yes No OpenCL only 15 David Thomas, Imperial College, dt10@ic.ac.uk

  18. What IP is available? Source Pipelined Faithful RTL add, mul, div FloPoCo Yes Yes Yes log, exp FloPoCo Yes Yes Yes sin, cos FPLibrary No Yes Yes Altera Yes Yes Altera flow only Xilinx Yes ? Vivado HLS only log1p Altera Yes Yes Altera flow only expm1 Altera Yes No OpenCL only erf Altera Yes No OpenCL only 15 David Thomas, Imperial College, dt10@ic.ac.uk

  19. What IP is available? Source Pipelined Faithful RTL add, mul, div FloPoCo Yes Yes Yes log, exp FloPoCo Yes Yes Yes sin, cos FPLibrary No Yes Yes Altera Yes Yes Altera flow only Xilinx Yes ? Vivado HLS only log1p Altera Yes Yes Altera flow only expm1 Altera Yes No OpenCL only erf Altera Yes No OpenCL only 15 David Thomas, Imperial College, dt10@ic.ac.uk

  20. Motivation for FloatApprox • We currently have : + , - , * , / , log , exp – Use existing IP: FloPoCo, Xilinx, Altera, ... 16 David Thomas, Imperial College, dt10@ic.ac.uk

  21. Motivation for FloatApprox • We currently have : + , - , * , / , log , exp – Use existing IP: FloPoCo, Xilinx, Altera, ... • We should have : log1p, expm1, erf, sin, acos, ... – What FloatApprox does badly... ... but better than anything else available 16 David Thomas, Imperial College, dt10@ic.ac.uk

  22. Motivation for FloatApprox • We currently have : + , - , * , / , log , exp – Use existing IP: FloPoCo, Xilinx, Altera, ... • We should have : log1p, expm1, erf, sin, acos, ... – What FloatApprox does badly... ... but better than anything else available • What I want : sqrt(-2 log(x)), 1/(1+exp(-x)) – What FloatApprox does well 16 David Thomas, Imperial College, dt10@ic.ac.uk

  23. Goals of FloatApprox • As a tool – Convert any function f(x) to RTL – Able to handle most smooth functions • Smooth = twice differentiable for our purposes – Suitable for automated use • Input : data-types, range, function • Output : faithfully rounded circuit 17 David Thomas, Imperial College, dt10@ic.ac.uk

  24. Goals of FloatApprox • As a tool – Convert any function f(x) to RTL – Able to handle most smooth functions • Smooth = twice differentiable for our purposes – Suitable for automated use • Input : data-types, range, function • Output : faithfully rounded circuit • As generated IP – Pipelined – Faithfully rounded – Working RTL 17 David Thomas, Imperial College, dt10@ic.ac.uk

  25. FloatApprox: requirements • User can specify any specified target function • Parameterised floating-point representation – Input and output formats can be distinct • Portable between platforms • Usable from many languages • Open-source • Low latency • Minimal resource 19 David Thomas, Imperial College, dt10@ic.ac.uk

  26. Architecture and Approximation • Architecture : – General template for creating any approximator • Approximation – Configuring the template for a given function 20 David Thomas, Imperial College, dt10@ic.ac.uk

  27. FloatApprox : Approximation • Given a function f t how do we create f a ? 21 David Thomas, Imperial College, dt10@ic.ac.uk

  28. FloatApprox : Approximation • Given a function f t how do we create f a ? • Segment the function so that segments are: 21 David Thomas, Imperial College, dt10@ic.ac.uk

  29. FloatApprox : Approximation • Given a function f t how do we create f a ? • Segment the function so that segments are: 1. Contained in one input binade 21 David Thomas, Imperial College, dt10@ic.ac.uk

  30. FloatApprox : Approximation • Given a function f t how do we create f a ? • Segment the function so that segments are: 1. Contained in one input binade 1. Contained in one output binade 21 David Thomas, Imperial College, dt10@ic.ac.uk

  31. FloatApprox : Approximation • Given a function f t how do we create f a ? • Segment the function so that segments are: 1. Contained in one input binade 1. Contained in one output binade 1. FaithfulFixed: can faithfully approximate with fixed-point polynomial of degree d 21 David Thomas, Imperial College, dt10@ic.ac.uk

  32. FloatApprox : Approximation • Given a function f t how do we create f a ? • Segment the function so that segments are: 1. Contained in one input binade 2. Monotonically increasing or decreasing in range 3. Contained in one output binade 4. FaithfulReal: can approx. with real degree d poly 5. FaithfulFixed: can faithfully approximate with fixed-point polynomial of degree d 21 David Thomas, Imperial College, dt10@ic.ac.uk

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend