UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
2,538 Views
Registered: ‎03-03-2011

Fast Math

Jump to solution

Hi there,

 

I'm curious about how functions like cos and sin, as well as log and exp, are implemented when called within a kernel. It seems to me that they might be a bottleneck for my applications.

 

Is there a way to choose lower precision implementations for speed, resources and lower latency? I'm thinking about things similar to native cosine calls or fast math from opencl.

 

Thanks

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
4,372 Views
Registered: ‎06-07-2016

Re: Fast Math

Jump to solution

Hi @bandi,

 

SDAccel supports native math functions. They are optimized for Xilinx devices as described here.

 

The native functions are listed in the middle of this page.

 

Best,

-Dutch

0 Kudos
5 Replies
Xilinx Employee
Xilinx Employee
2,525 Views
Registered: ‎08-01-2008

Re: Fast Math

Jump to solution
you can use hls function
https://github.com/Xilinx/HLx_Examples
https://www.xilinx.com/support/documentation/sw_manuals/xilinx2014_1/ug902-vivado-high-level-synthesis.pdf

use dsp IPs
https://www.xilinx.com/products/intellectual-property/dsp-and-math.html

you can also use dsp48 primitive directly
https://www.xilinx.com/support/documentation/user_guides/ug479_7Series_DSP48E1.pdf

Thanks and Regards
Balkrishan
--------------------------------------------------------------------------------------------
Please mark the post as an answer "Accept as solution" in case it helped resolve your query.
Give kudos in case a post in case it guided to the solution.
0 Kudos
Adventurer
Adventurer
2,521 Views
Registered: ‎03-03-2011

Re: Fast Math

Jump to solution
I was asking more along the lines of xocc flags which control the implementation of math functions, or calling a specific, lower precision, math function at opencl code level.

Of course I can use CORDIC IPs and such, but that doesn't really apply when starting from OpenCL.
0 Kudos
Xilinx Employee
Xilinx Employee
4,373 Views
Registered: ‎06-07-2016

Re: Fast Math

Jump to solution

Hi @bandi,

 

SDAccel supports native math functions. They are optimized for Xilinx devices as described here.

 

The native functions are listed in the middle of this page.

 

Best,

-Dutch

0 Kudos
771 Views
Registered: ‎07-25-2018

Re: Fast Math

Jump to solution

I am sorry. Could you please help me :)
I want to use erf and erfc function. But, they don't work.

 

which one is correct? (Although none of them works :) )

float result = erf(0.5);

float result = native_erf(0.5);

float result = native_ erf(0.5);

 

it always return zero

 

Thanks a lot

 

0 Kudos
Moderator
Moderator
745 Views
Registered: ‎11-04-2010

Re: Fast Math

Jump to solution
Hi, @ramin_rasoulinezhad ,
Please don't post the duplicated question.
If you think your question is related to an old post, please add the link of the old post in your new topic and refer to it.

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos