VS compile AVX512

Discussion of chess software programming and technical issues.

Moderator: Ras

Joost Buijs
Posts: 1632
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: VS compile AVX512

Post by Joost Buijs »

chrisw wrote: Tue Apr 11, 2023 8:07 pm
chrisw wrote: Tue Apr 11, 2023 7:34 pm
Bo Persson wrote: Tue Apr 11, 2023 6:56 pm
chrisw wrote: Tue Apr 11, 2023 5:20 pm I think I dl-ed clang into VS but can’t find anything on any menu that says so
Check your Project Properties. In the Platform Toolset drop down box you should have LLVM as an alternative.
Ahh! That's where it was hiding. 100 new warnings and one successful compile later, and crash. Well, it's a start, probably too much to hope for instant success ...
immintrin.h declared more often helped.

some intrinsics it seems unable to find, eg:

_mm_srli_si128
Intellisense is not 100% compatible with CLang, sometimes it shows bogus errors that actually do not exist.
You can also try to explicitly add the CLang intrinsic headers to your source like:

Code: Select all

#ifdef __clang__
	#include <popcntintrin.h>
	#include <lzcntintrin.h>
	#include <bmi2intrin.h>
	#include <immintrin.h>
	#include <avxintrin.h>
	#include <avx2intrin.h>
#endif
Telling the compiler which processor it has to compile for can help too, for AMD Zen3 you could add the extra command line parameter "-march=znver3"
It seems you are using an AMD 7950X (Zen4), in this case it would be better to install LLVM 16 because it can generate and optimize code for the Zen4 with "-march=znver4"
If you want to try this, you also have to add the manifest file I showed earlier, and you have to change the LLVM version under the advanced project settings to 16.

Alternatively you can try to compile with "-march=x86-64-v4", this will include AVX-512 too.