Discussion:
Is llvm incompatible with some cpu instruction sets?
agan Davis
2014-05-08 07:47:02 UTC
Permalink
Hi everyone

I get strange problem, I build klee/llvm3.1 successfully on "Intel(R)
Core(TM) i7-2760QM" cpu and "Inte(R) Xeon(R) CPU E7 - 4830 "cpu, but when
I run klee, it is normal at i7-2760QM machine, but it gets the error
information at E7 - 4830 machine below:
$klee
illegal Instruction(core dumped)

I use gdb to lookup it, after type
$gdb klee:
gdb$b main:cpp:main
gdb$run
using host libthread_db library/lib/x86_64-linux-gun/libthread_db.so.1
Program received signal SIGILL, Illegal instruction

I try it on klee/llvm2.9, it is ok, so I suspect the problem is that E7 -
4830 has cpu instruction sets which llvm/3.1 can not support on, but when I
look up the cpu info of i7-2760QM and E7 - 4830, I find the result is
that i7-2760QM has more instruction sets than E7 - 4830.

$cat /proc/cpuinfo

...
model name : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm
constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc
aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx
hypervisor lahf_lm ida arat xsaveopt pln pts dtherm
....

and

...
model name :DELL R810 Inte(R) Xeon(R) CPU E7 - 4830 @ 2.13Ghz
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm
constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc
aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor
lahf_lm ida arat dtherm
...
i7-2760QM supports "ht xsave avx xsaveopt pln pts " instrcution sets, but
E7 - 4830 can not.

Did someone get the similar problem? Or finding the reason with the problem
with me.
Daniel Liew
2014-05-08 08:26:32 UTC
Permalink
Post by agan Davis
Hi everyone
I get strange problem, I build klee/llvm3.1 successfully on "Intel(R)
Core(TM) i7-2760QM" cpu and "Inte(R) Xeon(R) CPU E7 - 4830 "cpu, but when
I run klee, it is normal at i7-2760QM machine, but it gets the error
Post by agan Davis
$klee
illegal Instruction(core dumped)
I use gdb to lookup it, after type
gdb$b main:cpp:main
gdb$run
using host libthread_db library/lib/x86_64-linux-gun/libthread_db.so.1
Program received signal SIGILL, Illegal instruction
This isn't very informative. Run 'backtrace' to show where in the program
this happened.

If you're getting this error you probably did not build KLEE properly for
your E74830 machine. This does not look like a LLVM/KLEE problem but a
problem with the C++ compiler you used to build LLVM and KLEE. You didn't
specify what compiler you used and whether or not you built LLVM/KLEE on
the same machine you are running it.

Also note we support LLVM 3.4 so if you intend to use a version of LLVM
newer than 2.9 then use 3.4 (make sure you use Clang3.4 as your LLVM
bitcode compiler if you do this)

Thanks,
Dan.
Daniel Liew
2014-05-08 10:07:14 UTC
Permalink
Hi Dan
The backtrace information below(simplify)
gdb$bt
#0 0x0000000000e63f2d in std::vector<__gnu_cxx::_Hashtable_node<std::pair<BEEV::ASTNode const, BEEV::ASTNode>>....
#1 0x0000000000ebacfd in __gnu_cxx::hash_map...
#2 0x000000000055775c in _GLOBAL__sub_I__ZN7printer13NodeLetVarMapE()...
#3 0x0000000000fddb7d in __libc_csu_init ()
#4 0x00007ffff6e099700 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#50x0000000000558969 in _start()
The location that the error is occurring is in the initialisation of
data structures used by STP. This is happening even before you reach
main()
The os klee run on is ubuntu12.04/64bit vmware machine. At beginning, the ubuntu vmware machine on the host macbook pro( i7-2760QM), running nomally but slowly, so I upload this vmware to server( E74830), building klee again, building successful but coming across the problem above. I tried klee/llvm3.1-3.3, getting the some problem,
I'm afraid that the same problem as llvm3.4.
In E74830,
$gcc -c -Q --help=target|grep march
-march =x86_64
In i7-2760QM
$gcc -c -Q --help=target|grep march$gcc -c -Q --help=target|grep march
-march=corei7-avx
Oh cool I didn't know about the -Q option. Nice! And this shows a
potential source of your problem

On your i7-2760QM gcc is by default using a more specific architecture
but on your E74830 it is using the generic x86_64 architecture. I
think you mentioned earlier that your i7-2760QM has a larger
instruction set than the E74830 so your issue looks like the code you
built for LLVM/STP/KLEE contains instructions that i7-2760QM has but
the E74830 does not.

The way to fix depends on how you plan to do development.

- If you need to run your VM both on i7-2760QM and E74830 you should
rebuild everything* ensuring that -march=x86_64 is passed to your
C/C++ compiler
- If you only need to run on your E74830 then simply rebuild
everything* on the E74830 machine.

* i.e. LLVM, STP and then KLEE


Hope that helps.

Dan.

Loading...