kloewe / mod-dot

dot product (c module)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User-provided C flags containing -march=core-avx2 causes link failure

coalsont opened this issue · comments

See Washington-University/workbench#34 (comment)

The user was providing added compiler options to try to automatically vectorize things (-O3 -DNDEBUG -ftree-vectorize -march=core-avx2 -mavx2), but when these were passed into the dot library, it caused the function names of the dot_avx.c functions to never be compiled as sdot_avx, etc. I am guessing that -march=core-avx2 may imply -mfma, and therefore it just made two copies of sdot_avxfma, etc.

If this is the reason, it would probably be more robust to use a define like DOT_USE_FMA for the purpose of changing the function name and tweaking the implementation, instead of the __FMA__ that can unintentionally be triggered by a user playing with standard project-wide compiler flags.