查看: 813|回复: 14

[编程指南] 【AsyncCompute | Unreal Engine】

[复制链接]

1

主题

342

帖子

7万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
75866
发表于 2016-6-27 00:49:35 | 显示全部楼层 |阅读模式


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 tosynchronize 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 particularrendering pass, those CUs could potentially be utilized by an asynchronous compute job.Async compute has some restrictions:

Buffers with UAV counters are not supported (this is a limitation of the XDK, and will generate a D3D warning)

Async compute jobs do not show up in PIX GPU captures (although they do appear in Timing Captures)PIX only captures the graphics immediate context (this is a platform limitation).

Automatic pipeline flushes are not provided by the driver. You need to explicitly call RHICSManualGpuFlush if flushes are needed(e.g. if one dispatch is dependent on the previous one)
API
RHIBeginAsyncComputeJob_DrawThread (EAsyncComputePriority Priority)Begins an async compute job from the rendering thread. The priority is used to determine the number of shader resources to allocatefor the job (via ID3D11XComputeContext::SetLimits). There are currently two priorities available, AsyncComputePriority_High andAsyncComputePriority_Default.

RHIEndAsyncComputeJob_DrawThreadEnds an async compute job. Returns a 32-bit Fence Index which can be used for synchronization, or -1 if compute is disabled orthere is no active compute job

RHIGraphicsWaitOnAsyncComputeJobInserts an command in the graphics immediate context to block until an async job is complete. Passing -1 causes this to early-out.

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 runtimewith the r.AsyncCompute console variable. When async compute is disabled, dispatches within async compute blocks are executed synchronously onthe 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 whenasync 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:

【虚幻4翻译文档-AsyncCompute | Unreal Engine】[虚幻4中文文档]


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 alwaysbe able to run without (console variable / define) to run on other platforms and easier debugging and profiling. AsyncCompute should be used with cautionas it can cause more unpredicatble performance and requires more coding effort for synchromization.
回复

使用道具 举报

0

主题

866

帖子

2888

积分

vip会员

Rank: 1

积分
2888
发表于 2016-7-2 19:30:13 来自手机 | 显示全部楼层
谢谢分享,顶一个
回复 支持 反对

使用道具 举报

0

主题

900

帖子

2970

积分

vip会员

Rank: 1

积分
2970
发表于 2016-7-3 23:34:20 | 显示全部楼层
感谢楼主的大爱无私
回复 支持 反对

使用道具 举报

0

主题

814

帖子

2619

积分

vip会员

Rank: 1

积分
2619
发表于 2016-7-4 11:30:49 来自手机 | 显示全部楼层
回复看看!!!!!!!!!楼主辛苦
回复 支持 反对

使用道具 举报

0

主题

906

帖子

2951

积分

vip会员

Rank: 1

积分
2951
发表于 2016-7-8 15:27:39 来自手机 | 显示全部楼层
挺不错的!就是不知道价格
回复 支持 反对

使用道具 举报

0

主题

818

帖子

2700

积分

vip会员

Rank: 1

积分
2700
发表于 2016-7-9 16:18:46 来自手机 | 显示全部楼层
我知道楼主一向黑~~~~~
回复 支持 反对

使用道具 举报

0

主题

840

帖子

2794

积分

vip会员

Rank: 1

积分
2794
发表于 2016-7-11 07:03:33 | 显示全部楼层
谢谢分享,顶一个
回复 支持 反对

使用道具 举报

0

主题

923

帖子

3021

积分

vip会员

Rank: 1

积分
3021
发表于 2016-7-12 14:41:45 来自手机 | 显示全部楼层
谢谢共享,总之先收藏了
回复 支持 反对

使用道具 举报

0

主题

831

帖子

2739

积分

vip会员

Rank: 1

积分
2739
发表于 2016-7-12 19:49:15 来自手机 | 显示全部楼层
谢谢支持。
回复 支持 反对

使用道具 举报

0

主题

834

帖子

2789

积分

vip会员

Rank: 1

积分
2789
发表于 2016-7-16 20:24:01 来自手机 | 显示全部楼层
收下了了来了 拉
回复 支持 反对

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | enginedx注册

本版积分规则

 
 



邮件留言:


 
返回顶部