google/cpu_features

erroneous detection of SSE3 on Linux?

jmfriedt opened this issue · 4 comments

Could it be that https://github.com/google/cpu_features/blob/main/src/impl_x86_linux_or_android.c#L47 is incorrect in searching for the "sse3" string in /proc/cpuinfo and should instead search for pni as stated at https://bugzilla.redhat.com/show_bug.cgi?id=491817 ?

Indeed on a Celeron J1900 as provided on a single board computer the command

$ list_cpu_features
flags           : clfsh,cx16,cx8,erms,fpu,mmx,movbe,pclmulqdq,popcnt,rdrnd,ss,sse,sse2,sse4_1,sse4_2,ssse3,tsc

missing sse3. Replacing "sse3" with "pni" leads to

$ list_cpu_features
flags           : clfsh,cx16,cx8,erms,fpu,mmx,movbe,pclmulqdq,popcnt,rdrnd,ss,sse,sse2,sse3,sse4_1,sse4_2,ssse3,tsc

and thanks to this correction VOLK (https://github.com/gnuradio/volk) is able to properly use these SIMD features, demonstrating that they are indeed implemented on this processor.

Hi @jmfriedt , thanks for noticing. According to wikipedia SSE3, also known by its Intel code name Prescott New Instructions (PNI). https://en.wikipedia.org/wiki/SSE3

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/x86/include/asm/cpufeatures.h
https://forums.gentoo.org/viewtopic-t-587726-start-0.html

I think we can replace sse3 to pni

cc: @gchatelet

Yes let's do this.

Fixed by #225

Thx @jmfriedt for the patch and @toor1245 for the review.