Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Profile generation executables crash on Windows

meluzin__vojtech
Beginner
585 Views

Hi, I essentially need the profile guided optimizations, because without them the executables are huge and slower. I have ICC 2016 and I also tried ICC 2018, in both cases same results - while the normal build produces working executables (sames as all other compilers - MSVC and CLANG), profile guided generation executables crash (after compiling for hours and producing over 200MB executable, both 32bit and 64bit Windows).

Command line for compiler:

icl.exe /D "MNOPARAMETERCHECK" /D "MELDAPRODUCTIONAUDIOPLUGINKERNEL" /D "MELDAPRODUCTIONAUDIOPLUGINKERNELV11" /D "MVERSION=\"12.00a\"" /D "MVERSIONINT=0xC0000" /D "NDEBUG" /D "MLIBRARYDLL" /D "MPROJECTNAME=MeldaProductionAudioPluginKernelV11" /D "MPROJECTNAMESTRING=\"MeldaProductionAudioPluginKernelV11\"" /D "MENABLETBBxxx" /D "MINTELIPP_8" /D "MINTELIPP" /D "MUNICODE" /D "MENABLEDIRECTSOUND" /D "MENABLEASIO" /D "_SECURE_SCL=0" /D "_WINDOWS" /D "UNICODE" /D "_MBCS" /D "WIN32" /GR- /bigobj /Qrestrict /arch:SSE2 /Qprof-gen /Qprof-dir c:\PROFGEN\MeldaProductionAudioPluginKernelV11 /MT /TP /Fd"!temp/ReleaseReleaseIntelcompiler0/MeldaProductionAudioPluginKernelV11/vc70.pdb" /D_USRDLL /D_WINDLL /D_WINDOWS /DWIN32 /MP /Fo"!temp/ReleaseReleaseIntelcompiler0/MeldaProductionAudioPluginKernelV11/KERNEL.obj" /FR"!temp/ReleaseReleaseIntelcompiler0/MeldaProductionAudioPluginKernelV11/" /I "D:/programming/mlibrary" /I "D:/Programming/MDrummer/MDrummer" /I "C:/Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\include\ia32" /I "C:/Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\include" /I "C:/Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\include\icc" /I "D:/programming/mlibrary/library/"  /I "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018/windows/ipp/include" /I "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018/windows/ipp/include" /I "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018/windows/tbb/include" /D_MBCS /Wp64 /c /W3 /Gm- /Qstd=c++14 /Zc:forScope /nologo /Gd /GF /EHsc /fp:fast /GS- /Qdiag-disable:1292 /Qvc14 /Qm32 /O1 /Os /vec- MDrummer/KERNEL.cpp

Command line for linker:

icl.exe kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib wsock32.lib winmm.lib msimg32.lib psapi.lib opengl32.lib Glu32.lib freetype.lib zlib.lib libpng.lib libtiff.lib libjpeg.lib giflib.lib bzip2.lib libflac.lib vstsdk3.lib aax.lib asio.lib libmad.lib fcnn.lib ippsmt.lib ippvmmt.lib ippcoremt.lib ippimt.lib /link /MP /OUT:"D:/Programming/MDrummer/BINEffects/binkernel/MeldaProductionAudioPluginKernelV11.dll" /INCREMENTAL:NO /RELEASE /MACHINE:X86 /SUBSYSTEM:WINDOWS,5.01 /DYNAMICBASE /DLL /IMPLIB:"D:/Programming/MDrummer/!temp/ReleaseReleaseIntelcompiler0/MeldaProductionAudioPluginKernelV11.lib" /LIBPATH:"D:/programming/mlibrary/library" /LIBPATH:"D:/Programming/MDrummer" /LIBPATH:"D:/Programming/MDrummer/!temp/ReleaseReleaseIntelcompiler0" /LIBPATH:"D:/Programming/MDrummer/BINEffects/bin" /LIBPATH:"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018/windows/ipp/lib/ia32" /LIBPATH:"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018/windows/tbb/lib/ia32/vc12" /LIBPATH:"C:/Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\lib\ia32" /nologo /MANIFEST:NO /Gy /Qoption,link,/OPT:REF /OPT:REF /OPT:ICF

In case it would help, this is where it crashes (access violation):

