NativeJIT icon indicating copy to clipboard operation
NativeJIT copied to clipboard

popcnt issue on CentOS 7.2

Open pengxu7 opened this issue 7 years ago • 3 comments

I built NativeJIT with g++ 5.4.0 on CentOS 7.2. Then I tried to compile your "radius" test code (http://bitfunnel.org/getting-started-with-nativejit/) but got following error:"

/usr/local/gcc54/lib/gcc/x86_64-unknown-linux-gnu/5.4.0/include/popcntintrin.h: In function 'uint8_t NativeJIT::BitOp::GetNonZeroBitCount(uint32_t)': /usr/local/gcc54/lib/gcc/x86_64-unknown-linux-gnu/5.4.0/include/popcntintrin.h:35:1: error: inlining failed in call to always_inline 'int _mm_popcnt_u32(unsigned int)': target specific option mismatch _mm_popcnt_u32 (unsigned int __X) ^ In file included from ./nativejit/inc/NativeJIT/CodeGen/X64CodeGenerator.h:32:0, from ./nativejit/inc/NativeJIT/CodeGen/FunctionBuffer.h:40, from test.cpp:2: ./nativejit/inc/NativeJIT/BitOperations.h:89:55: error: called from here return static_cast<uint8_t>(_mm_popcnt_u32(value)); "

Am I missing anything?

Thanks!

pengxu7 avatar Nov 21 '18 21:11 pengxu7

Hi - my apologies for the slow reply - did you figure this out?

MikeHopcroft avatar Dec 11 '18 23:12 MikeHopcroft

No, I haven't played with NativeJIT after this issue. I wanted to try to use NativeJIT in production code, but this makes me hesitant. Does NativeJIT support Linux, especially CentOS/RHEL? Is it being actively maintained?

Thanks.

pengxu7 avatar Dec 12 '18 14:12 pengxu7

NativeJIT uses SSE4.2 intrinsics for POPCNT/LZCNT. You have to add -msse4.2 to your build flags for these to be available, which obviously restricts the result to machines with those extensions. That’s what the “target specific option mismatch” is about. To be fully portable you would enable SSE4.2 in just the relevant portion of your code that uses NativeJIT, and do runtime CPU feature detection before calling anything that uses that portion.

(But, no, it seems this project isn’t actively maintained anymore.)

musicinmybrain avatar Mar 04 '21 14:03 musicinmybrain