Load and Unload issues with Waterfall DLLs ( Instruction Set specific )

Load and Unload issues with Waterfall DLLs ( Instruction Set specific )

I detected an issue related to Loading and Unloading steps for Waterfall DLLs ( Instruction Set specific ).

Let's say I've compiled an application ( 64-bit / Dynamic linking of IPP libraries ) that could work on CPUs that support AVX Instruction Set ( code e9 for Waterfall DLLs ). A test case starts with a call to ippInit function in main function:

[ Source codes ]
...
int main()
{
    ippInit();
 ...
}
...

However, before ippInit was called I was able to see in VS debugger that ippie9-7.1.dll and ippse9-7.1.dll already loaded ( see lines (4) and (5) ). Now, take a look at a VS debugger output:

[ VS Output Window ]
...
(0)'IccTestApp64D.exe': Loaded '..\x64\Debug\IccTestApp64D.exe', ...
...
(1)'IccTestApp64D.exe': Loaded '..\x64\ippcore-7.1.dll', ...
(2)'IccTestApp64D.exe': Loaded '..\x64\ippi-7.1.dll', ...
(3)'IccTestApp64D.exe': Loaded '..\x64\ipps-7.1.dll', ...
...
(4)'IccTestApp64D.exe': Loaded '..\x64\ippie9-7.1.dll', ...
(5)'IccTestApp64D.exe': Loaded '..\x64\ippse9-7.1.dll', ...
...
...Note: main() called
...
...Note: ippInit() called
...
(6)'IccTestApp64D.exe': Unloaded '..\x64\ippie9-7.1.dll'
(7)'IccTestApp64D.exe': Loaded '..\x64\ippie9-7.1.dll', ...
(8)'IccTestApp64D.exe': Unloaded '..\x64\ippse9-7.1.dll'
(9)'IccTestApp64D.exe': Loaded '..\x64\ippse9-7.1.dll', ...
...
processing continues...

As you can see as soon as ippInit is called both DLLs are unloaded and than loaded again ( see lines (6), (7), (8) and (9) ). Please take a look and investigate if something is wrong.

Thanks in advance.

11 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

Sergey, what is the purpose of calling Init() for dynamic linking? - initialization is done in dllmain().

Anyway you are right - we'll check how to avoid re-loading for reinitialization to the same state (in your case - default).

regards, Igor

Usually when some dll is loaded and unloaded there could be issue related to different versions of the same dynamic library conflicts when the  location is resolved and loaded from different paths.It could be also case of reinitialization when the code referenced from ippInit() is loaded from those two dlls.The recommended method for troubleshooting such a issues(for advanced users) is to enable in gflags.exe "show loader snaps" option and monitor the NtLoader process when it is called for loading various referrenced dlls.

Igor, You could try to comment ippInit in your test case.

>>... we'll check how to avoid re-loading for reinitialization to the same state (in your case - default)...

That would be nice and a consolidated set of events is as follows:

Start App -> (L) ippcore-7.1.dll -> (L) ippi-7.1.dll -> (L) ipps-7.1.dll -> (L) ippie9-7.1.dll -> (L) ippse9-7.1.dll -> main -> ippInit -> (U) ippie9-7.1.dll -> (L) ippie9-7.1.dll -> (U) ippse9-7.1.dll -> (L) ippse9-7.1.dll

Note: (L) - load DLL / (U) - unload DLL

Igor,

 does ippInit() reference code located in ippie7.1.dll and ippie9-7.1.dll?

>>...What is the purpose of calling Init() for dynamic linking?..

The main purpose, even if it doesn't look right in case of Dynamic linking of IPP, is to demonstrate that loaded Waterfall DLLs are unloaded and loaded again.

Ok, it is a bug, will be fixed in the next major release. ippInit() is called from each "stub" dll in dllmain function. When you call ippInit from your app - it doesn't check already registered/loaded dlls and restarts warterfall procedure - so corresponding check will be added.

regards, Igor

Sergey, here is the # of the issue -  DPD200332902  for your reference. when the problem will be fixed we will inform you asap.

>>...here is the # of the issue - DPD200332902 for your reference...

Thank you.

Note: It is Not important now but I'm interested to know how old is the problem?..

who knows how old it is... to aswer this question we need to check all versions starting from the first one - IPP 2.0.Guess now it doesn't matter as they can't be fixed. So let's wait for the next one - fixed one...

regards, Igor

Hello,

this is normal situation for IPP dynamic dispatcher. A developer can manage optimization variant by ippInitCpu() function, a developer can put only part of IPP DLLs in his package, etc. So every time when ippInit() or ippInitCpu() is called all IPP DLL's are unloaded and appropriate optimization veriats are loaded.

I agree it is possible to make the dispatcher more smart and without unnecessary reloading, but IPP DLL's are deprecated in IPP 8.0 at all. Much better to use IPP static libraries or build own custom DLL (small size and contains only necessary functionality instead of many huge size IPP DLLs)

Pavel

发表评论

登录添加评论。还不是成员?立即加入