Specifying DEIGEN_ENABLE_AVX512 results in error
Submitted by Chris Elrod
Assigned to Nobody
Link to original bugzilla bug (#1705)
Version: 3.3 (current stable)
Description
Created attachment 938
Output of trying to compile simple program.
I attached a file showing what happens when I try to compile an extremely simple "hello world" program with the flag -DEIGEN_ENABLE_AVX512
using both g++ and clang++:
#include <iostream>
#include <Eigen/Dense>
using Eigen::MatrixXd;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << m << std::endl;
}
I chose the label "Core-vectorization" because (in examples that are actually vectorizable) DEIGEN_ENABLE_AVX512 is supposed to enable explicit vectorization, according the docs for Eigen 3.3: http://eigen.tuxfamily.org/index.php?title=3.3
They both run into the same errors. The program works as expected when not defining the macro.
The first couple lines of g++ errors:
In file included from /usr/include/eigen3/Eigen/Core:379,
from /usr/include/eigen3/Eigen/Dense:1,
from eigen_hello_world.cpp:2:
/usr/include/eigen3/Eigen/src/Core/arch/AVX512/PacketMath.h: In function ‘Packet Eigen::internal::preduxp(const Packet*) [with Packet = __vector(16) float]’:
/usr/include/eigen3/Eigen/src/Core/arch/AVX512/PacketMath.h:663:56: error: expected ‘,’ or ‘;’ before ‘__m256’
663 | __m256 OUTPUT##_0 = _mm512_extractf32x8_ps(INPUT, 0) __m256 OUTPUT##_1 = \
| ^~~~~~
The first few lines of clang++ errors:
$ clang++ -O3 -DEIGEN_ENABLE_AVX512 -march=skylake-avx512 -I/usr/include/eigen3 eigen_hello_world.cpp -o eigen_hello_world
In file included from eigen_hello_world.cpp:2:
In file included from /usr/include/eigen3/Eigen/Dense:1:
In file included from /usr/include/eigen3/Eigen/Core:379:
/usr/include/eigen3/Eigen/src/Core/arch/AVX512/PacketMath.h:689:3: error: expected ';' at end of declaration
EIGEN_EXTRACT_8f_FROM_16f(vecs[0], vecs0);
^
Compiler versions:
$ g++ --version
g++ (Clear Linux OS for Intel Architecture) 9.1.1 20190503 gcc-9-branch@270849
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ clang++ --version
clang version 8.0.0 (tags/RELEASE_800/final)
Target: x86_64-generic-linux
Thread model: posix
InstalledDir: /usr/bin
Attachment 938, "Output of trying to compile simple program.":
eigen_errors.txt