question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The GPU device instance has been suspended

See original GitHub issue

Hi, I am playing around with your library and wanted to compare performance of two of my GPUs.

For this I am doing the following:

List<GraphicsDevice> gpus = Gpu.EnumerateDevices().ToList();

for (int g = 0; g < gpus.Count; g++)
{
    Stopwatch stopwatch = new Stopwatch();
    
    stopwatch.Start();
    this.DoComputation(gpus[g]);
    stopwatch.Stop();

    Console.WriteLine($"GPU {g}: {stopwatch.Elapsed}.");
}

But I am getting the following error:

Unhandled exception. SharpGen.Runtime.SharpGenException: HRESULT: [0x887A0005], Module: [Vortice.DXGI], ApiCode: [DXGI_ERROR_DEVICE_REMOVED/DeviceRemoved], Message: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action.

   at SharpGen.Runtime.Result.CheckError()
   at Vortice.Direct3D12.ID3D12Device.CreateCommittedResource(HeapProperties& heapPropertiesRef, HeapFlags heapFlags, ResourceDescription& descRef, ResourceStates initialResourceState, Nullable`1 optimizedClearValueRef, Guid riidResource)
   at Vortice.Direct3D12.ID3D12Device.CreateCommittedResource(HeapProperties heapProperties, HeapFlags heapFlags, ResourceDescription description, ResourceStates initialResourceState, Nullable`1 optimizedClearValue)
   at ComputeSharp.Graphics.Buffers.Buffer`1..ctor(GraphicsDevice device, Int32 size, Int32 sizeInBytes, BufferType bufferType)
   at ComputeSharp.Graphics.Buffers.Abstract.HlslStructuredBuffer`1.GetData(Span`1 span, Int32 offset, Int32 count)
   at ComputeSharp.Graphics.Buffers.Abstract.HlslBuffer`1.GetData(Int32 offset, Int32 count)
   at ComputeSharp.Graphics.Buffers.Abstract.HlslBuffer`1.GetData()

I know it’s an issue in the DirectX, but maybe you know how to solve it?

The same code works with Gpu.Default.

Also, is it possible to retrieve any info about the GPU? Like name, vRAM size, cores count?


My setup:

  • Visual Studio 2019.
  • .NET Core 3.0.0-preview8-28405-07.
  • GTX 1080.
  • GTX 1050 ti.
  • Windows 10 Pro x64.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
Sergio0694commented, Sep 6, 2019

Yeah you can just run the shader with 1 iteration, that works too 👍 The important thing is just that the number of iteration axes remains the same during your preloading and actual iteration. That’s the same reason why I haven’t added an API to preload a shader, as a shader also contains the number of threads to run along each axis (the ThreadNum HLSL attribute). Basically, you can do this:

  • If your shader will be run just on the X axis, preload it with 1
  • If it’ll run on X and Y, preload it with 2, 2
  • If it’ll run on X, Y and Z, preload it with 2, 2, 2

As for your results, glad to hear you’re having such an improvement in your scenario! 🚀 If you want to squeeze out even more performance, you can also try to tweak the shader, eg. to process more than one output value in each iteration, so that the relative overhead for each value would be reduced. You’ll need to make some tests for this though, as results may vary depending on your specific input data, buffer size, etc. - but it might be worth a try if you want the best possible performance.

2reactions
Sergio0694commented, Sep 6, 2019

No problem, happy to help! Glad we could get this fixed so quickly 😊

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix a “GPU device instance has been suspended” ...
To resolve a “GPU device instance has been suspended” error: 1. Install the latest version driver software for your graphic card and restart ......
Read more >
The GPU device instance has been suspended.
Hi One year ago I played Resident Evil 7 on this PC without any problems. After reinstalling the game to play it again...
Read more >
The GPU device instance has been suspended - Forum
My game client is crashing constantly with the error "The GPU device instance has been suspended". It would crash before 3.19.1c, ...
Read more >
GPU device instance has been suspended (HELP!)
GPU device instance has been suspended (HELP!) · Hello all, I'm getting “GPU device instance has been suspended. Use GetDeviceRemovedReason to ...
Read more >
games and softwares crashing ( gpu device instance has ...
games and softwares crashing ( gpu device instance has been closed ) tried re-installing windows too still no fix.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found