Jump to content
  • Advertisement
maxest

DX11 Dispatch causes flush?

This topic is 382 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

I would like to run some computation using compute shaders. A lot of computation. Since GPUs have separate memory engine I thought I could make use of it, just like with CUDA streams, and have asynchronous computation and data download GPU -> CPU. So I would do something like this:

Dispatch 1 (first half of data)
CopyResource 1
Dispatch 2 (second hald of data)
CopyResource 2


Now the question is: will CopyResource 1 and Dispatch 2 overlap in time? I heard from someone that Discard causes a flush; it waits until all previous commands have been completed and then gets called but can't find that in MSDN. Can anyone confirm?

Edited by maxest

Share this post


Link to post
Share on other sites
Advertisement

I'd say it's up to the driver. Some drivers might inspect the resources that are involved and only synchronize as necessary, while others might not do that inspection and would synchronize always. The only thing that the API has to guarantee is that from any observable point of view, they have to execute in order - but that only applies if there's a way you could observe the ordering.

Share this post


Link to post
Share on other sites

To make use of the different engines, you need to use D3D12 and create multiple different queues, with appropriate synchronization between them.

On D3D11, the immediate context will be processed by a single queue on the graphics engine (unless the driver pulls off some real magic)... Dispatches will also most likely act as a full barrier, or write->write transition, flushing all work from the compute units and waiting on memory writes to complete.

I don't think the D3D11 MSDN pages will describe any of these details as it's way lower down than the API. you'll have to experiment and use profilers, GPU View, etc to discover how it works. D3D12/Vulkan give you the tools required for two dispatches to overlap, and for memory transfers and computation to overlap.

Share this post


Link to post
Share on other sites

With D3D11, they are always serialized by default by the drivers.

You can use vendor APIs to disable the behavior locally if you know what you are doing.

 

For nvidia : NvAPI_D3D11_BeginUAVOverlap

For AMD : IAmdDxExtUAVOverlap::BeginUAVOverlap

Share this post


Link to post
Share on other sites

  • 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!