Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Program received signal SIGILL, Illegal instruction

Bill_B_2
Beginner
6,734 Views

hi guys

error occured while i run my avx program which was compiled by gcc 4.9,here is the error

##

Program received signal SIGILL, Illegal instruction.
0x0000000000402da0 in _mm256_set_epi32 (__H=16711935, __G=16711935,
    __F=16711935, __E=16711935, __D=16711935, __C=16711935, __B=16711935,
    __A=16711935)
    at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/include/avxintrin.h:1231
1231      return __extension__ (__m256i)(__v8si){ __H, __G, __F, __E,

##

and the makefile:

##

Objects=TurboCode.o test.o
CC=gcc
CFLAGS=-march=native -mavx -mavx2 -ggdb
avx: $(Objects)
        $(CC) $(CFLAGS) -o avx $(Objects)

TurboCode.o:TurboCode.c TurboCode.h
        $(CC) $(CFLAGS) -c $<

test.o:test.c TurboCode.h
        $(CC) $(CFLAGS) -c $<
.PHONY:all clean
clean:
        rm $(Objects)
all:avx clean

##

do anyone know how to solve?

 

 

0 Kudos
1 Solution
TimP
Honored Contributor III
6,735 Views

This seems more topical for gcc-help mailing list; you don't indicate that you tried any Intel compiler.  Without a full working example, no one can tell you if this is a compiler version dependent bug or a problem in your source code....

It makes a difference whether you have an up to date gcc, at least 4.9.2, preferably 5.2.  There were lots of AVX2 bugs in 4.9.0.  Of course, if your run machine doesn't support avx2 (e.g. in the list in /proc/cpuinfo), you will expect to see this problem.

Are you assuming that -mavx2 will over-ride -mavx and -march=native?  I would have more confidence if you set the one you actually want.

View solution in original post

0 Kudos
8 Replies
TimP
Honored Contributor III
6,736 Views

This seems more topical for gcc-help mailing list; you don't indicate that you tried any Intel compiler.  Without a full working example, no one can tell you if this is a compiler version dependent bug or a problem in your source code....

It makes a difference whether you have an up to date gcc, at least 4.9.2, preferably 5.2.  There were lots of AVX2 bugs in 4.9.0.  Of course, if your run machine doesn't support avx2 (e.g. in the list in /proc/cpuinfo), you will expect to see this problem.

Are you assuming that -mavx2 will over-ride -mavx and -march=native?  I would have more confidence if you set the one you actually want.

0 Kudos
KitturGanesh
Employee
6,735 Views

I agree with Tim in that you should set the one you want although the assumption is -mavx2 overrides mavx. And, yes you should have GCC 4.9 version to ensure support for avx2 and running on a supported system as well.

_Kittur

0 Kudos
KitturGanesh
Employee
6,735 Views

Hi Bill, any update? Is the issue resolved now? Thanks.

_Kittur

0 Kudos
Bill_B_2
Beginner
6,735 Views

hi Tim and Kittur,i tried again with icc(version 16.0),with option -xCORE-AVX2 -g -O0, it fixd the problem about"_mm256_set_epi32",however,

int qbits=4;

int a=1<<qbits;

goes wrong,but “int a=1<<4"is OK.

and "_mm256_insertf128_si256(_mm256_castsi128_si256(llra_in_128i), (llrb_in_128i), 0x1)" was tested to be a illegal instruction witch is just a normal avx instruction.

ps:no such errors when compiling on windows with visual studio 2015

0 Kudos
Bill_B_2
Beginner
6,735 Views

I juset checked the assemble directives and found that only AVX2 directives cracked,both in "1<<qbits" and other avx2-related instructions.

my cpu is intel E5-4620,and my makefile :

##

Objects=TurboCode.o test.o
CC=icc
CFLAGS= -xCORE-AVX2 -g -O0 -I/usr/include/x86_64-linux-gnu/
avx: $(Objects)
        $(CC) $(CFLAGS) -o avx $(Objects)

TurboCode.o:TurboCode.c TurboCode.h
        $(CC) $(CFLAGS) -c $<

test.o:test.c TurboCode.h
        $(CC) $(CFLAGS) -c $<
.PHONY:all clean
clean:
        rm $(Objects)
all:avx clean

##

  why the AVX2 instructions go wrong?      

 

0 Kudos
Bill_B_2
Beginner
6,735 Views

Sadly,i found that my cpu doesn't support avx2 ,thank you guys

 

0 Kudos
KitturGanesh
Employee
6,735 Views

Hi Bill,  I was about to ask you to check your system if it supported avx2. Glad the issue is resolved.... _Kittur

0 Kudos
KitturGanesh
Employee
6,735 Views

Hi Hans,
The Intel compiler definitely supports _mm256_set_epi32 when targeting AVX. But if the command line options indicate AVX2 can be used (e.g., -xCORE-AVX2), then teh compiler might use an AVX2 instruction to implement it (e.g., vinserti128, instead of vinsertf128). That said, the issue appears to be that using -xCORE-AVX2 allows that shift to be implemented with the AVX2 shlx instruction.

Regards,
Kittur

 

0 Kudos
Reply