This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1542 - gcc-6 function multiple version didn't work with Eigen (target_clones)
Summary: gcc-6 function multiple version didn't work with Eigen (target_clones)
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.3 (current stable)
Hardware: x86 - AVX Linux
: Normal Feature Request
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-12 00:22 UTC by Zhili Zheng
Modified: 2019-12-04 17:37 UTC (History)
3 users (show)



Attachments

Description Zhili Zheng 2018-04-12 00:22:36 UTC
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.
Comment 1 Christoph Hertzberg 2018-04-14 18:40:26 UTC
I don't see how this would even theoretically solvable.
Maybe it is possible to clutter all Eigen functions with __attribute__((target_clones( ... ))) and hope that inlining makes this magically work.

The alternative is to compile multiple versions of the function with different flags and link them together.
Comment 2 Nobody 2019-12-04 17:37:38 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com'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: https://gitlab.com/libeigen/eigen/issues/1542.

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