an odd error in mmintrin.h

I have a code of some vector library. It is a part of the application i need to port on GPU.
The library is built and installed using a simple .sh script. The library builds and installs
properly if to use the Intel compiler.
I want to use PGI 19.4 C++ compiler to port the application using this library on GPU.
But when i run the .sh script (start building), at first cmake begins normally (“pgc++/pgcc compilers work”), but then there appear a lot of such errors:

[  5%] Building CXX object CMakeFiles/genvector.dir/src/3DDistances.cxx.o
"/opt/pgi/linux86-64-llvm/19.4/include/edg/mmintrin.h", line 85: error:
          argument of type "__v2si" is incompatible with parameter of type
          "__attribute((vector_size(8))) int"
      return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
                                         ^

"/opt/pgi/linux86-64-llvm/19.4/include/edg/mmintrin.h", line 147: error:
          argument of type "__v4hi" is incompatible with parameter of type
          "__attribute((vector_size(8))) short"
      return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                                            ^

"/opt/pgi/linux86-64-llvm/19.4/include/edg/mmintrin.h", line 147: error:
          argument of type "__v4hi" is incompatible with parameter of type
          "__attribute((vector_size(8))) short"
      return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
...
Error limit reached.
100 errors detected in the compilation of "the 1st file of the library"
Compilation terminated.
...
-- The CXX compiler identification is PGI 19.4.0

And the compilation fails.

Here is the source code (if necessary to reproduce the error, please, clone the repository and run buildGenVector.sh file):
https://github.com/AndStorm/genvector.git .
I use cmake 3.13.1, pgc++ 19.4 and the compile line (in buildGenVector.sh file):
-DCMAKE_CXX_FLAGS="-mcmodel=medium -Minfo=all -acc -ta=host"
(tried to add “-m64” and “-tp=sandybridge” (the architecture of the processsor on my machine), but it does not matter; in further i will need to use “-ta=tesla”). Are the compiler flags all right?

I have been seeking for the reason of this error the whole day, but have not found any answer.

Could You be so kind to tell what the origin of the error may be, what should i do to prevent it?

Hi @and,

I downloaded and built your code using your “buildGenVector.sh” script. For good or bad, the code compiles correctly for me for both debug and release.

Example output from “Debug” build. I can post the Release output if needed, but it’s rather verbose.

Scanning dependencies of target genvector
[  5%] Building CXX object CMakeFiles/genvector.dir/src/3DDistances.cxx.o
ROOT::Math::Quaternion::Rectify():
     20, include "AxisAngle.h"
          23, include "DisplacementVector3D.h"
              703, include "BitReproducible.h"
                    20, include "iostream"
                         35, include "iostream"
                             449, FMA (fused multiply-add) instruction(s) generated
ROOT::Math::Quaternion::Distance(const ROOT::Math::Quaternion&) const:
     20, include "AxisAngle.h"
          23, include "DisplacementVector3D.h"
              703, include "BitReproducible.h"
                    20, include "iostream"
                         35, include "iostream"
                             502, FMA (fused multiply-add) instruction(s) generated
ROOT::Math::gv_detail::convert(const ROOT::Math::RotationZYX &, ROOT::Math::Quaternion &):
     20, include "AxisAngle.h"
          23, include "DisplacementVector3D.h"
              703, include "BitReproducible.h"
                    20, include "iostream"
                         35, include "iostream"
                             763, FMA (fused multiply-add) instruction(s) generated
[ 10%] Building CXX object CMakeFiles/genvector.dir/src/AxisAngle.cxx.o
ROOT::Math::Cartesian3D<double>::Mag2() const:

What OS are you using? What’s the underlying GNU version?

I’m using a Ubuntu 18.04 system with GNU 7.4.0. This is a Skylake system, but I also added “-tp sandybridge” and it still compiled correctly. Once I know you’re OS, I’ll try again on a matching system.

-Mat

My OS is Fedora 23. There is gcc 5.4.1 (if i don’ mistake, something 5.4.x, can’t check now) installed on it.
My colleague tried to compile another library, which we use in our application, on his machine (Debian, gcc 7.4.0). It also compiled with Intel compiler and failed if to use PGI compiler with a very similar error.
He and me used PGI 19.4 compiler properly installed on our machines.

If it is possible, i would like to know what this error means, maybe in a few simple words, because i did not find any explanation on the Internet.

Checked the parameters of my machine (these are correct, in the previous post incorrect):
$ gcc/g++ --version:
gcc/g++ (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
$ pgcc/pgc++ --version:
pgcc/pgc++ 19.4-0 LLVM 64-bit target on x86-64 Linux -tp sandybridge

“$ uname -a”:
Linux … 4.6.4-201.fc23.x86_64 #1 SMP Tue Jul 12 11:43:59 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

From “$ lscpu”:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit

Model name: Intel® Core™ i7-3770 CPU @ 3.40GHz

“$ hostnamectl”:
Static hostname: localhost.localdomain

Operating System: Fedora 23 (Twenty Three)
CPE OS Name: cpe:/o:fedoraproject:fedora:23
Kernel: Linux 4.6.4-201.fc23.x86_64
Architecture: x86-64

CUDA Version 10.1, CUDA Driver Version 418.67.
I tried to change the compiler flags in the line export CXXFLAGS="-mcmodel=medium -Minfo=all -acc -ta=host" of the buildGenVector.sh file. Tried to replace “-acc -ta=host” with “-acc -tp=sandybridge”, “-tp=sandybridge”, “-tp=haswell”, " " (nothing), but the compilation fails with the same error.

Hi @and,

Thanks for the information. When using a system with GNU 5.4.0, I was able to recreate the error.

The problem here is the inclusion of the “-A” flag. “-A” tells the compiler to strictly enforce the C++ standard and gets implicitly added by CMake when setting language conformance settings in a CMake command. Older GNU header files are not always strictly standard conforming and will error when “-A” is used.

This is what’s happening here and why it works for me when using a system with GNU 7.4.

Unfortunately, I’m not familiar enough with cmake to know how to get cmake to stop adding “-A”. If you can find a way, that would be the preferred option. I tried removing “-DCMAKE_CXX_STANDARD=17”, but cmake still will add “-A”.

(Side note, GNU didn’t add C++17 support until the 7.x releases, so if you really need C++17, you might want to install a newer version. In order to be object compatible with GNU, we need to use their system header files and C++ STL, so our supported C++ language standard level depends on the GNU version installed.)

To work around the issue, I manually edited the “flags.make” files to remove “-A”, and the ran make in both the Release and Debug builds.

./genvector/Debug/CMakeFiles/genvector.dir/flags.make
./genvector/Debug/test/CMakeFiles/testConstexpr.dir/flags.make
./genvector/Release/CMakeFiles/genvector.dir/flags.make
./genvector/Release/test/CMakeFiles/testConstexpr.dir/flags.make

Hope this helps,
Mat

Thank You. I wrote an .sh script which removes “-A” compiler flag in all “flags.make” files after “cmake” and before “make” and the library compiles and installes.
Excuse me, do You know what the error:
“Accelerator restriction: unsupported operation: X87FROMKINT”
may mean? I get it in the other part of the code.