1CBA6915  movq        xmm1,mmword ptr ds:[246684ACh]  
1CBA691D  movq        xmm0,mmword ptr ds:[2067DD60h]  
1CBA6925  paddq       xmm1,xmm0  
1CBA6929  movq        mmword ptr ds:[246684ACh],xmm1  
1CBA6931  mov         dword ptr [ebp],20h  
1CBA6938  cmp         dword ptr ds:[24008288h],0  
1CBA693F  je          1CBA755D  
1CBA6945  movq        xmm1,mmword ptr ds:[240082B8h]  
1CBA694D  movq        xmm0,mmword ptr ds:[2067DD60h]  
1CBA6955  paddq       xmm1,xmm0  
1CBA6959  movq        mmword ptr ds:[240082B8h],xmm1  
1CBA6961  cmp         dword ptr ds:[240084C4h],0  
1CBA6968  je          1CBA7544  
1CBA696E  push        dword ptr ds:[11990004h]  
1CBA6974  push        dword ptr ds:[11990000h]  
1CBA697A  push        5  
1CBA697C  movq        xmm1,mmword ptr ds:[240084E4h]  
1CBA6984  movq        xmm0,mmword ptr ds:[2067DD60h]  
1CBA698C  paddq       xmm1,xmm0  
1CBA6990  push        0DEECE66Dh  
1CBA6995  movq        mmword ptr ds:[240084E4h],xmm1  
1CBA699D  call        203DC4E0  
1CBA69A2  add         eax,0Bh  
1CBA69A5  movq        xmm1,mmword ptr ds:[240082A8h]  
1CBA69AD  adc         edx,0  
1CBA69B0  xor         ebx,ebx  
1CBA69B2  movq        xmm0,mmword ptr ds:[2067DD60h]  
1CBA69BA  movzx       edi,dx  
1CBA69BD  paddq       xmm1,xmm0  
>>>> 1CBA69C1  mov         dword ptr ds:[11990000h],eax  
1CBA69C6  mov         dword ptr ds:[11990004h],edi  
1CBA69CC  shr         eax,10h  
1CBA69CF  shl         edi,10h  
1CBA69D2  or          edi,eax  
1CBA69D4  movq        mmword ptr ds:[240082A8h],xmm1  
1CBA69DC  cmp         dword ptr ds:[24008620h],0  
1CBA69E3  je          1CBA752B  
1CBA69E9  movq        xmm0,mmword ptr ds:[24008640h]  
1CBA69F1  movq        xmm1,mmword ptr ds:[2067DD60h]  
1CBA69F9  movq        xmm2,mmword ptr ds:[240082B0h]  
1CBA6A01  paddq       xmm0,xmm1  
1CBA6A05  paddq       xmm2,xmm1  
1CBA6A09  movq        xmm3,mmword ptr ds:[2067DEC0h]  
1CBA6A11  mov         dword ptr [esp],2400822Ch  
1CBA6A18  mov         dword ptr [esp+4],7  
1CBA6A20  movq        mmword ptr ds:[24008640h],xmm0  
1CBA6A28  movq        mmword ptr ds:[240082B0h],xmm2  
1CBA6A30  movq        mmword ptr [esp+8],xmm3  
1CBA6A36  call        203BAC60  
1CBA6A3B  push        ebx  
1CBA6A3C  movq        xmm5,mmword ptr ds:[24668484h]  
1CBA6A44  movq        xmm4,mmword ptr ds:[2067DD60h]  
1CBA6A4C  push        0FFFFFFFFh  
1CBA6A4E  paddq       xmm5,xmm4  
1CBA6A52  push        ebx  
1CBA6A53  push        edi  

 

0 Kudos
6 Replies
Viet_H_Intel
Moderator
585 Views

Hi,

Does it crash if you compiled at default (without /Qprof-gen /Qprof-dir)? Can you debug further by compile with /Zi? or possible provide us with a test case to investigate?

Thanks,

Viet

0 Kudos
meluzin__vojtech
Beginner
585 Views

Hi Viet,

it works fine when compiled without profgen. It also works fine with all other compilers. Interestingly the 2016 ICC produces crashing code on x86, but works fine with x64. It's all really really unpredictable... I'm afraid I cannot provide a test code, it's a gigantic project and I have no idea where it crashes. I'll try the /Zi option when possible, but since it blocks the build machine for like 3-4 hours, it may take a while...

0 Kudos
meluzin__vojtech
Beginner
585 Views

Ok, so I tried to use the /Zi compilation, but for some reason no PDB files have been created. I got dirty, so here's the full command line. I'm using Visual Studio express 2017. First I initialize environment like this:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\bin\compilervars.bat" x86

Interesting thing then happens when I run the intel compiler, this message:

icl: remark #10421: The IA-32 target wrapper binary 'icl' is deprecated. Please use the compiler startup scripts or the proper Intel(R) 64 compiler binary with the '-Qm32' option to target the intended architecture

Not exactly sure what is causing this. Anyways the compiler is executed like this (removed gazillion include paths etc):

icl.exe /GR- /bigobj /Qrestrict /arch:SSE2 /Qprof-gen /Qprof-dir c:\PROFGEN\MeldaProductionAudioPluginKernelV11 /MT /Zi /TP /Fd"!temp/xxx/vc70.pdb" /MP /Fo"xxx.obj" /FR"xxx"  /I "C:/Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\include\ia32" /I "C:/Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\include" /I "C:/Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\include\icc" /I "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018/windows/ipp/include" /I "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018/windows/ipp/include" /I "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018/windows/tbb/include" /D_MBCS /Wp64 /c /W3 /Gm- /Qstd=c++14 /Zc:forScope /nologo /Gd /GF /EHsc /fp:fast /GS- /Qdiag-disable:1292 /Qvc14 /Qm32 /Od xxx.cpp

