Gull icon indicating copy to clipboard operation
Gull copied to clipboard

compile without popcount seems impossible

Open BrennusJ opened this issue 8 years ago • 8 comments

Hello,

My 64 bit processor don't carry pocount or sse4 instruction i edit make file (for linux) to remove specific value for g++ but i met error during compile that let me think that there is an error in popcount function replacement

i get specific screenshot for result if needed

jm@jm-Latitude-D630:~/Documents/Gull-master/src$ make -f Makefile.linux build ARCH=x86-64 COMP=g++ unzip -o -j Fathom-master.zip "Fathom-master/src/tbprobe.h" -d "./" Archive: Fathom-master.zip 1720b7f8dd894f7c6468c3917500c97989f45600 inflating: ./tbprobe.h
unzip -o -j Fathom-master.zip "Fathom-master/src/tbprobe.c" -d "./" Archive: Fathom-master.zip 1720b7f8dd894f7c6468c3917500c97989f45600 inflating: ./tbprobe.c
unzip -o -j Fathom-master.zip "Fathom-master/src/tbcore.h" -d "./" Archive: Fathom-master.zip 1720b7f8dd894f7c6468c3917500c97989f45600 inflating: ./tbcore.h
unzip -o -j Fathom-master.zip "Fathom-master/src/tbcore.c" -d "./" Archive: Fathom-master.zip 1720b7f8dd894f7c6468c3917500c97989f45600 inflating: ./tbcore.c
g++ -fno-exceptions -fno-rtti -fno-stack-protector -Wno-parentheses -pthread -D GULL_MAGIC_BITBOARDS -DVERSION=170402-Linux-x86_64 -O3 -D LINUX Gull.cpp tbprobe.c -lrt -Wl,--defsym=INFO=0x300000 -Wl,--defsym=SETTINGS=0x301000 -Wl,--defsym=SHARED=0x302000 -Wl,--defsym=DATA=0x74000000 -Wl,--defsym=PAWNHASH=0x78000000 -Wl,--defsym=PVHASH=0x7B000000 -Wl,--defsym=HASH=0x7F000000 -o LazyGull In file included from Gull.cpp:957:0: Linux.cpp:46:0: warning: "UINT64_MAX" redefined #define UINT64_MAX 0xFFFFFFFFFFFFFFFFull // XXX ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h:9:0, from data.h:4, from Gull.cpp:37: /usr/include/stdint.h:169:0: note: this is the location of the previous definition

define UINT64_MAX (__UINT64_C(18446744073709551615))

^ In file included from Gull.cpp:957:0: Linux.cpp:47:0: warning: "UINT32_MAX" redefined #define UINT32_MAX 0xFFFFFFFF ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h:9:0, from data.h:4, from Gull.cpp:37: /usr/include/stdint.h:168:0: note: this is the location of the previous definition

define UINT32_MAX (4294967295U)

^ In file included from Gull.cpp:957:0: Linux.cpp:48:0: warning: "UINT8_MAX" redefined #define UINT8_MAX 0xFF ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h:9:0, from data.h:4, from Gull.cpp:37: /usr/include/stdint.h:166:0: note: this is the location of the previous definition

define UINT8_MAX (255)

