Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last argument must be an 8-bit immediate #9

Open
fritterhoff opened this issue Dec 18, 2019 · 3 comments
Open

Last argument must be an 8-bit immediate #9

fritterhoff opened this issue Dec 18, 2019 · 3 comments

Comments

@fritterhoff
Copy link
Contributor

I tried to build my project for avx512 but I'm getting some errors which can be reproduced building the test on the same target.

[  6%] Building CXX object CMakeFiles/run_tests.dir/src/arithmetic_operations/fmadd.cpp.o
[  6%] Building CXX object CMakeFiles/run_tests.dir/src/arithmetic_operations/div4.cpp.o
[  6%] Building CXX object CMakeFiles/run_tests.dir/src/arithmetic_operations/div.cpp.o
[  6%] Building CXX object CMakeFiles/run_tests.dir/src/arithmetic_operations/div2.cpp.o
In file included from /home/debian/MIPP/tests/../src/mipp.h:1240:0,
                 from /home/debian/MIPP/tests/src/arithmetic_operations/div4.cpp:6:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx: In function ‘mipp::reg mipp::rshift(mipp::reg, uint32_t) [with T = long int]’:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx:2164:29: error: the last argument must be an 8-bit immediate
   return _mm512_castsi512_ps(_mm512_srli_epi64(_mm512_castps_si512(v1), n));
          ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-linux-gnu/6/include/immintrin.h:45:0,
                 from /home/debian/MIPP/tests/../src/math/avx512_mathfun.h:14,
                 from /home/debian/MIPP/tests/../src/mipp.h:45,
                 from /home/debian/MIPP/tests/src/arithmetic_operations/div4.cpp:6:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx: In function ‘mipp::reg mipp::rshift(mipp::reg, uint32_t) [with T = int]’:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx:2170:30: error: the last argument must be an 8-bit immediate
   return _mm512_castsi512_ps(_mm512_srli_epi32(_mm512_castps_si512(v1), n));
                              ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/6/include/immintrin.h:55:0,
                 from /home/debian/MIPP/tests/../src/math/avx512_mathfun.h:14,
                 from /home/debian/MIPP/tests/../src/mipp.h:45,
                 from /home/debian/MIPP/tests/src/arithmetic_operations/div4.cpp:6:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx: In function ‘mipp::reg mipp::rshift(mipp::reg, uint32_t) [with T = short int]’:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx:2176:30: error: the last argument must be an 8-bit immediate
   return _mm512_castsi512_ps(_mm512_srli_epi16(_mm512_castps_si512(v1), n));
                              ^
In file included from /home/debian/MIPP/tests/../src/mipp.h:1240:0,
                 from /home/debian/MIPP/tests/src/arithmetic_operations/div2.cpp:6:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx: In function ‘mipp::reg mipp::rshift(mipp::reg, uint32_t) [with T = long int]’:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx:2164:29: error: the last argument must be an 8-bit immediate
   return _mm512_castsi512_ps(_mm512_srli_epi64(_mm512_castps_si512(v1), n));
          ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-linux-gnu/6/include/immintrin.h:45:0,
                 from /home/debian/MIPP/tests/../src/math/avx512_mathfun.h:14,
                 from /home/debian/MIPP/tests/../src/mipp.h:45,
                 from /home/debian/MIPP/tests/src/arithmetic_operations/div2.cpp:6:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx: In function ‘mipp::reg mipp::rshift(mipp::reg, uint32_t) [with T = int]’:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx:2170:30: error: the last argument must be an 8-bit immediate
   return _mm512_castsi512_ps(_mm512_srli_epi32(_mm512_castps_si512(v1), n));
                              ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/6/include/immintrin.h:55:0,
                 from /home/debian/MIPP/tests/../src/math/avx512_mathfun.h:14,
                 from /home/debian/MIPP/tests/../src/mipp.h:45,
                 from /home/debian/MIPP/tests/src/arithmetic_operations/div2.cpp:6:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx: In function ‘mipp::reg mipp::rshift(mipp::reg, uint32_t) [with T = short int]’:
/home/debian/MIPP/tests/../src/mipp_impl_AVX512.hxx:2176:30: error: the last argument must be an 8-bit immediate
   return _mm512_castsi512_ps(_mm512_srli_epi16(_mm512_castps_si512(v1), n));
                              ^
CMakeFiles/run_tests.dir/build.make:182: recipe for target 'CMakeFiles/run_tests.dir/src/arithmetic_operations/div4.cpp.o' failed
make[2]: *** [CMakeFiles/run_tests.dir/src/arithmetic_operations/div4.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[  8%] Building CXX object CMakeFiles/run_tests.dir/src/arithmetic_operations/fmsub.cpp.o
CMakeFiles/run_tests.dir/build.make:158: recipe for target 'CMakeFiles/run_tests.dir/src/arithmetic_operations/div2.cpp.o' failed
make[2]: *** [CMakeFiles/run_tests.dir/src/arithmetic_operations/div2.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/run_tests.dir/all' failed
make[1]: *** [CMakeFiles/run_tests.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

@kouchy
Copy link
Member

kouchy commented Dec 18, 2019

Yes I'm aware of this bug. The problem is that the shift instruction is waiting for an argument known at the compile time (an immediate). This is not the case in MIPP if the compiler does not perform some inlining optimizations so you have to compile with -O2 or -O3 to fix this compiler error. Try this and tell me if you have still the bug.

@fritterhoff
Copy link
Contributor Author

Maybe we could change the call into _mm512_srlv_epi64/_mm512_srlv_epi32/_mm512_srlv_epi16, This requires a register as second argument, which needs not to be known at compile time 😉

@kouchy
Copy link
Member

kouchy commented Mar 5, 2020

This instructions already exist in MIPP, check lshiftr and rshiftr :-) (commit: 5f72cc4).

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

No branches or pull requests

2 participants