2009-01-19 00:01:15     Issues with using fast DSP library (libbfdsp)

Document created by Aaronwu Employee on Aug 9, 2013
Version 1Show Document
  • View in full screen mode

2009-01-19 00:01:15     Issues with using fast DSP library (libbfdsp)

Vasanth Nayak (INDIA)

Message: 68079   

 

Hi All,

 

         Had a query regarding the math related functions in libbfdsp.

 

According to the http://docs.blackfin.uclinux.org/doku.php?id=toolchain:libbfdsp ,

 

The main difference between VDSP DSP library and uClinux DSP library is

 

    No math.h: The original library contains math function overlapping with uClibc math library. To avoid confusion, these functions are removed.Please use uClibc math library. Also please include ”-lm” in the LDFLAGS, since “libbfdsp” depends on this library.

 

But due to performance reasons, i wanted to use the math functions defined in DSP library rather than the uClibc math library.

 

 

 

From the looks of things, it looks that sqrtf.asm was designed to be called from assembly code only. [A call to sqrt() resutls in a call to _sqrtf in assembly ]. I tried to modify it by removing a underscore from the name, but iam not getting the right output.Is that the right way of calling it in C ?

 

Is there anything iam missing (i want it to be C- callable)

 

OR

 

Is there any way of using the fast DSP library rather than using the uClibc math library ? (adding -lbfdsp before -lm did not help)

 

Thanks

 

Vasanth

QuoteReplyEditDelete

 

 

2009-01-19 00:55:45     Re: Issues with using fast DSP library (libbfdsp)

Yi Li (CHINA)

Message: 68082   

 

Vasanth,

 

We don't want to maintain two math libraries. If you find the performance of certain uclibc math function worse than the VDSP implementation, please report a bug and we can optimize.

 

-Yi

QuoteReplyEditDelete

 

 

2009-01-19 04:33:37     Re: Issues with using fast DSP library (libbfdsp)

Vasanth Nayak (INDIA)

Message: 68097   

 

Hi Li,

 

            Thanks for the reply. we are seeing a 18 times performance degradation between the VDSP sqrtf function(written in assembly) and the default sqrt function called in uCLinux.(from the math library and written in C ,i guess) and this is impacting the system performace very much

 

            I tried compiling the sqrtf.asm file  directly into our project as i wanted only sqrt function of all the math functions. But as i mentioned previously, as it looks like __sqrtf  is to be called only from assembly and iam getting issues while calling it from C code(wrong output ,but the performance now equals that in VDSP).

 

         Even if u can specify any steps i could follow to integrate the sqrtf.asm into the project (preferably C-callable) ,that would be of great help.

 

 

 

Vasanth

QuoteReplyEditDelete

 

 

2009-01-19 04:59:03     Re: Issues with using fast DSP library (libbfdsp)

Yi Li (CHINA)

Message: 68098   

 

Vasanth,

 

Do you have a simple test case for sqrtf()? Written in asm or C does not matter, since the compiler is supposed to optimize the C code. Did you use "-ffast-math" and "-mfast-fp" gcc options ? please refer to: http://docs.blackfin.uclinux.org/doku.php?id=optimization&s[]=float#gcc_optimization_for_blackfin

 

-Yi

QuoteReplyEditDelete

 

 

2009-01-19 12:10:56     Re: Issues with using fast DSP library (libbfdsp)

Robin Getz (UNITED STATES)

Message: 68118   

 

Vasanth:

 

>18 times performance difference between VDSP and uClibc

 

Yeah, this makes sense - but what we should be doing is moving the standard math functions into  ./uClibc/libm/bfin - and overriding the existing weak functions.

 

This is something we can take a look at - but it will not be right away... Let me see if I can find someone else to take a look.

 

-Robin

QuoteReplyEditDelete

 

 

2009-01-19 22:25:22     Re: Issues with using fast DSP library (libbfdsp)

Yi Li (CHINA)

Message: 68135   

 

Add a task tracker for this: http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=4823

Attachments

    Outcomes