• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
KaiRohmer

GPU runtime optimization by the graphics driver

9 posts in this topic

Hi,
i heard about some optimization that is done by the driver depending on the calls you make.. this can change the branch prediction for example..

in my master thesis i measured some timings of different steps in my pipeline. 2 of 6 steps depend on the geometry of the input model.. the rest is fixed.. (e.g. rendering a background scene, composition of targets to final output, ...). on my GTX 560 the fixed parts take constant time like expected and the 2 other steps scale with model complexity.. fine ;).. . on another GPU (AMD..something).. everything is changing (more or less slightly)..

are there some articles or technical reports that can explain this behavior? (something to cite maybe ;) )
i can't find anything.. maybe you know where to start.. or wrote it already in a book ;)

thanks a lot!
0

Share this post


Link to post
Share on other sites
It depends on what those "fixed" parts are doing. I find it much more likely that those passes are not actually constant time, than that the driver is doing something inconsistent. The kinds of full-screen passes used in modern techniques can often have variable timing: Variable width blurs can be affected by texture cache, branches or loops in complex shaders can be sensitive to the input images, etc...
0

Share this post


Link to post
Share on other sites
maybe unrelated, but is it _always_ better to use if(something) color += texture2D(...)
or is it better to avoid the if()'s where you can as a general rule?

does the GLSL specific functions work just like if's? (clamp, min, max, normalize)
i realize that drivers likely will execute clamp, min and max fast (and that normalize is always slow)
Edited by Kaptein
0

Share this post


Link to post
Share on other sites
[quote name='derKai' timestamp='1354385526' post='5006061']in my master thesis i measured some timings of different steps in my pipeline. 2 of 6 steps depend on the geometry of the input model.. the rest is fixed.. (e.g. rendering a background scene, composition of targets to final output, ...)[/quote]Sorry, I don't have many links to documents to help you understand the drivers/hardware behaviour, but it would be interesting to hear your approach to isolating these steps.
Typically it's hard to measure any single operation -- e.g. composing targets executes a cheap shader (low chance of ALU being the bottleneck), but puts a lot of pressure on texture fetching and an equal amount on ROP, making it hard to tell which of the two is the bottleneck.
Also, even within a single generation of GPUs, the difference in bandwidth between low and high-end models can differ by ~20x, meaning an operation that's ALU-bound on one model may be fetch-bound on another model.

There's a careful balance between fetch latencies (and the GPUs bandwidth), the number of temp registers required by a shader (and the size of the GPU's register file) and the amount of non-fetch (ALU) work (and the GPU's speed at ALU work).
e.g. if a shader is fetch-bound, then decreasing temp-reg usage (or increasing the GPU's reg file size) might remove that bottleneck. In the same situation, you may be able to add more ALU work "for free" (assuming you don't add more temp-registers as well), or you might be able to assume that when moving to a GPU with lower ALU-speed, then performance won't be affected.
[quote name='derKai' timestamp='1354385526' post='5006061']on another GPU (AMD..something).. everything is changing (more or less slightly)..[/quote]What do you mean exactly? The timings change run-to-run, as in they're random? Or they've changed from the previous GPU? Or they change based on some API state that's set? Edited by Hodgman
0

Share this post


Link to post
Share on other sites
Thanks for your replies!
first of all i'll try to explain what i'm doing ;)
in general.. . it's an augmented reality application.. so there are some steps to perform..[list=1]
[*]rendering background layer (at the moment the model of a room from the inside.. to simulate the camera).. the camera does not move and so the afford should be constant
[*]generate shadow maps of the room above and the model below (see next step)
[*]render virtual objects..they are changing for performance measures.. (i restart the application to change the model) ... these models also don't move
[*]render virtual shadows.. therefor the room geometry and the shadow maps are used.. should be fixed time
[*]blend results of 1. 3. and 4. together
[/list]
these steps are always the same.. (so i always have the same calls from cpu side)

i don't use branches.. all if's are replaced by step() and lerp().. (forcing the gpu to always calculate both paths?)
the number of texture fetches per pixel is constant

to measure timings i use queries:
http://mynameismjp.wordpress.com/2011/10/13/profiling-in-dx11-with-queries/
so here can be a problem because this timer is not really high precision
but the fast GPU works as expected... the slow doesn't :(

so.. now to measured values:
i compare timings of the 5 steps from runs with three different models: (primitive counts: 5000, 30000 and 50000)

on the geforce the three timings of 1 4 and 5 are equal and the timings of 2 and 3 are growing with primitive counts.
over time the measurements changing very little.. e.g. 1/100ms

on the amd-chip 2 and 3 are growing with primitive count, too. but steps 1 4 and 5 are changed by -+ 1ms

e.g.:
Rendering Backgorund:
model-a model-b model-c
0.23ms 0.23ms 0.23ms - Geforce
1,82ms 1,77ms 1,74ms - AMD

Composition:
model-a model-b model-c
0.17ms 0.17ms 0.17ms - Geforce
8,17ms 7,04ms 6,72ms - AMD

i think hodgeman's explaination points in the right direction..
the AMD-Chip is a mobile chip without vram .. so texture fetches are very expensive (for cache misses)..
is it possible that the driver uses different schemes to predict what texture data blocks are needed.. so that this leads in different hit-miss-ratio ? Edited by derKai
0

Share this post


Link to post
Share on other sites
Update:
i posted a link to MJPs blog post and said i used this method to measure my timings..
i forgot that this is actually not totally true^^..

there are two ways..
first: wait in a while loop until the query is finished (this will sync cpu and gpu)
second: do not wait.. instead collect the results in the next frame (this will not sync)

for my measuring i took the second one.. . now i tried to sync, what was slowing down the frame rate but the timing are much closer now.. what is quite interesting (the fact that the timings got closes)
0

Share this post


Link to post
Share on other sites
The problem with queries for performance measurements is that they don't always measure what you want them to measure. Looking at the difference in GPU timestamps gives you the amount of time that it takes the GPU to process all commands in the command buffer that were between the timestamps, which doesn't necessarily tell you the total time required to fully execute those commands. This is because a GPU is pipelined, and can be working on multiple commands (even draw commands) simultaneously. Therefore they're not so great for fine-grained measurements. They'll work better if you can place them around natural sync points for the GPU, such as render target switches.
1

Share this post


Link to post
Share on other sites
You know what I've heard people do is they have business arrangements with the top 3 graphic card manufacturers and use backdoor API calls to cause the drivers to insert sync points so they can conduct accurate timing. Not sure if any of the undocumented APIs made it out to the web?
0

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  
Followers 0