Skip to content

TimChen1383/PerformanceOptimization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 

Repository files navigation

Table of Contents

Profiling

Resources

Profiling

An efficient profiling workflow for Unreal Engine project. PerformanceOptimization

DataFlow

- CPU and GPU are not working in parallel
- Not all rendering-related issues are related to the GPU
- Before the GPU actually renders, CPU also needs to deal with rendering tasks
- Some GPU tasks will need to wait for CPU tasks finish
- Some CPU tasks will need to wait for GPU tasks finish
- That's the reason we will see some waiting tasks in profiled result
  • Game (Game Thread): Gameplay logic + decides what should be rendered > related to CPU bottleneck, game logic too heavy
  • Darw (Render Thread): Prepares rendering work(draw calls, material permutations, culling, sorting, batching, pass...), high-level rendering abstraction > related to CPU bottleneck, scene complexity
  • RHIT (RHI Thread): translates render commands into actual GPU commands (DirectX, Vulkan, Metal...), manages GPU resources > related to CPU/GPU bottleneck (two side)
  • GPU: Actual GPU render > related to GPU bottleneck, rendering/shader overload
  • GPU is rendering frame N
  • RHI Thread is submitting frame N+1
  • Render Thread is building frame N+2
  • Game Thread is simulating frame N+3

DataFlow1 DataFlow2

HighLevelPerformanceScreenshot

  • Set up target fps first: 30 fps = 33.33 ms/frame, 60 fps = 16.66 ms/frame
  • Initial Bottleneck Identification: Is it CPU, GPU or Memory?
  • Always tackling the biggest problem first, leading to maximum performance return for the time invested
  • Finding spikes in profiled result

Common Profiling Tools

  • stat fps : Show current fps
  • stat unit : Overall frame time as well as the game thread, rendering thread, and GPU times
  • stat unitgraph : See the graph with the stat unit data
  • stat rhi : Displays Render Hardware Interface(RHI) memory and performance statistics
  • stat memory : Shows statistics on how much memory is being used by various subsystems

unit memory

ProfilingCPU

Simple Profiling Tools

  • stat game : Gives feedback on how long the various Gameplay Ticks are taking
  • stat physics : Displays physics performance statistics
  • stat anim : Shows how long skinned meshes are taking to compute per tick
  • stat navigation : Shows performance and memory information for the navigation system

Unreal Insights

  • Filter CPU tracks only CPUTask
  • Find the key funciton (or a set of functions) that cause performance issue. Search from high level to low level Tasks
  • Diagnose funciton counts and time spent NamedEvent
  • Enable Stat Named Events will be slightly heavier but provide more tracing details NamedEvent
  • Read function in source code if needed SOURCE

ProfilingGPU

Simple Profiling Tools

  • stat gpu : Displays GPU statistics for the frame
GPU
  • ProfileGPU (GPU Visualizer)
GPUVisualizer
  • Optimization view mode viewMode

Unreal Insights

  • For tracking all frames in general and finding performance spikes
  • Not for diagnose deeply into a single frame(use Render Doc instead)
  • Filter GPU tracks only FilterGPU
  • Find the key elements (or a set of elements) that cause performance issue GPUTasks
  • GPU bottleneck will block other thread's tasks GPU_Bottleneck

RenderDoc

  • For detail diagnoise of a single frame (dive deep into Draw call, Overdraw, Shader Complexity, Render target...)
  • Not for finding performance spikes (use Unreal Insights instead)
  • Texture Viewer: Viewing all textures and render targets used during the capture TextureViewer
  • Pipeline State: A complete snapshot of the GPU pipeline configuration for the currently selected draw call PipelineState
  • Mesh Viewer: A tool for inspecting the geometry produced by a draw call MeshViewer
  • Event Browser: A timeline/tree of all GPU commands recorded in the captured frame EventBrowser
  • We can search for the specific render pass in Event Browser to dive deep into it. Ex: BasePass
  • We can search for actor's display name in Event Browser to dive deep into it

Windows PIX (WIP)

ProfilingMemory

Simple Profiling Tools

  • stat memory : Shows statistics on how much memory is being used by various subsystems in Unreal Engine statMemory
  • stat streaming : Displays basic statistics on streaming assets, like how much memory streaming textures are using, or how many streaming textures there are in the scene statStreaming

Memory Insights

  • Change the path inside "RunMemoryInsight.bat" file to match with your Unreal Engine location
  • Execute "RunMemoryInsight.bat" file. This will run both Unreal Engine and Unreal Insight with memory profiling enabled Memory

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published