New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1705 - Specifying DEIGEN_ENABLE_AVX512 results in error
Summary: Specifying DEIGEN_ENABLE_AVX512 results in error
Status: CONFIRMED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - vectorization (show other bugs)
Version: 3.3 (current stable)
Hardware: All All
: Normal Unknown
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-04 17:07 UTC by Chris Elrod
Modified: 2019-05-06 13:58 UTC (History)
4 users (show)



Attachments
Output of trying to compile simple program. (39.96 KB, text/plain)
2019-05-04 17:07 UTC, Chris Elrod
no flags Details

Description Chris Elrod 2019-05-04 17:07:00 UTC
Created attachment 938 [details]
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
Comment 1 Christoph Hertzberg 2019-05-06 13:58:33 UTC
Code indeed does not compile with Eigen 3.3. Independent on whether we will fix this (I'm tending not to ...) I recommend upgrading the current dev-branch if you want to use AVX512 functionality.

Note You need to log in before you can comment on or make changes to this bug.