cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
8,874 Views
Registered: ‎12-18-2012

expf error with Vivado HLS 20123.3..bug?

Hello,

 

I downloaded the new vivado version and I encountered a bug in the expf() function that was not present in the previous versions. Both C and RTL simulation failed or has garbage results for negative arguments in the expf() function. exp() runs normally but synthesizes double floating and not single floating poitn module on hardware. 

 

expf() run without problems in 2013.2. Is this a new issued bug perhaps?

 

Cheers...

0 Kudos
9 Replies
Highlighted
Moderator
Moderator
8,856 Views
Registered: ‎04-17-2011

This issue occurs when you set the RTL Tool to ISE. expf() is a Vivado based core and you need to set RTL tool setting to Vivado. This has been flagged as an error from Vivado HLS 2013.3.
Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Highlighted
Adventurer
Adventurer
8,849 Views
Registered: ‎12-18-2012

The RTL tool was set to auto...I have changed it to vivado explicitly by the gui (set_part {xc7vx485tffg1761-2} -tool vivado in script.tcl) but both errors still occure.

 

Both simulations still crash with unknown errors

 

 

0 Kudos
Highlighted
Adventurer
Adventurer
8,831 Views
Registered: ‎12-18-2012

Bumping this up...Does anyone know if it is a bug or not? It is not much of a problem since one can use the 2013.2 version for generating IPs and using the IP in vivado 2012.3 but still it is an issue....

 

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
8,818 Views
Registered: ‎11-28-2007

Just tested it and expf works for me (see the attached test case). Can you please provide your testcase? PM me if needed.

 


@adanathel wrote:

Bumping this up...Does anyone know if it is a bug or not? It is not much of a problem since one can use the 2013.2 version for generating IPs and using the IP in vivado 2012.3 but still it is an issue....

 




Cheers,
Jim
0 Kudos
Highlighted
Adventurer
Adventurer
8,810 Views
Registered: ‎12-18-2012

I have managed to narrow down the bug. The problematic code is actually sth like this:

 

res = 1 /(expf(-0.086 * prevV - 14.6) + expf(0.070 * prevV - 1.87));

 


If I use expf for both expressions then I get the error in simulation.

The issue here is that I cannot re-create the bug standalone because I do not get these errors when i use this expression on its own in am simpler example. 

 

There is also sth interesting too. If i use the a temp variable for one of the expfs, for example:

 

float temp;

temp = expf(-0.086 * prevV - 14.6);

res = 1 /( temp + expf(0.070 * prevV - 1.87));

 


The simulation runs properly but then I get results that have a precision(?) deviation from those I would expect from the computations in single float format. Resutls different from the numbers I get from running the program in C with single floats in gcc.

On the other hand the single float resutls using the exp() in 2013.3 and both exp() and expf() in 2013.2 are identical to the C code results. The code running in vivado is identical in all cases.

 

There must be an issue with certain computations done in the math of the model I am implementing because I could not seem to be able to re-create these issues in simpler code as of yet.  Unfortunately I am not at liberty to disclose the model.

 

What were the changes made in the expf() function between versions?

   

 

 

0 Kudos
Highlighted
Teacher
Teacher
8,800 Views
Registered: ‎03-31-2012

One thing I can suggest is to put the denominator in a temp variable and do the 1/x on the temp result, if you haven't tried already.

- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Highlighted
Adventurer
Adventurer
8,794 Views
Registered: ‎12-18-2012

Same thing then...Works but with a precision(?) error...

 

0 Kudos
Highlighted
Teacher
Teacher
8,788 Views
Registered: ‎03-31-2012

how many bits of ulp error are you seeing? are you sure this is not just the standard floating point reordering kind of issue? One final thing to try would be to make the 1/x into 1.0/x and see if this changes anything.
- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Highlighted
Adventurer
Adventurer
8,784 Views
Registered: ‎12-18-2012

I can the error in the result of the first interation of the code. Later error just accumulates and results go haywire:

 

Unfortunately this is a result of several uses in the exp in the code. I have to see individually where deviations occur. It will take me some time.

 

I tried using 1.0 instead of 1 but again there was an error in the resutls. Different error i must say but still there.

 

 

With exp() or 2013.2 HLS : 11000010011011111110011101100100
With expf() in 2013.3         : 11000010011011111110110000111001

Using 1.0                             : 11000010011011111110110000100000

 

0 Kudos