Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD
-
Upload
garth-west -
Category
Documents
-
view
111 -
download
7
description
Transcript of Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD
![Page 1: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/1.jpg)
Using GPUView to Understand your DirectX 11 Game
Jon StoryDeveloper Relations Engineer, AMD
![Page 2: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/2.jpg)
Agenda●Windows Display Driver Model (WDDM)●What is GPUView?●CPU & GPU Queues●Threads & Events●Case Studies●Summary
![Page 3: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/3.jpg)
Windows Display Driver Model (WDDM)
![Page 4: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/4.jpg)
Graphics & WDDM
ApplicationApplication D3D Runtime
D3D Runtime
Win32kernelWin32kernel
User Mode Driver (UMD)User Mode
Driver (UMD)
Kernel Mode Driver (KMD)Kernel Mode Driver (KMD)
DxgkrnlDxgkrnl
User Mode
DWM Process
DWMDWM
Application Process
Session Space
KernelMode
![Page 5: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/5.jpg)
Application #1
Application #1
D3D Runtime
D3D Runtime UMDUMD
Command Buffer
Application#2
Application#2
D3D Runtime
D3D Runtime UMDUMD
Command Buffer
User Mode
Kernel Mode
GPU Scheduler DatabaseGPU Scheduler Database
Win32k & dxgkrnl
Win32k & dxgkrnl
11 22
KMDKMD
DMA BufferWait
GPUGPU
Feeding the GPU…
![Page 6: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/6.jpg)
What is GPUView?
![Page 7: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/7.jpg)
What is GPUView?●An additional Microsoft performance tool
● Compliments existing tools● Part of the Windows 7 SDK● Built on Event Tracing for Windows
●Perfect for monitoring CPU/GPU interaction (even for multiple GPU setups)●Allows you to see how well the GPU is being fed ●Supports DX9, DX10 & DX11 on Win7
![Page 8: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/8.jpg)
Capturing Data●Run an elevated command prompt
● \Program Files\Microsoft Windows Performance Toolkit\GPUView
●Start your game in windowed mode● For fullscreen mode perhaps use PsExec from a remote
machine
●Start capturing with log.cmd● Capture 10-15 seconds of your game● Stop logging with log.cmd
●Open merged.etl file with GPUView.exe
![Page 9: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/9.jpg)
Was this tool created for
driver programmers?
![Page 10: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/10.jpg)
Navigating the Data●Use the mouse to select a region●Ctrl+Z zooms in to a selection
● Z zooms out
●Use +/- to see more or less detail●Ctrl+E opens the event menu●Click on objects for additional details
![Page 11: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/11.jpg)
Zooming in…
![Page 12: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/12.jpg)
DMA Packet Color Coding●Various types of DMA packets may be submitted to the GPU:
● Red: Paging packet● Black: Preemption packet● Brown: DWM packet● Other Color: Standard packet ● Other Color + Cross-Hatch: Present packet
![Page 13: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/13.jpg)
What does a Standard DMA Packet Represent?●Graphics system state objects●Draw commands●References to resource allocations
● Textures● Vertex & Index Buffers● Render Targets● Constant Buffers
![Page 14: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/14.jpg)
CPU & GPU Queues
![Page 15: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/15.jpg)
SW Context CPU Queues (1)
Desktop Window Manager packet
D3D app stacking up 3 frames of
packets
![Page 16: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/16.jpg)
SW Context CPU Queue (2)
CPU queue depth is 6
Task submitted to HW queue
CPU queue is empty!
New Task submitted to CPU queue
![Page 17: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/17.jpg)
SW Context CPU Queues (3)●Objects represent work submitted to a GPU context●Queue is represented through time as a stack
● Stack grows on submission of work by the UMD● Stack shrinks as work is completed by the GPU
![Page 18: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/18.jpg)
GPU HW Context Queue (1)
Preemption packet
DWM
Queued DMA Packet
Present Packet
GPU Processing DMA Packet
![Page 19: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/19.jpg)
GPU HW Context Queue (2)
GPU starts working on
packet
GPU finishes working on
packet
GPU has no work to do
![Page 20: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/20.jpg)
GPU HW Context Queue (3)
●Queue is represented through time as a stack● Stack grows on submission of work by the KMD● Stack shrinks as work is completed by the GPU
●Gaps indicate a CPU side bottleneck
![Page 21: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/21.jpg)
Object Selection
Represents latency
![Page 22: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/22.jpg)
Object Details (1)
Packet type & timing information
Allocation references in DMA
packet
![Page 23: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/23.jpg)
Object Details (2)
(w) = Writable by GPU
Preferred memory segment
P0 = PreferredP1 = LessP2 = Least
![Page 24: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/24.jpg)
Object Viewer
Segment Numbers:1 = Vid Mem (CPU visible)2 = Vid Mem (Non visible)3 = PCI Express Mem
Clearly the depth buffer
![Page 25: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/25.jpg)
Paging Buffer Packet●Submitted as the result of a paging operation (perhaps a large texture)●Cause is usually resulting from preparing a DMA buffer●Look at the DMA packet that follows the paging operation
![Page 26: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/26.jpg)
Threads & Events
![Page 27: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/27.jpg)
HW Threads
Colored bars represent idle time Gaps represent
work
![Page 28: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/28.jpg)
Thread Execution
●Thread segments are colored coded:● Light blue: Kernel mode● Dark blue: dxgkrnl● Red: KMD (Kernel Mode Driver)
![Page 29: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/29.jpg)
Charts: FPS / Latency / Memory
![Page 30: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/30.jpg)
Viewing Events●Ctrl+E opens the Event View window●Can track whatever events take your interest●DX- Create / Destroy Allocation●DX Block
● Suggests possible resource contention● Perhaps trying to lock an in use buffer
![Page 31: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/31.jpg)
V-Sync Event
![Page 32: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/32.jpg)
Case Studies
![Page 33: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/33.jpg)
DrawPredicated SDK Sample
GPU is busy, no gaps
CPU queue is buffering up nicely
App thread not saturated
![Page 34: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/34.jpg)
DrawPredicated SDK Sample: + blocking occlusion queries
GPU is going idle
Not enough being queued up
App thread fully saturated
![Page 35: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/35.jpg)
Getting Occlusion Queries Right
●Delay picking up results by N frames● Where N = Number of GPUs
●May need to artificially inflate occlusion volumes to avoid poping
![Page 36: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/36.jpg)
What else could cause this problem?●Locking a Render Target
● Use CopyResource & Staging Textures● This is a queued operation
![Page 37: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/37.jpg)
ContentStreaming SDK Sample (1)
Paging packets
GPU is going idle
![Page 38: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/38.jpg)
ContentStreaming SDK Sample (2)
Large resources not
getting preferred segments
![Page 39: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/39.jpg)
Avoiding Paging●Keep your video memory usage under control
● Especially in MSAA modes● Drop texture resolution for lower end HW
●Avoid excessively large amounts of dynamic data
● Textures & Vertex Buffers
●If not sure – talk to us!
![Page 40: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/40.jpg)
MultithreadedRendering11 SDK Sample
Additional threads
preparing packets
But there is a lot of D3D runtime /
driver overhead
![Page 41: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/41.jpg)
Multi-Threaded Rendering and Deferred Contexts●It is a complex issue●Don‘t expect it to be a magic bullet●Strongly recommend you talk to developer relations from AMD & NVIDIA
![Page 42: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/42.jpg)
Summary
![Page 43: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/43.jpg)
Summary
●Make sure you‘re keeping the ever hungry GPU fed●Keep track of CPU/GPU interaction●Keep track of your threads●Monitor multi-GPU interaction●Add GPUView to your toolbox
![Page 44: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/44.jpg)
Acknowledgments
●Microsoft for creating GPUView ●Microsoft for providing background content
![Page 45: Using GPUView to Understand your DirectX 11 Game Jon Story Developer Relations Engineer, AMD](https://reader033.fdocuments.us/reader033/viewer/2022061509/56812eae550346895d945333/html5/thumbnails/45.jpg)
Questions?