This bugzilla service is closed. All entries have been migrated to

Bug 1705

Summary: Specifying DEIGEN_ENABLE_AVX512 results in error
Product: Eigen Reporter: Chris Elrod <elrodc>
Component: Core - vectorizationAssignee: Nobody <eigen.nobody>
Status: CONFIRMED ---    
Severity: Unknown CC: chtz, gael.guennebaud, jacob.benoit.1, markos
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Description Flags
Output of trying to compile simple program. none

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:

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

$ 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.
Comment 2 Nobody 2019-12-04 18:36:47 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: