Jump to content
  • Advertisement
Sign in to follow this  
pcmaster

DX11 D3D11 WARP without swap-chain - LEAK?

This topic is 1011 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all!

 

We've had rendering on servers without GPUs (and without monitors) using DX11.0 WARP running just fine. Now that our loads have increased I noticed we run out of memory. I'm releasing all resources (mainly textures and buffers) but since we don't have any swap-chain (and hence no Present), I can't get to any other conclusion than that the resources are never actually released and linger in RAM forever, until we run out of memory. My theory is supported by similar behaviour observation with GPUs (from all vendors) where the RAM is actually freed only after a couple frames and captures by Windows Performance Recorder/Analyzer with WARP.

 

I tried ID3D11DeviceCtx::Flush and ClearState, both to no avail (as expected).

 

Can anyone comment on WARP without swap-chains? Can I render "forever" without running out of memory because I never present?

 

Thanks for any ideas!

 

EDIT: Here I see that calling Flush should help but I just don't believe it - it doesn't help me and my RAM usage never goes down.

Edited by pcmaster

Share this post


Link to post
Share on other sites
Advertisement

In D3D11 almost anything you delete is not actually deleted until you flush or present. The reason for this is the 'command buffer' that is being filled with commands may reference these resources and so anything deleted during command buffer creation is kept alive until the GPU has executed the command buffer. Resources are kept alive while they are bound to the pipeline, even if you release them and the ref-count says zero, if they are bound to the pipeline, they are still alive - ClearState solves this. So ClearState/Flush should make sure any resources that you believe you have deleted are actually deleted. If you still find resources alive it might be worth using the debug layers to see if there are objects alive at this point that you didn't expect.

 

WARP does use additional memory to optimize it's rendering, we typically hold onto surfaces if we think you are going to reuse them in the future (particularly resources in use that you call map / discard on) as this is faster than releasing them and then asking the OS for them again (and getting zero filled memory). We do limit this memory, and it will 'decay' over time, so it should not use too much and it should certainly not leak.

 

Andy

Share this post


Link to post
Share on other sites

Hi Andy!

 

I'm very well aware, I've implemented multiple command buffers submission and resource tracking on one of the consoles. Indeed, there we finally release deleted resources after a few frames, once we're sure GPU is done with them, as it's left to us, not the driver.

 

We don't have much Map/Write/Discard, certainly not the amount that would contribute to 10 GB over 1200 draw-calls. That was exactly what I feared would be double-buffered by the driver. But doesn't seem the case. We do have plenty of Map/Write/NoOverwrite though.

 

I added ID3D11Debug::ReportLiveDeviceObjects before and after release of textures and it does show exactly the difference, after the Release + Flush + ClearState they are gone from the ReportLiveDeviceObjects listing, however not from RAM (WPA and even TaskMgr confirm that).

 

So Flush + ClearState to no avail, so far sad.png

Edited by pcmaster

Share this post


Link to post
Share on other sites

Okay, I reduced it as much as I could and now I do only some rendering using immutable resources (and constant buffers) to a few render targets, then a few Map/NoOverwrite for a fullscreen quad and finally read back the render targets on CPU. At that point (first Map/Read), all the massive allocations happen. No Map/Discard at all.

Edited by pcmaster

Share this post


Link to post
Share on other sites

Hehe, my epic fail. There was indeed a leak on my side - forgotten release on a bunch of textures smile.png So now I believe WARP is fine and actually releases the memory smile.png

Edited by pcmaster

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!