gcc-6 function multiple version didn't work with Eigen (target_clones)
Submitted by Zhili Zheng
Assigned to Nobody
Link to original bugzilla bug (#1542)
Version: 3.3 (current stable)
Operating system: Linux
Description
gcc-6 has a robust feature that can compile and dispatch different functions according to hardware supported.
(One example: https://lwn.net/Articles/691932/)
However, when compile with Eigen
gcc-6 -msse2 -I$EIGEN_DIR
/* codes start
#include <Eigen/Dense>
attribute((target_clones("avx512f","avx2","default")))
int func1(){
...Eigen releated...
}
*/ codes end
From the assembly view, Eigen compiled with only SSE2 support. The func1 do have avx512, avx2, and sse variants, but the contents are almost the same.
I know Eigen decides the feature supported in the compile time (template), determined by the compile flags pass in.
Is it possible to hot switch while target_clones gives different compile flags in his variant function?
Thank you.