Skip to content

fix _mm512_i32gather_epi32 and other scatter/gather routines have incorrect signature.#4959

Merged
nihui merged 1 commit intoTencent:masterfrom
chainsx:master
Aug 19, 2023
Merged

fix _mm512_i32gather_epi32 and other scatter/gather routines have incorrect signature.#4959
nihui merged 1 commit intoTencent:masterfrom
chainsx:master

Conversation

@chainsx
Copy link

@chainsx chainsx commented Aug 19, 2023

Errors may occur in gcc versions below 7.0, with the following logs:

[ 56%] Building CXX object src/CMakeFiles/ncnn.dir/layer/deconvolution.cpp.o
/root/ncnn/src/layer/x86/convolution_packed_int8.h:673:114: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                 __m128i _w0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, kptr0 + k, sizeof(signed char)));
                                                                                                                  ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:674:114: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                 __m128i _w1 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, kptr1 + k, sizeof(signed char)));
                                                                                                                  ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:702:114: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                 __m128i _w0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, kptr0 + k, sizeof(signed char)));
                                                                                                                  ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:808:113: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                 __m128i _w0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, kptr + k, sizeof(signed char)));
                                                                                                                 ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h: In function 'void ncnn::convolution_packed_int8(const ncnn::Mat&, ncnn::Mat&, const ncnn::Mat&, int, int, int, int, int, int, const ncnn::Option&)':
/root/ncnn/src/layer/x86/convolution_packed_int8.h:1032:108: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                         _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                            ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:1033:108: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                         _r1 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r1s, sizeof(signed char)));
                                                                                                            ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:1034:108: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                         _r2 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r2s, sizeof(signed char)));
                                                                                                            ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:1035:108: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                         _r3 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r3s, sizeof(signed char)));
                                                                                                            ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:1397:108: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                         _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                            ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:1398:108: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                         _r1 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r1s, sizeof(signed char)));
                                                                                                            ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:1652:108: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                         _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                            ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:1913:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:1914:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r1 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r1s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:1915:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r2 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r2s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:1916:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r3 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r3s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:2320:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:2321:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r1 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r1s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:2604:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:2885:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:2886:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r1 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r1s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:2887:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r2 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r2s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:2888:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r3 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r3s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:3340:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:3341:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r1 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r1s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:3672:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:3989:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:3990:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r1 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r1s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:3991:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r2 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r2s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:3992:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r3 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r3s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:4327:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:4328:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r1 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r1s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:4565:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:4793:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:4794:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r1 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r1s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:4795:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r2 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r2s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:4796:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r3 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r3s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:5074:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:5075:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r1 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r1s, sizeof(signed char)));
                                                                                                                ^
/root/ncnn/src/layer/x86/convolution_packed_int8.h:5267:112: error: cannot convert 'const signed char*' to 'const int*' for argument '2' to '__m512i _mm512_i32gather_epi32(__m512i, const int*, int)'
                             _r0 = _mm512_cvtepi32_epi8(_mm512_i32gather_epi32(_vindex, r0s, sizeof(signed char)));
                                                                                                                ^
[ 56%] Building CXX object src/CMakeFiles/ncnn.dir/layer/x86/deconvolution_x86.cpp.o
[ 56%] Building CXX object src/CMakeFiles/ncnn.dir/layer/x86/deconvolution_x86_avx512.cpp.o
[ 56%] Building CXX object src/CMakeFiles/ncnn.dir/layer/x86/deconvolution_x86_fma.cpp.o
[ 57%] Building CXX object src/CMakeFiles/ncnn.dir/layer/x86/deconvolution_x86_avx.cpp.o
src/CMakeFiles/ncnn.dir/build.make:2366: recipe for target 'src/CMakeFiles/ncnn.dir/layer/x86/convolution_x86_avx512.cpp.o' failed
make[2]: *** [src/CMakeFiles/ncnn.dir/layer/x86/convolution_x86_avx512.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:118: recipe for target 'src/CMakeFiles/ncnn.dir/all' failed
make[1]: *** [src/CMakeFiles/ncnn.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
root@virtual-machine:~/ncnn/build# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)

But we can find a solution here:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=76731

@tencent-adm
Copy link
Member

tencent-adm commented Aug 19, 2023

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2023

Codecov Report

Merging #4959 (e779ca1) into master (cbd838f) will not change coverage.
Report is 1 commits behind head on master.
The diff coverage is 92.53%.

@@           Coverage Diff           @@
##           master    #4959   +/-   ##
=======================================
  Coverage   94.90%   94.90%           
=======================================
  Files         776      776           
  Lines      226448   226448           
=======================================
  Hits       214910   214910           
  Misses      11538    11538           
Files Changed Coverage Δ
src/layer/x86/convolution_packed_int8.h 97.22% <92.53%> (ø)

@nihui nihui merged commit 6b657a3 into Tencent:master Aug 19, 2023
@nihui
Copy link
Member

nihui commented Aug 19, 2023

Thanks for your contribution !

@maxint
Copy link
Contributor

maxint commented Sep 25, 2023

ubuntu 16.04 gcc 5.4 遇到这个错误,想不到这么快就有人修了,赞一个!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants