Dirty Secrets of Intel C++ 13.0 Compiler for Firenzina 2.2.2

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

Gusev
Posts: 1476
Joined: Mon Jan 28, 2013 2:51 pm

Dirty Secrets of Intel C++ 13.0 Compiler for Firenzina 2.2.2

Post by Gusev »

I have used different versions of Microsoft Visual Studio since 1999 (6.0, 2008, 2010, 2012), yet I am new to using the Intel C++ compiler. I know that what I quote below is not the best set of compiler and linker parameters possible, simply because my compiles of Stockfish 2.2.2 and Gull II are both weaker than the factory releases. However, these settings still yield a noticeably better result for Firenzina 2.2.2 xTreme than the MSVC 11.0 compiler native to Microsoft Visual Studio Ultimate 2012 Update 1 (with /O2). So here goes,
Firenzina 2.2.2 xTreme
Initial project settings (2/25/2013) in Microsoft Visual Studio Ultimate 2012
Configuration Properties -> General
---- Platform Toolset: Intel C++ Compiler XE 13.0
---- Profile Guided Build Options: Disabled (should try to enable?)
---- Use of MFC: Use Standard Windows Libraries (shouldn’t matter)
---- Character Set: Use Multi-Byte Character Set (suspect: switch to Not Set?)
---- Whole Program Optimization: Yes
Configuration Properties->Intel Debugging
---- Number of Intel Cilk Plus Threads: empty (are they of any use?)
Configuration Properties->Intel Performance Libraries
---- Intel Integrated Performance Primitives
-------- Use IPP: Default Linking Method
---- Intel Math Kernel Libraries
-------- Use MKL: No (are they of any use?)
-------- Use ILP64 Interfaces: No
---- Intel Threading Building Blocks
-------- Use TBB: No
-------- Instrument for use with Intel Threading Analysis Tools: No
Configuration Properties->C/C++->General [Intel C++]
---- Use Visual C++ Compiler: No
Configuration Properties->C/C++->Optimization
---- Optimization: Highest Optimizations (/O3)
---- Inline Function Expansion: Any Suitable (/Ob2)
---- Enable Intrinsic Functions: Yes (/Oi)
---- Favor Size or Speed: Favor fast code (/Ot)
---- Enable Fiber-Safe Optimizations: Yes (/GT) (can this slow us down?)
Configuration Properties->C/C++->Optimization [Intel C++]
---- Interprocedural Optimization: Multi-File (/Qipo)
---- Optimize for Windows Application: No (doesn’t make sense to do it, we’re console)
---- Flush Denormal Results To Zero: No (seems dangerous)
---- Enable Matrix Multiply Library Call: Default (we don’t multiply matrices much, do we?)
---- Loop Unrolling: empty (should be on by default for /O3)
---- Parallelization: Yes (/Qparallel) (apparently requires libiomp5md.dll; is this option useful?)
---- Use Intel Optimized Headers: Yes (/Quse-intel-optimized-headers) (I don’t see why not)
Configuration Properties->C/C++->Preprocessor
---- Preprocessor Definitions: _MBCS;(%PreprocessorDefinitions);NOALIAS (NOALIAS seems safe)
Configuration Properties->C/C++->Code Generation
---- Enable String Pooling: Yes (/GF)
---- Enable C++ Exceptions: Yes (/EHsc)
---- Smaller Type Check: No
---- Basic Runtime Checks: Default
---- Runtime Library: Multi-threaded DLL (/MD) (will switch to Multi-threaded /MT)
---- Struct Member Alignment: Default
---- Security Check: Yes (/GS)
---- Enable Function-Level Linking: Yes (/Gy)
---- Enable Enhanced Instruction Set: Not Set (for x64, enabled by default)
---- Floating Point Model: Precise (/fp:precise) (tried /fp:fast, didn’t like the outcome)
---- Enable Floating Point Exceptions: empty
Configuration Properties->C/C++->Code Generation [Intel C++]
---- Unmask floating point exceptions: No
---- Floating Point Expression Evaluation: Default
---- Disable Function Splitting: No
---- Add Processor-Optimized Code Path: Intel® Core™ processor family with SSE4 (/QaxSSE4.2)
---- Intel Processor-Specific Optimization: Intel® Core™ processor family with SSE4 (QxSSE4.2)
---- Check Pointers: None
---- Turn off Checking for Undimensioned Arrays: No (doesn’t seem safe to turn off)
---- Check Dangling Pointers: None
Configuration Properties->C/C++->Language [Intel C++]
---- OpenMP Support: No (is this feature useful?)
---- Enable C99 support: Yes (/Qstd=c99) (needed for loop vectorization)
---- Enable Use of ANSI Aliasing Rules in Optimization: Yes (/Qansi-alias) (suspect, but why not?)
Configuration Properties->C/C++->Diagnostics [Intel C++]
---- Vectorizer Diagnostic Level: Loops Successfully and Unsuccessfully Vectorized (2)(/Qvec-report2)
---- Guided Auto Parallelism Analysis: Disable (can this analysis help?)
Command Line: /GS /Qansi-alias /W3 /QxSSE4.2 /Gy /Zc:wchar_t /Zi /O3 /Ob2 /Fd"x64\Release\vc110.pdb" /Qvec-report2 /fp:precise /Quse-intel-optimized-headers /D "_MBCS" /D "NOALIAS" /Qipo /GF /GT /Zc:forScope /Oi /MD /QaxSSE4.2 /Fa"x64\Release\" /EHsc /nologo /Qparallel /Fo"x64\Release\" /Qstd=c99 /Ot /Fp"x64\Release\Firenzina.pch"
Configuration Properties->Linker->System
---- Subsystem: Console (/SUBSYSTEM:CONSOLE)
Configuration Properties->Linker->Optimization
---- References: Yes (/OPT:REF)
---- Enable COMDAT Folding: Yes (/OPT:ICF)
---- Function Order: empty
Configuration Properties->Linker->Optimization [Intel C++]
---- Interprocedural Optimization: Yes
Configuration Properties->Linker->Advanced
---- TargetMachine: MachineX64 (/MACHINE:X64)
Command Line: /OUT:"C:\Users\DMITRI\documents\visual studio 2012\Projects\Firenzina\x64\Release\Firenzina.exe" /MANIFEST /NXCOMPAT /PDB:"C:\Users\DMITRI\documents\visual studio 2012\Projects\Firenzina\x64\Release\Firenzina.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X64 /OPT:REF / /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Release\Firenzina.exe.intermediate.manifest" /OPT:ICF /NOLOGO /TLBID:1
jdart
Posts: 4361
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Dirty Secrets of Intel C++ 13.0 Compiler for Firenzina 2

Post by jdart »

Looks mostly ok. You should turn off stack security checking (/GS-) as well as other runtime checks, when building for max speed.

--Jon
User avatar
Jim Ablett
Posts: 1343
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: Dirty Secrets of Intel C++ 13.0 Compiler for Firenzina 2

Post by Jim Ablett »

jdart wrote:Looks mostly ok. You should turn off stack security checking (/GS-) as well as other runtime checks, when building for max speed.

--Jon

Hi Dmitri.

Mostly ok except for a few things,

-------------------------------

Code: Select all

Add Processor-Optimized Code Path: Intel® Core™ processor family with SSE4 (/QaxSSE4.2) 
If you are just compiling for SSE4.2 this will slow it down by adding generic cpu support.


-------------------------------

Code: Select all

---- Parallelization: Yes (/Qparallel) (apparently requires libiomp5md.dll; is this option useful?) 
Will parallelize the loops, but in my experience adds no speed to chess engines, probably slows it down a bit in most cases.
(will add annoying library dependencies)


-------------------------------

Code: Select all

-------- Use IPP: Default Linking Method 
Pointless unless engine is using IPP libraries. (will add annoying library dependencies)


-------------------------------

Code: Select all

---- Whole Program Optimization: Yes 
Test this on & off - Not always a good thing.


-------------------------------

Code: Select all

---- Use Intel Optimized Headers: Yes (/Quse-intel-optimized-headers) (I don’t see why not) 
Again not always a good thing - test with & without.


Also you should definitely use profiling for the fastest builds.

Code: Select all

/Qprof_gen , /Qprof_use]
Jim.
Gusev
Posts: 1476
Joined: Mon Jan 28, 2013 2:51 pm

Re: Dirty Secrets of Intel C++ 13.0 Compiler for Firenzina 2

Post by Gusev »

Jim and Jon, thank you very much for your advice! Will try.