gnuradio / volk

The Vector Optimized Library of Kernels
http://libvolk.org
GNU Lesser General Public License v3.0
557 stars 202 forks source link

v3.1.0 volk_32fc_s32f_atan2_32f.h avx2 and avx2_fma kernels return NaN for an input element 0+0j #730

Closed jj1bdx closed 10 months ago

jj1bdx commented 11 months ago

Synopsis

VOLK v3.1.0 volk_32fc_s32f_atan2_32f() returns -nan for the following kernels when an input element is 0+0j:

VOLK v3.1.0 volk_32fc_s32f_atan2_32f() returns zero for the following kernels when an input element is 0+0j:

(where j^2 = -1)

Tested on Ubuntu 22.04.3 x86_64.

Test details are available at: https://gist.github.com/jj1bdx/62e27aac4b54a29dfafe210c73c49b0e

What should be done

The avx2 and avx2_fma kernels should behave the same as the generic and polynomial kernels, i.e., returning zero when the input is 0+0j. I have to screen this irregularity in my own application as in this example, which affects the overall performance and introduces unnecessary complexity.

I would appreciate it if the original author of the kernel would kindly help fix this bug.

References

jdemel commented 10 months ago

Thanks for this detailed bug report. I agree, all kernels should follow the generic behavior.