Crash when profiling DirectX

Crash when profiling DirectX

I can't profile our DirectX11 app in VTune Update 16 (build 342405). It crashes inside the DirectXTex library when it calls CoCreateInstance on CLSID_WICImagingFactory2. Without Vtune this call succeeds, but with VTune it crashes. Any ideas?

 

9 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

What analysis type do you use for profiling when the app crashes?

Thanks, Dmiry

Can you post call stack?

It is crashing on "Basic Hotspots" analysis. I assumed if that didn't work none would but I tried a few:

  • Basic Hotspots: our app crashes
  • Advanced Hotspots: works
  • Concurrency: our app crashes
  • Locks and Waits: our app crashes
  • Microarchitecture General Exploration: works
  • Microarchitecture Bandwidth: works

So I don't know what the pattern is. I can't get a callstack, if I hit Debug on the crash dialog and choose the open VS2012 instance, it switches to VS2012 but it's not in the debugger, as if it already exited.

So I used prints to figure out where the crash was. I'm positive it's on this CoCreateInstance call 

WICImagingFactory* _GetWIC()
{
    static IWICImagingFactory* s_Factory = nullptr;

    if ( s_Factory )
        return s_Factory;

#if(_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/) || defined(_WIN7_PLATFORM_UPDATE)
    HRESULT hr = CoCreateInstance(
        CLSID_WICImagingFactory2,
        nullptr,
        CLSCTX_INPROC_SERVER,
        __uuidof(IWICImagingFactory2),
        (LPVOID*)&s_Factory
        );

The CoCreateInstance there doesn't return, it just crashes. But only under VTune, run normally it works. I tried undefining _WIN7_PLATFORM_UPDATE then it uses another CoCreateInstance with the older CLSID_WICImagingFactory but that also crashes.

The code above is from here this open source library:

http://directxtex.codeplex.com/SourceControl/latest#DirectXTex/DirectXTe...

They have a slightly newer version of DirectXTex there I could try, but I already looked at the diffs they don't seem relevant.

It seems to me like VTune must be altering the COM environment somehow, is that possible? Unless this is a red herring and it's just a something in general is messed up.

 

Thank you for detail info.

I think that using CoCreateInstance with CLSID_WICImagingFactory is for accessing your DirectX, which is deviceIO operations?? VTune(TM) Amplifier's user mode sampling collectors (basic-hotspots, concurrency and locksandwaits) was not designed for device driver profiling, they use OS timer (high level timer) to profile applications (user level) and cannot interrupt running device drivers (system mode). So, you only can use hardware PMU  event-based sampling collectiors to profile DirectX application.

If you still want to adopt user mode sampling to profile DirectX application, please use VTune's Pause/Resume API to profile code area where is in user mode (no DirectX access)

@Philip

I know that this could be a strange question, but anyway I will ask it. Can you run your program when VTune is attached under windbg?

If you need assistance on how to do it please ask me.,

@Peter, as far as I know this is routine DirectX related call, completely user mode, it's how we load JPG files. There is no device driver access here that I know of. Our app is a graphics program and there are DirectX calls throughout, are you implying we cannot profile graphics apps without pausing around every DirectX call? That seems unlikely. Also I have set VTune to start paused and it still crashes, is starting it paused equivalent to using the API to pause?

Not trying to be overly skeptical here, I'm willing to try the pause API. But it would be surprising to me if a seemingly normal call like this is simply not allowed under VTune.

 

@Philip

Please ignore my previous post...it can work on my side.

I tried basic-hotspots of U17 with my DirectX application - it can generate result without crash. Is it possible that you can provide test case, I mean app's binary/pdb files for investigating? You also can submit issue to https://premier.intel.com with test case,

Thank you.

 

>>>It is crashing on "Basic Hotspots" analysis.>>>

Is this access violation type of crash?

Leave a Comment

Please sign in to add a comment. Not a member? Join today