^ In file included from Gull.cpp:578:0: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h: In function ‘int popcount(uint64_t)’: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h:42:1: error: inlining failed in call to always_inline ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch _mm_popcnt_u64 (unsigned long long __X) ^ Gull.cpp:581:26: error: called from here return _mm_popcnt_u64(x); ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/smmintrin.h:811:0, from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:41, from tbprobe.c:33: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h: In function ‘void prt_str(const pos*, char*, bool)’: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h:42:1: error: inlining failed in call to always_inline ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch _mm_popcnt_u64 (unsigned long long __X) ^ tbprobe.c:76:47: error: called from here #define popcount(x) _mm_popcnt_u64((x)) ^ tbprobe.c:555:14: note: in expansion of macro ‘popcount’ for (i = popcount(white & pos->queens); i > 0; i--) ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/smmintrin.h:811:0, from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:41, from tbprobe.c:33: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h:42:1: error: inlining failed in call to always_inline ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch _mm_popcnt_u64 (unsigned long long __X) ^ tbprobe.c:76:47: error: called from here #define popcount(x) _mm_popcnt_u64((x)) ^ tbprobe.c:557:14: note: in expansion of macro ‘popcount’ for (i = popcount(white & pos->rooks); i > 0; i--) ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/smmintrin.h:811:0, from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:41, from tbprobe.c:33: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h:42:1: error: inlining failed in call to always_inline ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch _mm_popcnt_u64 (unsigned long long __X) ^ tbprobe.c:76:47: error: called from here #define popcount(x) _mm_popcnt_u64((x)) ^ tbprobe.c:559:14: note: in expansion of macro ‘popcount’ for (i = popcount(white & pos->bishops); i > 0; i--) ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/smmintrin.h:811:0, from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:41, from tbprobe.c:33: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h:42:1: error: inlining failed in call to always_inline ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch _mm_popcnt_u64 (unsigned long long __X) ^ tbprobe.c:76:47: error: called from here #define popcount(x) _mm_popcnt_u64((x)) ^ tbprobe.c:561:14: note: in expansion of macro ‘popcount’ for (i = popcount(white & pos->knights); i > 0; i--) ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/smmintrin.h:811:0, from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:41, from tbprobe.c:33: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h:42:1: error: inlining failed in call to always_inline ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch _mm_popcnt_u64 (unsigned long long __X) ^ tbprobe.c:76:47: error: called from here #define popcount(x) _mm_popcnt_u64((x)) ^ tbprobe.c:563:14: note: in expansion of macro ‘popcount’ for (i = popcount(white & pos->pawns); i > 0; i--) ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/smmintrin.h:811:0, from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:41, from tbprobe.c:33: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h:42:1: error: inlining failed in call to always_inline ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch _mm_popcnt_u64 (unsigned long long __X) ^ tbprobe.c:76:47: error: called from here #define popcount(x) _mm_popcnt_u64((x)) ^ tbprobe.c:567:14: note: in expansion of macro ‘popcount’ for (i = popcount(black & pos->queens); i > 0; i--) ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/smmintrin.h:811:0, from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:41, from tbprobe.c:33: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h:42:1: error: inlining failed in call to always_inline ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch _mm_popcnt_u64 (unsigned long long __X) ^ tbprobe.c:76:47: error: called from here #define popcount(x) _mm_popcnt_u64((x)) ^ tbprobe.c:569:14: note: in expansion of macro ‘popcount’ for (i = popcount(black & pos->rooks); i > 0; i--) ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/smmintrin.h:811:0, from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:41, from tbprobe.c:33: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h:42:1: error: inlining failed in call to always_inline ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch _mm_popcnt_u64 (unsigned long long __X) ^ tbprobe.c:76:47: error: called from here #define popcount(x) _mm_popcnt_u64((x)) ^ tbprobe.c:571:14: note: in expansion of macro ‘popcount’ for (i = popcount(black & pos->bishops); i > 0; i--) ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/smmintrin.h:811:0, from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:41, from tbprobe.c:33: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h:42:1: error: inlining failed in call to always_inline ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch _mm_popcnt_u64 (unsigned long long __X) ^ tbprobe.c:76:47: error: called from here #define popcount(x) _mm_popcnt_u64((x)) ^ tbprobe.c:573:14: note: in expansion of macro ‘popcount’ for (i = popcount(black & pos->knights); i > 0; i--) ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/smmintrin.h:811:0, from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:41, from tbprobe.c:33: /usr/lib/gcc/x86_64-linux-gnu/5/include/popcntintrin.h:42:1: error: inlining failed in call to always_inline ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch _mm_popcnt_u64 (unsigned long long __X) ^ tbprobe.c:76:47: error: called from here #define popcount(x) _mm_popcnt_u64((x)) ^ tbprobe.c:575:14: note: in expansion of macro ‘popcount’ for (i = popcount(black & pos->pawns); i > 0; i--) ^ Makefile.linux:65 : la recette pour la cible « build » a échouée make: *** [build] Erreur 1 jm@jm-Latitude-D630:~/Documents/Gull-master/src$

BrennusJ avatar Apr 02 '17 18:04 BrennusJ

Yes, I think the current version assumes a CPU that supports popcnt. Only very old CPUs have this problem?

basil00 avatar Apr 03 '17 13:04 basil00

Yes on my other "Haswell" computer everything is fine, this occur on an Intel Core2 Duo T7250 ( http://ark.intel.com/products/31728 ) the part of code to replace popcnt instruction seems to get a problem no ?

BrennusJ avatar Apr 03 '17 13:04 BrennusJ

by the way "old" only 10 years old ;-)

BrennusJ avatar Apr 03 '17 13:04 BrennusJ

10 year old computers are considered very old - no commercial software is supported after 10 years , so why should gratis software be any different - naturally a lot of software works after 10 years , but that is just luck , not that it is still supported.

MichaelB7 avatar Apr 03 '17 13:04 MichaelB7

Yes Michael, but for popcnt instruction for ordinary CPU (not Corei7) is supported only since 2013 (wiki source). The problem is not like you said. A great job (thanksfull) was done to make this great chess engine compatible with LINUX / MAC. Many other chess engine source could be compile on 64 (normal or BMI or popcnt) and even 32 bits (very very very old computer) and also for some in C++11 on ARM plateform like RaspBerry. I'm not sure that the problem i rise up is so big. How to test ordinary 64 compiling if you don't get a computer without 64 bits CPU without popcnt, bmi SSE4.2 (all this modern features). of course, i don't wait that a software build 10 years ago could run on a current OS or CPU that was nor existing when was building the software but this case is different (and reverse)

BrennusJ avatar Apr 04 '17 07:04 BrennusJ

Did you try with flag -march=native if you are compiling on the machine in question ? If compiling from other machine , just use -O2

MichaelB7 avatar Apr 04 '17 14:04 MichaelB7

ok, thanks, i'm not sure to catch, i edit the line N° 14 from the linux makefile and set like this CFLAGS += -march=native -D GULL_MAGIC_BITBOARDS then i run make -f Makefile.linux build ARCH=x86-64 COMP=g++

BrennusJ avatar Apr 04 '17 18:04 BrennusJ

jm jm-latitude-d630 -documents-gull-master-src_006

BrennusJ avatar Apr 04 '17 18:04 BrennusJ