May 7, 2018
New Intel® VTune™ Amplifier Integration with Unreal Engine 4
In Unreal Engine 4.19, Intel® software engineers worked with Unreal to add support for Intel VTune Amplifier instrumentation and tracing technology (ITT) markers. This guide shows the user how to take advantage of the new integration to generate annotated traces of Unreal Engine 4 (UE4) inside the Intel VTune Amplifier 2018 UI. Download UE4 from Unreal Engine. Download a free trial of Intel VTune Amplifier.
Capturing Unreal Engine 4 TracesScoped events are cumulative CPU timings of blocks of code analyzed frame by frame. Scoped events at the function or “between braces” level can now be captured and viewed in the Intel VTune Analyzer profiler using ITT events. Setting up scoped events can help you track standard engine statistics.
To get started, run the Intel VTune profiler as an Administrator.
For the application, choose the UE4 Editor by including the entire path.
For application parameters, specify the game with any necessary settings, such as resolution. In the example below, the UE4 Particle Effects demo is profiled. Make sure you add “-VTune” at the end of the application parameters command line (see figure 1). If you need help with the command-line arguments in addition to the -VTune switch, refer to the Command-Line Arguments section of the UE4 documentation.
Select the checkbox to set the application directory as the working directory. If you need help with any of the other settings on this screen, use the F1 key to access VTune’s help system.
Next, move to the Analysis Type tab and choose “Advanced Hotspots” under the Algorithm Analysis heading (see figure 2).
Set the CPU sampling interval at 1ms.
For this example, to keep overhead down, at “Select a level of details provided with event-based sampling collection” click “Hotspots.”
Set the Event mode to “All.”
Select the checkbox for “Analyze user tasks, events, and counters.”
Next, start the game through the Intel VTune profiler.
In the Unreal Engine dev console, which you can open with the ~ (tilde) key while the workload is running, type “stat NamedEvents.” Scoped events will now be tracked. Note that you need a Development build to make this feature work. For more information, refer to the Build Configurations section of the UE4 help system.
When finished collecting statistics, stop the profiler.
Viewing Unreal Engine 4 TracesAfter processing the results, the summary will show captured Top Task types statistics, similar to figure 3.
At the Advanced Hotspots screen, move to the “Bottom-up” tab (see figure 4). The Bottom-up view will show an in-depth look at the tasks. Use the “Grouping” pull-down menu to select the view for “Task Domain / Task Type /Task Duration Type / Function / Call Stack.”
You can keep exploring the report for your code profile from additional tabs on the Advanced Hotspot screen. For example, the “Platform” view will depict timing for named events (see figure 5).
There is a lot of information in these reports for you to inspect. For more information, see the documentation for Intel VTune Amplifier Tutorials. You’ll find HTML and PDF documents to walk you through examples, as well as sample code to solve issues with Windows, Linux, C++, Fortran, OpenMP; Android challenges surrounding energy usage; detecting hotspots; identifying locks and waits that prevent parallelization, and more.
Custom EventsAny code snippet inside UE4 that you want to optimize may be investigated by encapsulating it with cycle counters as described in this guide. This gives you the ability to define custom events and follow their execution on the thread timeline in the Intel VTune Analyzer UI.
ConclusionPerformance on modern processors requires much more than optimizing single-thread performance. High-performing code must be:
- Threaded and scalable to utilize multiple CPUs
- Vectorized for efficient use of SIMD units
- Tuned to take advantage of non-uniform memory architectures and caches
EDITOR'S NOTE:Get tools and resources for optimizing Unreal Engine experiences on Intel(R) architecture designed to provide optimization strategies and business opportunities that developers and software businesses need to innovate and succeed.
To be notified of other content for game devs and get a host of other perks, join the Intel Game Dev Program.
Sign up >
This content originally appeared at the Intel Developer Zone.