Github messages for voidlinux
 help / color / mirror / Atom feed
* [ISSUE] openblas: illegal instruction (nehalem)
@ 2021-03-20  3:44 gt7-void
  2021-03-20  4:21 ` ericonr
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gt7-void @ 2021-03-20  3:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2376 bytes --]

New issue by gt7-void on void-packages repository

https://github.com/void-linux/void-packages/issues/29604

Description:
The cpu is a [xeon E5520](https://ark.intel.com/content/www/us/en/ark/products/40200/intel-xeon-processor-e5520-8m-cache-2-26-ghz-5-86-gt-s-intel-qpi.html) (nehalem EP)
The following short program shows the issue:
```
#include "cblas.h"

int main ()
{
        double a[4] = {1.,2.,3.,4.};
        double b[4] = {4.,3.,2.,1.};
        double c[4];
        cblas_dgemm(CblasRowMajor, CblasNoTrans,CblasNoTrans,2,2,2,1., a,2,b,2,0.,c,2);
        if ( (c[0]!=8.) && (c[1]!=5.) && (c[2]!=20.) && (c[3]!=13))
                return -1;
        else
                return 0;
}
```

Compile and run with
```
$ gcc test-blas.c -I /usr/include/openblas -lopenblas -o test-blas
$ ./test-blas 
Illegal instruction
```

debugging shows the fault is in `cblas_dgemm ()` from `/usr/lib/libopenblas.so.0`, more precisely at `cblas_dgemm+20`:
```
   0x00007ffff6427d80 <+0>:     push   %r15
   0x00007ffff6427d82 <+2>:     mov    %edx,%r10d
   0x00007ffff6427d85 <+5>:     push   %r14
   0x00007ffff6427d87 <+7>:     push   %r13
   0x00007ffff6427d89 <+9>:     push   %r12
   0x00007ffff6427d8b <+11>:    push   %rbp
   0x00007ffff6427d8c <+12>:    push   %rbx
   0x00007ffff6427d8d <+13>:    sub    $0xa8,%rsp
=> 0x00007ffff6427d94 <+20>:    vmovsd %xmm0,0x8(%rsp)
   0x00007ffff6427d9a <+26>:    mov    0xe0(%rsp),%rdx
   0x00007ffff6427da2 <+34>:    mov    0xf0(%rsp),%r11
   0x00007ffff6427daa <+42>:    vmovsd %xmm1,(%rsp)
   0x00007ffff6427daf <+47>:    mov    0x100(%rsp),%rax
   0x00007ffff6427db7 <+55>:    mov    %fs:0x28,%rbx
```

Instruction is `vmovsd` -- I guess not available in this cpu (how would I know? is this avx? if so, how did this instruction end up there?)

Here are my cpuflags:
```
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 ht tm pbe syscall nx rdtscp lm con
                                 stant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pd
                                 cm dca sse4_1 sse4_2 popcnt lahf_lm pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid dtherm ida flush_l1d
```



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: openblas: illegal instruction (nehalem)
  2021-03-20  3:44 [ISSUE] openblas: illegal instruction (nehalem) gt7-void
@ 2021-03-20  4:21 ` ericonr
  2021-03-21  4:20 ` gt7-void
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2021-03-20  4:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/issues/29604#issuecomment-803244447

Comment:
Related? https://github.com/xianyi/OpenBLAS/issues/3139

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: openblas: illegal instruction (nehalem)
  2021-03-20  3:44 [ISSUE] openblas: illegal instruction (nehalem) gt7-void
  2021-03-20  4:21 ` ericonr
@ 2021-03-21  4:20 ` gt7-void
  2021-03-21  4:23 ` ericonr
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gt7-void @ 2021-03-21  4:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 405 bytes --]

New comment by gt7-void on void-packages repository

https://github.com/void-linux/void-packages/issues/29604#issuecomment-803509801

Comment:
> Related? [xianyi/OpenBLAS#3139](https://github.com/xianyi/OpenBLAS/issues/3139)

Yes! It works!

See PR #29645: as a test I built the pkg on a skylake cpu, then I installed it on my nehalem cpu, and now the test program above runs without any problem.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: openblas: illegal instruction (nehalem)
  2021-03-20  3:44 [ISSUE] openblas: illegal instruction (nehalem) gt7-void
  2021-03-20  4:21 ` ericonr
  2021-03-21  4:20 ` gt7-void
@ 2021-03-21  4:23 ` ericonr
  2021-03-21  4:35 ` gt7-void
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2021-03-21  4:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 213 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/issues/29604#issuecomment-803510036

Comment:
You did what I suggested in my comment in the PR :p

That's great :)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: openblas: illegal instruction (nehalem)
  2021-03-20  3:44 [ISSUE] openblas: illegal instruction (nehalem) gt7-void
                   ` (2 preceding siblings ...)
  2021-03-21  4:23 ` ericonr
@ 2021-03-21  4:35 ` gt7-void
  2021-03-21 13:28 ` ericonr
  2021-03-21 13:29 ` [ISSUE] [CLOSED] " ericonr
  5 siblings, 0 replies; 7+ messages in thread
From: gt7-void @ 2021-03-21  4:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 324 bytes --]

New comment by gt7-void on void-packages repository

https://github.com/void-linux/void-packages/issues/29604#issuecomment-803510893

Comment:
> You did what I suggested in my comment in the PR :p
> 
> That's great :)

Sorry, the split between issues and PR still confuses me. We end up duplicating the conversation :-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: openblas: illegal instruction (nehalem)
  2021-03-20  3:44 [ISSUE] openblas: illegal instruction (nehalem) gt7-void
                   ` (3 preceding siblings ...)
  2021-03-21  4:35 ` gt7-void
@ 2021-03-21 13:28 ` ericonr
  2021-03-21 13:29 ` [ISSUE] [CLOSED] " ericonr
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2021-03-21 13:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/issues/29604#issuecomment-803580099

Comment:
Closed with #29645 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ISSUE] [CLOSED] openblas: illegal instruction (nehalem)
  2021-03-20  3:44 [ISSUE] openblas: illegal instruction (nehalem) gt7-void
                   ` (4 preceding siblings ...)
  2021-03-21 13:28 ` ericonr
@ 2021-03-21 13:29 ` ericonr
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2021-03-21 13:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2528 bytes --]

Closed issue by gt7-void on void-packages repository

https://github.com/void-linux/void-packages/issues/29604

Description:
The cpu is a [xeon E5520](https://ark.intel.com/content/www/us/en/ark/products/40200/intel-xeon-processor-e5520-8m-cache-2-26-ghz-5-86-gt-s-intel-qpi.html) (nehalem EP)
The following short program shows the issue:
```
#include "cblas.h"

int main ()
{
        double a[4] = {1.,2.,3.,4.};
        double b[4] = {4.,3.,2.,1.};
        double c[4];
        cblas_dgemm(CblasRowMajor, CblasNoTrans,CblasNoTrans,2,2,2,1., a,2,b,2,0.,c,2);
        if ( (c[0]!=8.) && (c[1]!=5.) && (c[2]!=20.) && (c[3]!=13))
                return -1;
        else
                return 0;
}
```

Compile and run with
```
$ gcc test-blas.c -I /usr/include/openblas -lopenblas -o test-blas
$ ./test-blas 
Illegal instruction
```

debugging shows the fault is in `cblas_dgemm ()` from `/usr/lib/libopenblas.so.0`, more precisely at `cblas_dgemm+20`:
```
   0x00007ffff6427d80 <+0>:     push   %r15
   0x00007ffff6427d82 <+2>:     mov    %edx,%r10d
   0x00007ffff6427d85 <+5>:     push   %r14
   0x00007ffff6427d87 <+7>:     push   %r13
   0x00007ffff6427d89 <+9>:     push   %r12
   0x00007ffff6427d8b <+11>:    push   %rbp
   0x00007ffff6427d8c <+12>:    push   %rbx
   0x00007ffff6427d8d <+13>:    sub    $0xa8,%rsp
=> 0x00007ffff6427d94 <+20>:    vmovsd %xmm0,0x8(%rsp)
   0x00007ffff6427d9a <+26>:    mov    0xe0(%rsp),%rdx
   0x00007ffff6427da2 <+34>:    mov    0xf0(%rsp),%r11
   0x00007ffff6427daa <+42>:    vmovsd %xmm1,(%rsp)
   0x00007ffff6427daf <+47>:    mov    0x100(%rsp),%rax
   0x00007ffff6427db7 <+55>:    mov    %fs:0x28,%rbx
```

Instruction is `vmovsd` -- I guess not available in this cpu (how would I know? is this avx? if so, how did this instruction end up there?)

Here are my cpuflags (no avx):
```
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 ht tm pbe syscall nx rdtscp lm con
                                 stant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pd
                                 cm dca sse4_1 sse4_2 popcnt lahf_lm pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid dtherm ida flush_l1d
```

The second oldest machine I have available at this time is sandy bridge E (i7-3930K), which does have `avx` and the program above runs ok.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-21 13:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-20  3:44 [ISSUE] openblas: illegal instruction (nehalem) gt7-void
2021-03-20  4:21 ` ericonr
2021-03-21  4:20 ` gt7-void
2021-03-21  4:23 ` ericonr
2021-03-21  4:35 ` gt7-void
2021-03-21 13:28 ` ericonr
2021-03-21 13:29 ` [ISSUE] [CLOSED] " ericonr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).