Sign in to follow this  
hoodedpaladin

just a q about dynamic branch coherency

Recommended Posts

I've seen a few things recently about GPU dynamic branch performance, like in an ATI HD2000 programming guide I read, it stated that dynamic branches are efficient if there's coherency of at least 64 pixels. I'm just curious what the requirements for coherency are - whether they need to be all adjacent on the same polygon, or close to each other but not entirely adjacent, or on the same polygon, or just anywhere in the scene. Also, does anyone know coherency figures like that for other GPU lines?

Share this post


Link to post
Share on other sites
The way the GPU works is that the screen is split into blocks (of like 512 pixels or something like that) and pixels are processed in groups of the warp size (which is like 32 or 64). Blocks are processed sequentially, however pixels inside the block are done in parallel and the GPU is in charge of which group of pixels is being processed at any given time. The warp may or may not be spatially coherent, I'm not really sure how the GPU schedules its threads.

I always thought that the branch coherency was for the entire block, but as it was pointed out to me the other day it's for the entire warp. However since you don't know which warp of pixels are running at any given time, you might as well think of it in terms of block coherency.

So to answer your question, you can just split up the screen into square blocks of size 512 or whatever, and that's your effective coherency resolution. I believe there are a few presentations out there (either ATI or nVidia) with a few diagrams on dynamic branching that will help clarify.

Share this post


Link to post
Share on other sites
To stay compatible with lower end cards you want to avoid branches. Other than this a rule of thumb is:
- use as less as possible (you can switch in the vertex shader cheaper)
- use them on huge textures (shadows)
- expect both branches to be exectuted and plan your shader performance on this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this