AsyncCompute

Introduction

The Rendering Hardware Interface (RHI) now supports asynchronous compute (AsyncCompute) for Xbox One. This is a good way to utilize unused GPU resources (Compute Units (CUs), registers and bandwidth), by running dispatch() calls asynchronously with the rendering. Async compute uses a separate context, and we provide RHI functions to synchronize the rendering and compute contexts. Dr PIX is useful for identifying areas which might benefit from async compute. For example, if half the CUs are unused during a particular rendering pass, those CUs could potentially be utilized by an asynchronous compute job. Async compute has some restrictions:

API

Between calls to RHIBeginAsyncComputeJob_DrawThread and RHIEndAsyncComputeJob_DrawThread, the RHI will be in the async compute state. During this time, supported RHI commands will be executed via the async compute context. Unsupported RHI functions will assert.

Disabling/Enabling

Async compute can be enabled or disabled at compile time with the #define USE_ASYNC_COMPUTE_CONTEXT. It can be disabled at runtime with the r.AsyncCompute console variable. When async compute is disabled, dispatches within async compute blocks are executed synchronously on the graphics command buffer. USE_ASYNC_COMPUTE_CONTEXT is defined to 0 on PC, since it's not supported in D3D11.1.

PIX

Async compute context jobs are not captured in GPU captures, so these captures can give a misleading picture of GPU performance when async compute is enabled. For graphics debugging purposes, async compute should be disabled using the above cvar. Async compute is supported by PIX timing captures. These show up in the timeline like this:

PixTimingCapture.png

Thanks and Future

This feature was implemented by Lionhead Studios. We integrated it and indend to make use of it as a tool to optimize the XboxOne rendering.

As more more APIs expose the hardware feature we would like make the system more cross platform. Features that make use use AsyncCompute you always be able to run without (console variable / define) to run on other platforms and easier debugging and profiling. AsyncCompute should be used with caution as it can cause more unpredicatble performance and requires more coding effort for synchromization.