Illegal instruction with all CPU miners

When I try to mine with grin-miner against locally running grin:

$ gdb --args target/debug/grin-miner

I get:


Starting Grin-Miner from config file at: …/grin-miner/grin-miner.toml
Thread 5 “mining_controll” received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7ffff6844700 (LWP 5555)]
deviceInfo::deviceInfo (this=0x7ffff5c9f2a0 <DEVICE_INFO>)
at …/.cargo/git/checkouts/cuckoo-miner-4752934f0f1f2bfe/eb084b7/src/cuckoo_sys/plugins/cuckoo/src/cuckoo_miner/cuckoo_miner.h:171
171 last_start_time=0;
Missing separate debuginfos, use: dnf debuginfo-install libgcc-7.3.1-2.fc26.x86_64 libstdc+±7.3.1-2.fc26.x86_64 ncurses-libs-6.0-8.20170212.fc26.x86_64

This happens with lean_cpu, mean_compat_cpu and mean_cpu. Line 171 above is first one to assign a value to a u64 variable in contructor if I’m reading it correctly. Last thing printed to logfile with trace output is:
Jun 03 15:44:53.097 INFO Got a job at height 96494 and difficulty 1
Jun 03 15:44:53.196 DEBG Miner received message: ReceivedJob(96494, 1, “000100000000000178ee488863f0f0898294ed619a13dd8bbf0a7f9bd42fde967f8e721ecaa8b2cb20d7000000005b13e2c30000000000020564eca708cefb8981b25b7ce76aab1b130f614dfd93d5eee0e6bd93a1630465dc2c6a89811053b29f797382b5d6e93d9af2e38521f248b122e33ce041868e6c297fac249f77d387ce6cf0f4fc70f73d55bf4adaf20a8b6f2a19a0b4ad1873aab0794946e2d45f707ea30dcba46b71e1aa10c45ef84127f3af4bd53a46773d2e65f0”)
Jun 03 15:44:53.196 DEBG Mining Cuckoo30 for height: 96494

What should I do? Thanks

Edit: /proc/cpuinfo starts as:
processor : 0
vendor_id : AuthenticAMD
cpu family : 16
model : 10
model name : AMD Phenom™ II X6 1075T Processor
stepping : 0
microcode : 0x10000dc
cpu MHz : 1003.970
cache size : 512 KB
physical id : 0
siblings : 6
core id : 0
cpu cores : 6
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 6
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt cpb hw_pstate vmmcall npt lbrv svm_lock nrip_save pausefilter
bugs : tlb_mmatch apic_c1e fxsave_leak sysret_ss_attrs null_seg amd_e400 spectre_v1 spectre_v2
bogomips : 5999.99
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate cpb

Can you build the solver from https://github.com/tromp/cuckoo ?

I suspect the issue might be the non-SSE2 intrinsic instruction _mm_extract_epi64, for example https://github.com/tromp/cuckoo/blob/master/src/mean_miner.hpp#L422

it’s not an SSE2 issue, since it also happens on mean_compat_cpu.
Line 171 of cuckoo_miner.h is the assignment to last_start_time in

deviceInfo::deviceInfo(){
device_id=0;
is_busy=false;
last_start_time=0;

Could this be an issue with a u64 that’s not aligned on an 8 byte boundary?

I also get illegal instruction from mean30x8 of tromp/cuckoo.

Edit: illegal instruction from all leans except lean20 and all means, but not from simple4.

Moving all u64s to front of deviceinfo class didn’t help, same problem at line 171.

x8 needs AVX-2. Try the x1 variants. Could it be you don’t have enough memory?

x1 variants aren’t built apparently, but they do work. Total mem is 16 GB which seems enough.

Is there a way to force cargo build to include e.g. -mtune=native flag when eventually calling gcc? Or are some instructions forced even on hardware that doesn’t support them? I’ve probably had similar problems with blake2 before…

I imagine you could look into https://github.com/mimblewimble/cuckoo-miner/blob/master/src/cuckoo_sys/plugins/CMakeLists.txt for what flags are used to build the binary, but I’m not familiar with cargo/rust build chain…

Switching to march=x86-64 from march=native changes the location of illegal instruction to:
Thread 5 “mining_controll” received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7ffff6844700 (LWP 21758)]
0x00007ffff5a91ec8 in cuckoo_init ()
at …/.cargo/git/checkouts/cuckoo-miner-4752934f0f1f2bfe/eb084b7/src/cuckoo_sys/plugins/cuckoo/src/cuckoo_miner/mean_miner_adds.h:43
43 strcpy(num_trims_prop.description,“The maximum number of trim rounds to perform (will be rounded to be even)\0”);

Switching from march=native to mtune=x86-64 makes mean_compat_cpu and lean_cpu work, mean_cpu still gives illegal instruction. Thanks!

Good job. mean_cpu requires AVX-2 instructions that are supported by Intel Haswell and later architectures.

You see, Ivan, when commit illegal instruction, computer go to jail.