As you can see it's a debug build, unfortunately the result is the same as release with all the optimizations - it crashes nearly immediately. Also note that it's a DLL.

This error comes up :

warning #31001: The dll for reading and writing the pdb (for example, mspdb110.dll) could  not be found on your path. This is usually a configuration error. Compilation will continue using /Z7 instead of /Zi, but expect a similar error when you link your program.

That's probably why no PDB gets created. But mspdb140.dll is in the location, where MSVC compiler is, so I assume it should be in the PATH (unless the intel batch messed it up of course).

Now the linker:

icl.exe xxx.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib wsock32.lib winmm.lib msimg32.lib psapi.lib opengl32.lib Glu32.lib freetype.lib zlib.lib libpng.lib libtiff.lib libjpeg.lib giflib.lib bzip2.lib libflac.lib vstsdk3.lib aax.lib asio.lib libmad.lib fcnn.lib ippsmt.lib ippvmmt.lib ippcoremt.lib ippimt.lib /link /MP /OUT:"D:/xxx.dll" /INCREMENTAL:NO /RELEASE /MACHINE:X86 /SUBSYSTEM:WINDOWS,5.01 /DYNAMICBASE /DLL /IMPLIB:"D:/xxx.lib" /PDB:"D:/xxx.pdb" /LIBPATH:"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018/windows/ipp/lib/ia32" /LIBPATH:"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018/windows/tbb/lib/ia32/vc12" /LIBPATH:"C:/Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\lib\ia32" /nologo /MANIFEST:NO /Gy /Qoption,link,/OPT:REF

Result: it nearly immediately crashes... Normal builds work fine. What now?

0 Kudos
meluzin__vojtech
Beginner
585 Views

A little update: I changed the environment setup to:

"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\bin\compilervars.bat" ia32 vs2017

Now it doesn't show any errors during compilation except for:

icl: warning #10210: problem with Microsoft compilation of 'D:/programming/xxx.cpp'

Anyways it creates the vc70.pdb during compilation (see the previous post), but linker doesn't create the resulting PDB and MSVC says it hasn't been compiled with debug symbols...

0 Kudos
meluzin__vojtech
Beginner
585 Views

I managed to generate the PDB via MSVC directly and here is where it crashes:

class MRandBase
{
	MUINT64 State;
public:
	
	MFORCEINLINE MUINT64 GetValue()
	{
		static const MUINT64 mul = MUINT64(0xDEECE66DUL) | (MUINT64(0x5) << 32);
		static const MUINT64 add = (MUINT64)0xB;
		static const MUINT64 mod = MUINT64(1) << 48;

		State = (State * mul + add) % mod; <<<<<<<<<<<<<
		return State >> 16;
	};
};

Access violation, State variable is fine, so it cannot access the local static consts, which is just a nonsense... It works fine with normal release of course. Crashes just with profgen. I think we can agree that there is a bug in the compiler.

0 Kudos
meluzin__vojtech
Beginner
585 Views

And the debug state...

1026ED2F  mov         dword ptr [mod],0  
1026ED36  mov         dword ptr [ebp-14h],10000h  

		State = (State * mul + add) % mod;
1026ED3D  mov         eax,dword ptr [this]  
1026ED40  mov         edx,dword ptr [eax]  
1026ED42  mov         eax,dword ptr [eax+4]  
1026ED45  add         esp,0FFFFFFF0h  
1026ED48  mov         dword ptr [esp+0Ch],5  
1026ED50  mov         dword ptr [esp+8],0DEECE66Dh  
1026ED58  mov         dword ptr [esp+4],eax  
1026ED5C  mov         dword ptr [esp],edx  
1026ED5F  call        _allmul (1787DB20h)  
1026ED64  add         eax,0Bh  
1026ED67  adc         edx,0  
1026ED6A  add         esp,0FFFFFFF0h  
1026ED6D  mov         dword ptr [esp+0Ch],10000h  
1026ED75  mov         dword ptr [esp+8],0  
1026ED7D  mov         dword ptr [esp+4],edx  
1026ED81  mov         dword ptr [esp],eax  
1026ED84  call        _aullrem (1787DB60h)  
1026ED89  mov         ecx,dword ptr [this]  
1026ED8C  mov         dword ptr [ecx],eax  <<<<<<<<<<<<<<<
1026ED8E  mov         dword ptr [ecx+4],edx  
		return State >> 16;
1026ED91  mov         eax,dword ptr [this]  
1026ED94  mov         edx,dword ptr [eax]  
1026ED96  mov         eax,dword ptr [eax+4]  
1026ED99  mov         dword ptr [ebp-8],eax  

Btw. the State variable is normally accessible and writable in debugger, so it's probably the intel's profiling thing... definitely a bug...

0 Kudos
Reply