Does MSVC 2017 support automatic CPU dispatch?

一曲冷凌霜 提交于 2021-01-27 07:30:39

问题


I read on a few sites that MSVC can actually emit say AVX instructions, when SSE2 architecture is used and detect the AVX support runtime. Is it true?

I tested various loops that would definitely benefit from AVX/AVX2 support, but when run in debugger I couldn't really find any AVX instructions.

When /arch:AVX is used, then it emits AVX instructions, but it of course crashes on CPUs that doesn't support it (tested), so no runtime detection either. I could use AVX intrinsics though and it would successfully create AVX instructions from them. Any ideas?


回答1:


I've contacted the VC++ team, and the answer is "no". The bug reports linked in the comments under the question show only normal bugs, rather than bugs in the auto-dispatch code generator.

So if /arch:SSE2 is specified (by default), VC++ can only auto-dispatch to SSE4. This is the only form of auto-dispatching that is currently supported. In other words, VC++ cannot auto-dispatch to AVX/AVX2.



来源:https://stackoverflow.com/questions/49846979/does-msvc-2017-support-automatic-cpu-dispatch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!