AnsweredAssumed Answered

AVX instruction in runtime library

Question asked by dmantione on Mar 29, 2013
Latest reply on Apr 1, 2013 by saravanan_ekanathan



I am trying to compile OpenMPI with Open64 I want to support pre-Buldozer processors. The configure fails with an "Illegal instruction" error.


After analysis, the configure script tries to compile this program:


program f90findintkind

    open(8, file="conftestval")

    write(8, fmt="(I5)") selected_int_kind(19)


end program


And indeed:


[root@benchmark openmpi-1.6.4]# openf90 -march=anyx86 -o conftestf conftestf.f90

[root@benchmark openmpi-1.6.4]# ./conftestf

Illegal instruction (core dumped)

[root@benchmark openmpi-1.6.4]#


Analysis shows the error to occur in _s2ui, which is part of libffio:


(gdb) info stack

#0  _s2ui () at /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libu/numconv/mpp/s2uboiz.c:440

#1  0x00002aaaaab0bf03 in _wrfmt () at /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/wrfmt.c:606

#2  0x00002aaaaaad7017 in _xfer_iolist () at /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/dopexfer.c:264

#3  0x00002aaaaab0a243 in _FWF () at /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/wf90.c:442

#4  0x000000000040099e in MAIN__ () at /usr/src/openmpi-1.6.4/conftestf.f90:3


(gdb) disass _s2ui

Dump of assembler code for function _s2ui:

=> 0x00002aaaab349e80 <+0>:     vzeroupper

   0x00002aaaab349e83 <+3>:     add    $0xfffffffffffffed8,%rsp

   0x00002aaaab349e8a <+10>:    mov    (%rdx),%r10

   0x00002aaaab349e8d <+13>:    test   $0x10,%r10


vzeroupper is an AVX instruction!


Why does the Open64 runtime library use AVX instructions in default code paths?