-
-
Notifications
You must be signed in to change notification settings - Fork 774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avx512 for add_vectorexts #1613
Comments
自己改下 xmake/xmake/modules/core/tools/cl.lua Line 178 in 4497dd3
|
看了下 https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html MSVC的avx512就一个flag if is_plat("windows") then
add_cxxflags("/arch:AVX512") -- leave detection to xmake
else
add_cxxflags("-march=native")
end |
不好抽象的话,就先外面设置下好了 |
似乎有些cmake项目用-mavx512f -mavx512dq -mavx512bw -mavx512vl这几个flag同时存在来判断avx512,是否可以借鉴一下? https://www.zhihu.com/question/433345697/answer/1611130480 根据这篇文章,这几个flag也是普通cpu主要支持的几个,其他很多是专业cpu才有 |
最近没啥空,如果好搞,就来个 pr 过来好了 |
gcc 用这个呢?-march=skylake-avx512 https://www.gnu.org/software/gcc/gcc-6/changes.html
chatgpt 也推荐这个 |
我加上了,可以试试,sse4.2 顺带一起加了 #4012
|
这个我觉得不太合适吧,arch指定为skylake-avx512意味着skylake-avx512之后的intrinsic都被禁用了,而且没法通过加flag开启,会有副作用。我觉得不如反向考虑,给windows加一个 |
I don't think this is appropriate. The arch designation as skylake-avx512 means that the intrinsics after skylake-avx512 are disabled, and it cannot be enabled by adding a flag, which will have side effects. I think it is better to think in reverse, add an option of |
那这个 native 的语义不是就是 all 么。。那直接用 |
我改了下,再看看呢。。 add_vectorexts("avx512") 默认 gcc 下,我暂时加了 然后额外加了个 all,gcc 下对标 -march=native,msvc 下,加上了全部 add_vectorexts("all") |
主要是有的avx指令当前平台不支持,-march=native只在支持avx512的平台开启avx512,就像c++latest也不一定是c++23 |
所以它这个 native 的语义很晦涩,xmake 里面还是用 all 更贴切直观。。就是尽可能开启全部能支持的 simd 指令。。内部到底用 -march:native ,或者改成其他的,或者加其他组合,都可以随时变,并不是跟 -march=native 强绑定的 |
如果现在这个 patch 没啥问题,我就先 merge 了 |
The main reason is that some avx instructions are not supported by the current platform. -march=native only enables avx512 on platforms that support avx512, just like c++latest is not necessarily c++23 |
So the semantics of its native is very obscure, and it is more appropriate and intuitive to use all in xmake. . It is to enable all supported simd instructions as much as possible. . Use -march:native internally, or change it to other, or add other combinations, it can be changed at any time, and it is not strongly bound to -march=native |
If there is nothing wrong with this patch now, I will merge it first |
你在什么场景下需要该功能?
当前的
add_vectorexts("avx512")
无法添加avx512的flag,只能手动加/arch:AVX512描述可能的解决方案
add_vectorexts支持avx512
The text was updated successfully, but these errors were encountered: